Add overloaded debug_bb and debug_bb_n with dump flags
authorXionghu Luo <luoxhu@linux.ibm.com>
Mon, 26 Oct 2020 07:52:39 +0000 (02:52 -0500)
committerXionghu Luo <luoxhu@linux.ibm.com>
Mon, 26 Oct 2020 07:52:39 +0000 (02:52 -0500)
Add overloads that accept a flags argument so we can print
debug_bb_n (5, TDF_DETAILS) in gdb, also the debug_bb_slim
variant would then be just a forwarder.

gcc/ChangeLog:

2020-10-26  Xionghu Luo  <luoxhu@linux.ibm.com>

* cfg.c (debug_bb): New overloaded function.
(debug_bb_n): New overloaded function.
* cfg.h (debug_bb): New declaration.
(debug_bb_n): New declaration.
* print-rtl.c (debug_bb_slim): Call debug_bb with flags.

gcc/cfg.c
gcc/cfg.h
gcc/print-rtl.c

index d82324f..de0e71d 100644 (file)
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -720,7 +720,7 @@ free_aux_for_edges (void)
 DEBUG_FUNCTION void
 debug_bb (basic_block bb)
 {
-  dump_bb (stderr, bb, 0, dump_flags);
+  debug_bb (bb, dump_flags);
 }
 
 DEBUG_FUNCTION basic_block
@@ -731,6 +731,24 @@ debug_bb_n (int n)
   return bb;
 }
 
+/* Print BB with specified FLAGS.  */
+
+DEBUG_FUNCTION void
+debug_bb (basic_block bb, dump_flags_t flags)
+{
+  dump_bb (stderr, bb, 0, flags);
+}
+
+/* Print basic block numbered N with specified FLAGS.  */
+
+DEBUG_FUNCTION basic_block
+debug_bb_n (int n, dump_flags_t flags)
+{
+  basic_block bb = BASIC_BLOCK_FOR_FN (cfun, n);
+  debug_bb (bb, flags);
+  return bb;
+}
+
 /* Dumps cfg related information about basic block BB to OUTF.
    If HEADER is true, dump things that appear before the instructions
    contained in BB.  If FOOTER is true, dump things that appear after.
index 1eb7866..93fde6d 100644 (file)
--- a/gcc/cfg.h
+++ b/gcc/cfg.h
@@ -108,6 +108,8 @@ extern void clear_aux_for_edges (void);
 extern void free_aux_for_edges (void);
 extern void debug_bb (basic_block);
 extern basic_block debug_bb_n (int);
+extern void debug_bb (basic_block, dump_flags_t);
+extern basic_block debug_bb_n (int, dump_flags_t);
 extern void dump_bb_info (FILE *, basic_block, int, dump_flags_t, bool, bool);
 extern void brief_dump_cfg (FILE *, dump_flags_t);
 extern void update_bb_profile_for_threading (basic_block, profile_count, edge);
index 25265ef..d514b1c 100644 (file)
@@ -2139,7 +2139,7 @@ extern void debug_bb_slim (basic_block);
 DEBUG_FUNCTION void
 debug_bb_slim (basic_block bb)
 {
-  dump_bb (stderr, bb, 0, TDF_SLIM | TDF_BLOCKS);
+  debug_bb (bb, TDF_SLIM | TDF_BLOCKS);
 }
 
 extern void debug_bb_n_slim (int);