From 19a30b7123aa90caf7de3e9ec588266e218f8028 Mon Sep 17 00:00:00 2001 From: Aldy Hernandez Date: Mon, 20 Nov 2017 08:32:57 +0000 Subject: vec.h (debug_helper): New function. * vec.h (debug_helper): New function. (DEFINE_DEBUG_VEC): New macro. * hash-set.h (debug_helper): New function. (DEFINE_DEBUG_HASH_SET): New macro. * cfg.c (debug_slim (edge)): New function. Call DEFINE_DEBUG_VEC for edges. Call DEFINE_DEBUG_HASH_SET for edges. * cfghooks.c (debug_slim (basic_block)): New function. Call DEFINE_DEBUG_VEC for basic blocks. Call DEFINE_DEBUG_HASH_SET for basic blocks. * print-tree.c (debug_slim): New function to handle trees. Call DEFINE_DEBUG_VEC for trees. Call DEFINE_DEBUG_HASH_SET for trees. (debug (vec) &): Remove. (debug () *): Remove. * print-rtl.c (debug_slim): New function to handle const_rtx. Call DEFINE_DEBUG_VEC for rtx_def. Call DEFINE_DEBUG_VEC for rtx_insn. Call DEFINE_DEBUG_HASH_SET for rtx_def. Call DEFINE_DEBUG_HASH_SET for rtx_insn. * sel-sched-dump.c (debug (vec &): Remove. (debug (vec *ptr): Remove. (debug_insn_vector): Remove. * stor-layout.c (debug_rli): Call debug() instead of debug_vec_tree. From-SVN: r254945 --- gcc/hash-set.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'gcc/hash-set.h') diff --git a/gcc/hash-set.h b/gcc/hash-set.h index 8ce796d..75ca147 100644 --- a/gcc/hash-set.h +++ b/gcc/hash-set.h @@ -127,6 +127,44 @@ private: hash_table m_table; }; +/* Generic hash_set debug helper. + + This needs to be instantiated for each hash_set used throughout + the compiler like this: + + DEFINE_DEBUG_HASH_SET (TYPE) + + The reason we have a debug_helper() is because GDB can't + disambiguate a plain call to debug(some_hash), and it must be called + like debug(some_hash). */ +template +void +debug_helper (hash_set &ref) +{ + for (typename hash_set::iterator it = ref.begin (); + it != ref.end (); ++it) + { + debug_slim (*it); + fputc ('\n', stderr); + } +} + +#define DEFINE_DEBUG_HASH_SET(T) \ + template static void debug_helper (hash_set &); \ + DEBUG_FUNCTION void \ + debug (hash_set &ref) \ + { \ + debug_helper (ref); \ + } \ + DEBUG_FUNCTION void \ + debug (hash_set *ptr) \ + { \ + if (ptr) \ + debug (*ptr); \ + else \ + fprintf (stderr, "\n"); \ + } + /* ggc marking routines. */ template -- cgit v1.1