diff options
author | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-04 18:38:26 +0000 |
---|---|---|
committer | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-04 18:38:26 +0000 |
commit | e079344ab845d2ee93c9901248918af33465a841 (patch) | |
tree | 35aefaa1ad2d2d303da62a7eaf4a4ed7553419cf /gcc/graph.c | |
parent | 859bc1da9b0c33c0a9c7ab8132bebb450b6eab61 (diff) | |
download | gcc-e079344ab845d2ee93c9901248918af33465a841.tar.gz |
* rtl.h (print_insn_with_notes): Remove prototype.
(rtl_dump_bb_for_graph): New prototype.
* sched-vis.c (print_insn_with_notes): Make static again. Fix
printing of notes.
(rtl_dump_bb_for_graph): New function.
* cfghooks.h (struct cfg_hooks) <dump_bb_for_graph>: New hook.
(dump_bb_for_graph): New prototype.
* cfghooks.c (dump_bb_for_graph): New function.
* tree-cfg.c (gimple_cfg_hooks): Register gimple_dump_bb_for_graph
as dump_bb_for_graph hook implementation for GIMPLE.
* cfgrtl.c (rtl_cfg_hooks): Likewise for rtl_dump_bb_for_graph.
(cfg_layout_rtl_cfg_hooks): Likewise.
* graph.c (draw_cfg_node): Don't include sbitmap.h, rtl.h, tree.h,
gimple.h, and gimple-pretty-print.h.
(draw_cfg_node, draw_cfg_node_succ_edges): Use the uniqe function
definition number instead of the function declaration UID.
(print_graph_cfg): Take a struct function instead of a tree.
Use the dump_bb_for_graph hook to dump the basic block content.
* graph.h (print_graph_cfg): Update prototype.
* passes.c (execute_function_dump): Update print_graph_cfg call.
* Makefile.in (graph.o): Fixup dependencies.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194157 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/graph.c')
-rw-r--r-- | gcc/graph.c | 52 |
1 files changed, 13 insertions, 39 deletions
diff --git a/gcc/graph.c b/gcc/graph.c index c0a9af824d4..7fdd41ca00c 100644 --- a/gcc/graph.c +++ b/gcc/graph.c @@ -24,15 +24,10 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "diagnostic-core.h" /* for fatal_error */ -#include "sbitmap.h" #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. @@ -80,10 +75,10 @@ init_graph_slim_pretty_print (FILE *fp) return &graph_slim_pp; } -/* Draw a basic block BB belonging to the function with FNDECL_UID +/* Draw a basic block BB belonging to the function with FUNCDEF_NO as its unique number. */ static void -draw_cfg_node (pretty_printer *pp, int fndecl_uid, basic_block bb) +draw_cfg_node (pretty_printer *pp, int funcdef_no, basic_block bb) { const char *shape; const char *fillcolor; @@ -105,7 +100,7 @@ draw_cfg_node (pretty_printer *pp, int fndecl_uid, basic_block bb) pp_printf (pp, "\tfn_%d_basic_block_%d " "[shape=%s,style=filled,fillcolor=%s,label=\"", - fndecl_uid, bb->index, shape, fillcolor); + funcdef_no, bb->index, shape, fillcolor); if (bb->index == ENTRY_BLOCK) pp_string (pp, "ENTRY"); @@ -115,28 +110,7 @@ draw_cfg_node (pretty_printer *pp, int fndecl_uid, basic_block bb) { pp_character (pp, '{'); pp_write_text_to_stream (pp); - - /* 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 - { - rtx insn; - bool first = true; - - /* TODO: inter-bb stuff. */ - FOR_BB_INSNS (bb, insn) - { - 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); - } - } + dump_bb_for_graph (pp, bb); pp_character (pp, '}'); } @@ -145,9 +119,9 @@ draw_cfg_node (pretty_printer *pp, int fndecl_uid, basic_block bb) } /* Draw all successor edges of a basic block BB belonging to the function - with FNDECL_UID as its unique number. */ + with FUNCDEF_NO as its unique number. */ static void -draw_cfg_node_succ_edges (pretty_printer *pp, int fndecl_uid, basic_block bb) +draw_cfg_node_succ_edges (pretty_printer *pp, int funcdef_no, basic_block bb) { edge e; edge_iterator ei; @@ -181,8 +155,8 @@ draw_cfg_node_succ_edges (pretty_printer *pp, int fndecl_uid, basic_block bb) pp_printf (pp, "\tfn_%d_basic_block_%d:s -> fn_%d_basic_block_%d:n " "[style=%s,color=%s,weight=%d,constraint=%s];\n", - fndecl_uid, e->src->index, - fndecl_uid, e->dest->index, + funcdef_no, e->src->index, + funcdef_no, e->dest->index, style, color, weight, (e->flags & (EDGE_FAKE | EDGE_DFS_BACK)) ? "false" : "true"); } @@ -192,10 +166,10 @@ draw_cfg_node_succ_edges (pretty_printer *pp, int fndecl_uid, basic_block bb) /* Print a graphical representation of the CFG of function FUN. */ void -print_graph_cfg (const char *base, tree fndecl) +print_graph_cfg (const char *base, struct function *fun) { - const char *funcname = fndecl_name (fndecl); - int fndecl_uid = DECL_UID (fndecl); + const char *funcname = function_name (fun); + int funcdef_no = fun->funcdef_no; FILE *fp = open_graph_file (base, "a"); int *rpo = XNEWVEC (int, n_basic_blocks); basic_block bb; @@ -212,7 +186,7 @@ print_graph_cfg (const char *base, tree fndecl) of the nodes. */ n = pre_and_rev_post_order_compute (NULL, rpo, true); for (i = 0; i < n; i++) - draw_cfg_node (pp, fndecl_uid, BASIC_BLOCK (rpo[i])); + draw_cfg_node (pp, funcdef_no, BASIC_BLOCK (rpo[i])); /* Draw all edges at the end to get subgraphs right for GraphViz, which requires nodes to be defined before edges to cluster @@ -224,7 +198,7 @@ print_graph_cfg (const char *base, tree fndecl) for ourselves is also not desirable.) */ mark_dfs_back_edges (); FOR_ALL_BB (bb) - draw_cfg_node_succ_edges (pp, fndecl_uid, bb); + draw_cfg_node_succ_edges (pp, funcdef_no, bb); pp_printf (pp, "\t}\n"); pp_flush (pp); |