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 | 41222ddf8ee150c52e13d48c5d1b6907a0ce589d (patch) | |
tree | 29ba79d1c1e035b8c748132503bb060cb0248dfd /gcc/graph.c | |
parent | a859517f1e32d071b196fc603c2b62758dbce153 (diff) | |
download | gcc-41222ddf8ee150c52e13d48c5d1b6907a0ce589d.tar.gz |
rtl.h (print_insn_with_notes): Prototype.
* 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.
From-SVN: r194085
Diffstat (limited to 'gcc/graph.c')
-rw-r--r-- | gcc/graph.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/gcc/graph.c b/gcc/graph.c index a908e60baef..c0a9af824d4 100644 --- a/gcc/graph.c +++ b/gcc/graph.c @@ -28,8 +28,11 @@ along with GCC; see the file COPYING3. If not see #include "basic-block.h" #include "rtl.h" #include "tree.h" +#include "gimple.h" #include "graph.h" +#include "dumpfile.h" #include "pretty-print.h" +#include "gimple-pretty-print.h" /* DOT files with the .dot extension are recognized as document templates by a well-known piece of word processing software out of Redmond, WA. @@ -82,8 +85,6 @@ init_graph_slim_pretty_print (FILE *fp) static void draw_cfg_node (pretty_printer *pp, int fndecl_uid, basic_block bb) { - rtx insn; - bool first = true; const char *shape; const char *fillcolor; @@ -115,27 +116,26 @@ draw_cfg_node (pretty_printer *pp, int fndecl_uid, basic_block bb) pp_character (pp, '{'); pp_write_text_to_stream (pp); - /* TODO: inter-bb stuff. */ - FOR_BB_INSNS (bb, insn) + /* This would be easier if there'd be an IR independent iterator... */ + if (current_ir_type () == IR_GIMPLE) + gimple_dump_bb_for_graph (pp, bb); + else { - if (! first) + rtx insn; + bool first = true; + + /* TODO: inter-bb stuff. */ + FOR_BB_INSNS (bb, insn) { - pp_character (pp, '|'); - pp_write_text_to_stream (pp); + if (! first) + { + pp_character (pp, '|'); + pp_write_text_to_stream (pp); + } + first = false; + print_insn_with_notes (pp, insn); + pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true); } - first = false; - - print_insn (pp, insn, 1); - pp_newline (pp); - if (INSN_P (insn) && REG_NOTES (insn)) - for (rtx note = REG_NOTES (insn); note; note = XEXP (note, 1)) - { - pp_printf (pp, " %s: ", - GET_REG_NOTE_NAME (REG_NOTE_KIND (note))); - print_pattern (pp, XEXP (note, 0), 1); - pp_newline (pp); - } - pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true); } pp_character (pp, '}'); } @@ -189,10 +189,10 @@ draw_cfg_node_succ_edges (pretty_printer *pp, int fndecl_uid, basic_block bb) pp_flush (pp); } -/* Print a graphical representation of the CFG of function FUN. - Currently only supports RTL in cfgrtl or cfglayout mode, GIMPLE is TODO. */ +/* Print a graphical representation of the CFG of function FUN. */ + void -print_rtl_graph_with_bb (const char *base, tree fndecl) +print_graph_cfg (const char *base, tree fndecl) { const char *funcname = fndecl_name (fndecl); int fndecl_uid = DECL_UID (fndecl); |