aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-pretty-print.c
diff options
context:
space:
mode:
authorSteven Bosscher <steven@gcc.gnu.org>2012-07-20 12:25:55 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2012-07-20 12:25:55 +0000
commitbeaddc0dd701f034e376ee9bf4c99b1a872b41cd (patch)
tree303d907b5ee72aaa7b209fd1bcaf4f0ab16f41b1 /gcc/gimple-pretty-print.c
parent30bf48e94f85879c40dba24969d1a41af6978022 (diff)
gcc/
* basic-block.h (BB_FLAGS_TO_PRESERVE): New define. (brief_dump_cfg): Update prototype to take flags argument. (check_bb_profile): Remove prototype. * tracer.c (tracer): Update brief_dump_cfg calls. * cfghooks.c (dump_bb): Do not pass TDF_COMMENT to dump_bb_info. Call dump_bb_info before and after the cfghook dump_bb. Terminate the dump with a newline. (dump_flow_info): Do not call check_bb_profile. * cfg.c (clear_bb_flags): Update using BB_FLAGS_TO_PRESERVE. (check_bb_profile): Make static. Take indent and flags arguments. (dump_bb_info): Always dump loop depth. With TDF_DETAILS, call check_bb_profile. Print one edge per line. (brief_dump_cfg): Take a flags argument, and filter out TDF_COMMENT and TDF_DETAILS. * pretty-print.c (pp_base_newline): Set pp_needs_newline to false. * gimple-pretty-print.c (dump_gimple_bb_header): Do not use dump_bb_info here, it is already called from dump_bb. Idem for check_bb_profile. (dump_gimple_bb_footer): Likewise. (gimple_dump_bb_buff): Call pp_flush after dump_gimple_stmt to avoid broken dumps for statement histograms. (gimple_dump_bb): Handle ENTRY_BLOCK and EXIT_BLOCK. Do not call pp_flush here, the buffer should be empty. * sched-rgn.c (debug_region): Pass TDF_BLOCKS to dump_bb. * sched-vis.c (debug_bb_slim): Likewise. * tree-cfg.c (remove_bb): Pass dump_flags to dump_bb. (gimple_debug_bb): Pass TDF_BLOCKS to dump_bb. (gimple_dump_cfg): Do brief_dump_cfg with TDF_COMMENT. (dump_function_to_file): Do not call check_bb_profile on ENTRY_BLOCK and EXIT_BLOCK, check_bb_profile doesn't handle them. Use dump_bb instead of gimple_dump_bb. (print_loops_bb): Use dump_bb instead of gimple_dump_bb. * passes.c (execute_function_dump): Always call print_rtl_with_bb for RTL dumps. * cfgrtl.c (print_rtl_with_bb): Handle printing without an up-to-date CFG. With TDF_BLOCKS and TDF_DETAILS, do DF dumps at the top and bottom of each basic block. testsuite/ * gcc.dg/tree-prof/update-loopch.c: Look for counts on the dumps of the basic block and check loop depth. * gcc.dg/tree-ssa/pr18133-1.c: Dump details, not blocks. Update matching patterns and comments. * gcc.dg/tree-ssa/20031021-1.c: Fix check patterns. * gcc.dg/tree-ssa/vector-2.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@189717 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-pretty-print.c')
-rw-r--r--gcc/gimple-pretty-print.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index febf1d98dbc..ce9a3ac880d 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -115,7 +115,9 @@ print_gimple_expr (FILE *file, gimple g, int spc, int flags)
/* Print the GIMPLE sequence SEQ on BUFFER using SPC indentantion
- spaces and FLAGS as in dump_gimple_stmt. */
+ spaces and FLAGS as in dump_gimple_stmt.
+ The caller is responsible for calling pp_flush on BUFFER to finalize
+ the pretty printer. */
static void
dump_gimple_seq (pretty_printer *buffer, gimple_seq seq, int spc, int flags)
@@ -1578,8 +1580,9 @@ dump_gimple_asm (pretty_printer *buffer, gimple gs, int spc, int flags)
}
-/* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in
- dump_gimple_stmt. */
+/* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in dump_gimple_stmt.
+ The caller is responsible for calling pp_flush on BUFFER to finalize
+ pretty printer. */
static void
dump_gimple_phi (pretty_printer *buffer, gimple phi, int spc, int flags)
@@ -1843,7 +1846,8 @@ dump_gimple_mem_ops (pretty_printer *buffer, gimple gs, int spc, int flags)
/* Dump the gimple statement GS on the pretty printer BUFFER, SPC
spaces of indent. FLAGS specifies details to show in the dump (see
- TDF_* in dumpfile.h). */
+ TDF_* in dumpfile.h). The caller is responsible for calling
+ pp_flush on BUFFER to finalize the pretty printer. */
void
dump_gimple_stmt (pretty_printer *buffer, gimple gs, int spc, int flags)
@@ -2067,8 +2071,6 @@ dump_gimple_bb_header (FILE *outf, basic_block bb, int indent, int flags)
{
if (flags & TDF_BLOCKS)
{
- dump_bb_info (outf, bb, indent, flags, true, false);
-
if (flags & TDF_LINENO)
{
gimple_stmt_iterator gsi;
@@ -2103,8 +2105,6 @@ dump_gimple_bb_header (FILE *outf, basic_block bb, int indent, int flags)
fprintf (outf, "%s<bb %d>:\n", s_indent, bb->index);
}
}
- if (cfun)
- check_bb_profile (bb, outf);
}
@@ -2112,9 +2112,13 @@ dump_gimple_bb_header (FILE *outf, basic_block bb, int indent, int flags)
spaces. */
static void
-dump_gimple_bb_footer (FILE *outf, basic_block bb, int indent, int flags)
+dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED,
+ basic_block bb ATTRIBUTE_UNUSED,
+ int indent ATTRIBUTE_UNUSED,
+ int flags ATTRIBUTE_UNUSED)
{
- dump_bb_info (outf, bb, indent, flags, false, true);
+ /* There is currently no GIMPLE-specific basic block info to dump. */
+ return;
}
@@ -2256,7 +2260,7 @@ gimple_dump_bb_buff (pretty_printer *buffer, basic_block bb, int indent,
INDENT (curr_indent);
dump_gimple_stmt (buffer, stmt, curr_indent, flags);
- pp_newline (buffer);
+ pp_flush (buffer);
dump_histograms_for_stmt (cfun, buffer->buffer->stream, stmt);
}
@@ -2271,8 +2275,10 @@ void
gimple_dump_bb (FILE *file, basic_block bb, int indent, int flags)
{
dump_gimple_bb_header (file, bb, indent, flags);
- maybe_init_pretty_print (file);
- gimple_dump_bb_buff (&buffer, bb, indent, flags);
- pp_flush (&buffer);
+ if (bb->index >= NUM_FIXED_BLOCKS)
+ {
+ maybe_init_pretty_print (file);
+ gimple_dump_bb_buff (&buffer, bb, indent, flags);
+ }
dump_gimple_bb_footer (file, bb, indent, flags);
}