diff options
author | Steven Bosscher <steven@gcc.gnu.org> | 2012-12-03 13:16:55 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2012-12-03 13:16:55 +0000 |
commit | 825a3863f03bef59c547c964a4ce06a0379e3fc1 (patch) | |
tree | 29ba79d1c1e035b8c748132503bb060cb0248dfd /gcc/gimple-pretty-print.c | |
parent | 7a8baf28b810873eae40eb993bb3cd4d823770a4 (diff) |
* rtl.h (print_insn_with_notes): Prototype.
* sched-vis.c (print_insn_with_notes): Export it.
* gimple-pretty-print.h (gimple_dump_bb_for_graph): Prototype.
* gimple-pretty-print.c (print_gimple_expr): Flush the buffer.
(pp_gimple_stmt_1): Don't do it here.
(gimple_dump_bb_for_graph): New function.
* tree-pretty-print.c (print_generic_expr): Flush the buffer here.
(dump_generic_node): Don't flush the buffer here.
* graph.h (print_rtl_graph_with_bb): Rename to print_graph_cfg.
* graph.c: Include gimple.h, dumpfile.h, and gimple-pretty-print.h.
(draw_cfg_node): Handle GIMPLE basic blocks also.
(print_rtl_graph_with_bb): Rename to print_graph_cfg.
* passes.c (finish_optimization_passes): Don't finish graph dumps here.
(execute_function_dump): Use print_graph_cfg. Enable dumping the CFG
for GIMPLE also.
(pass_init_dump_file): Wrap in TV_DUMP. Set up CFG graph dumps.
(pass_fini_dump_file): Wrap in TV_DUMP. Finish graph dumps.
(execute_one_pass): Don't set up graph dumps here.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@194085 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-pretty-print.c')
-rw-r--r-- | gcc/gimple-pretty-print.c | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index a5a493a0888..a35fefe56c1 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -111,6 +111,7 @@ print_gimple_expr (FILE *file, gimple g, int spc, int flags) flags |= TDF_RHS_ONLY; maybe_init_pretty_print (file); pp_gimple_stmt_1 (&buffer, g, spc, flags); + pp_flush (&buffer); } @@ -2048,12 +2049,6 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags) default: GIMPLE_NIY; } - - /* If we're building a diagnostic, the formatted text will be - written into BUFFER's stream by the caller; otherwise, write it - now. */ - if (!(flags & TDF_DIAGNOSTIC)) - pp_write_text_to_stream (buffer); } @@ -2271,3 +2266,45 @@ gimple_dump_bb (FILE *file, basic_block bb, int indent, int flags) } dump_gimple_bb_footer (file, bb, indent, flags); } + +/* Dumps basic block BB to pretty-printer PP with default dump flags and + no indentation, for use as a label of a DOT graph record-node. + ??? Should just use gimple_dump_bb_buff here, except that value profiling + histogram dumping doesn't know about pretty-printers. */ + +void +gimple_dump_bb_for_graph (pretty_printer *pp, basic_block bb) +{ + gimple_stmt_iterator gsi; + + pp_printf (pp, "<bb %d>:\n", bb->index); + pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true); + + for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple phi = gsi_stmt (gsi); + if (!virtual_operand_p (gimple_phi_result (phi)) + || (dump_flags & TDF_VOPS)) + { + pp_character (pp, '|'); + pp_write_text_to_stream (pp); + pp_string (pp, "# "); + pp_gimple_stmt_1 (pp, phi, 0, dump_flags); + pp_newline (pp); + pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true); + } + } + + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple stmt = gsi_stmt (gsi); + pp_character (pp, '|'); + pp_write_text_to_stream (pp); + pp_gimple_stmt_1 (pp, stmt, 0, dump_flags); + pp_newline (pp); + pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true); + } + dump_implicit_edges (pp, bb, 0, dump_flags); + pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true); +} + |