aboutsummaryrefslogtreecommitdiff
path: root/gcc/passes.c
diff options
context:
space:
mode:
authorSteven Bosscher <steven@gcc.gnu.org>2012-12-03 13:16:55 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2012-12-03 13:16:55 +0000
commit41222ddf8ee150c52e13d48c5d1b6907a0ce589d (patch)
tree29ba79d1c1e035b8c748132503bb060cb0248dfd /gcc/passes.c
parenta859517f1e32d071b196fc603c2b62758dbce153 (diff)
downloadgcc-41222ddf8ee150c52e13d48c5d1b6907a0ce589d.zip
gcc-41222ddf8ee150c52e13d48c5d1b6907a0ce589d.tar.gz
gcc-41222ddf8ee150c52e13d48c5d1b6907a0ce589d.tar.bz2
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/passes.c')
-rw-r--r--gcc/passes.c44
1 files changed, 14 insertions, 30 deletions
diff --git a/gcc/passes.c b/gcc/passes.c
index 2a5ea00..ce487fc 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -223,10 +223,6 @@ rest_of_type_compilation (tree type, int toplev)
void
finish_optimization_passes (void)
{
- int i;
- struct dump_file_info *dfi;
- char *name;
-
timevar_push (TV_DUMP);
if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
{
@@ -234,24 +230,12 @@ finish_optimization_passes (void)
end_branch_prob ();
dump_finish (pass_profile.pass.static_pass_number);
}
-
if (optimize > 0)
{
dump_start (pass_profile.pass.static_pass_number, NULL);
print_combine_total_stats ();
dump_finish (pass_profile.pass.static_pass_number);
}
-
- /* Do whatever is necessary to finish printing the graphs. */
- for (i = TDI_end; (dfi = get_dump_file_info (i)) != NULL; ++i)
- if (dump_initialized_p (i)
- && (dfi->pflags & TDF_GRAPH) != 0
- && (name = get_dump_file_name (i)) != NULL)
- {
- finish_graph_dump_file (name);
- free (name);
- }
-
timevar_pop (TV_DUMP);
}
@@ -1785,9 +1769,8 @@ execute_function_dump (void *data ATTRIBUTE_UNUSED)
fflush (dump_file);
if ((cfun->curr_properties & PROP_cfg)
- && (cfun->curr_properties & PROP_rtl)
&& (dump_flags & TDF_GRAPH))
- print_rtl_graph_with_bb (dump_file_name, cfun->decl);
+ print_graph_cfg (dump_file_name, cfun->decl);
}
}
@@ -2069,11 +2052,16 @@ pass_init_dump_file (struct opt_pass *pass)
/* If a dump file name is present, open it if enabled. */
if (pass->static_pass_number != -1)
{
+ timevar_push (TV_DUMP);
bool initializing_dump = !dump_initialized_p (pass->static_pass_number);
dump_file_name = get_dump_file_name (pass->static_pass_number);
dump_start (pass->static_pass_number, &dump_flags);
if (dump_file && current_function_decl)
dump_function_header (dump_file, current_function_decl, dump_flags);
+ if (dump_file && (dump_flags & TDF_GRAPH)
+ && cfun && (cfun->curr_properties & PROP_cfg))
+ clean_graph_dump_file (dump_file_name);
+ timevar_pop (TV_DUMP);
return initializing_dump;
}
else
@@ -2086,14 +2074,21 @@ pass_init_dump_file (struct opt_pass *pass)
void
pass_fini_dump_file (struct opt_pass *pass)
{
+ timevar_push (TV_DUMP);
+
/* Flush and close dump file. */
if (dump_file_name)
{
+ gcc_assert (dump_file);
+ if (dump_flags & TDF_GRAPH
+ && cfun && (cfun->curr_properties & PROP_cfg))
+ finish_graph_dump_file (dump_file_name);
free (CONST_CAST (char *, dump_file_name));
dump_file_name = NULL;
}
dump_finish (pass->static_pass_number);
+ timevar_pop (TV_DUMP);
}
/* After executing the pass, apply expected changes to the function
@@ -2250,7 +2245,6 @@ override_gate_status (struct opt_pass *pass, tree func, bool gate_status)
bool
execute_one_pass (struct opt_pass *pass)
{
- bool initializing_dump;
unsigned int todo_after = 0;
bool gate_status;
@@ -2308,7 +2302,7 @@ execute_one_pass (struct opt_pass *pass)
This is a hack until the new folder is ready. */
in_gimple_form = (cfun && (cfun->curr_properties & PROP_trees)) != 0;
- initializing_dump = pass_init_dump_file (pass);
+ pass_init_dump_file (pass);
/* Run pre-pass verification. */
execute_todo (pass->todo_flags_start);
@@ -2335,16 +2329,6 @@ execute_one_pass (struct opt_pass *pass)
do_per_function (update_properties_after_pass, pass);
- if (initializing_dump
- && dump_file
- && (dump_flags & TDF_GRAPH)
- && cfun
- && (cfun->curr_properties & (PROP_cfg | PROP_rtl))
- == (PROP_cfg | PROP_rtl))
- {
- clean_graph_dump_file (dump_file_name);
- }
-
if (profile_report && cfun && (cfun->curr_properties & PROP_cfg))
check_profile_consistency (pass->static_pass_number, 0, true);