Commit 9d5879a6 by Aldy Hernandez Committed by Aldy Hernandez

passes.c (execute_function_dump): Set graph_dump_initialized appropriately.

	* passes.c (execute_function_dump): Set graph_dump_initialized
	appropriately.
	(pass_init_dump_file): Similarly.
	(execute_one_pass): Pass new argument to do_per_function.
	* tree-pass.h (class opt_pass): New field graph_dump_initialized.

From-SVN: r206092
parent 50e6a148
2013-12-18 Aldy Hernandez <aldyh@redhat.com> 2013-12-18 Aldy Hernandez <aldyh@redhat.com>
* passes.c (execute_function_dump): Set graph_dump_initialized
appropriately.
(pass_init_dump_file): Similarly.
(execute_one_pass): Pass new argument to do_per_function.
* tree-pass.h (class opt_pass): New field graph_dump_initialized.
2013-12-18 Aldy Hernandez <aldyh@redhat.com>
* doc/tree-ssa.texi (SSA Operands): Remove reference to * doc/tree-ssa.texi (SSA Operands): Remove reference to
SSA_OP_VMAYUSE. SSA_OP_VMAYUSE.
Synchronize SSA_OP* definitions with source. Synchronize SSA_OP* definitions with source.
...@@ -1640,8 +1640,10 @@ do_per_function_toporder (void (*callback) (void *data), void *data) ...@@ -1640,8 +1640,10 @@ do_per_function_toporder (void (*callback) (void *data), void *data)
/* Helper function to perform function body dump. */ /* Helper function to perform function body dump. */
static void static void
execute_function_dump (void *data ATTRIBUTE_UNUSED) execute_function_dump (void *data)
{ {
opt_pass *pass = (opt_pass *)data;
if (dump_file && current_function_decl) if (dump_file && current_function_decl)
{ {
if (cfun->curr_properties & PROP_trees) if (cfun->curr_properties & PROP_trees)
...@@ -1655,7 +1657,14 @@ execute_function_dump (void *data ATTRIBUTE_UNUSED) ...@@ -1655,7 +1657,14 @@ execute_function_dump (void *data ATTRIBUTE_UNUSED)
if ((cfun->curr_properties & PROP_cfg) if ((cfun->curr_properties & PROP_cfg)
&& (dump_flags & TDF_GRAPH)) && (dump_flags & TDF_GRAPH))
print_graph_cfg (dump_file_name, cfun); {
if (!pass->graph_dump_initialized)
{
clean_graph_dump_file (dump_file_name);
pass->graph_dump_initialized = true;
}
print_graph_cfg (dump_file_name, cfun);
}
} }
} }
...@@ -1936,6 +1945,7 @@ verify_curr_properties (void *data) ...@@ -1936,6 +1945,7 @@ verify_curr_properties (void *data)
bool bool
pass_init_dump_file (opt_pass *pass) pass_init_dump_file (opt_pass *pass)
{ {
pass->graph_dump_initialized = false;
/* If a dump file name is present, open it if enabled. */ /* If a dump file name is present, open it if enabled. */
if (pass->static_pass_number != -1) if (pass->static_pass_number != -1)
{ {
...@@ -1950,7 +1960,10 @@ pass_init_dump_file (opt_pass *pass) ...@@ -1950,7 +1960,10 @@ pass_init_dump_file (opt_pass *pass)
if (initializing_dump if (initializing_dump
&& dump_file && (dump_flags & TDF_GRAPH) && dump_file && (dump_flags & TDF_GRAPH)
&& cfun && (cfun->curr_properties & PROP_cfg)) && cfun && (cfun->curr_properties & PROP_cfg))
clean_graph_dump_file (dump_file_name); {
clean_graph_dump_file (dump_file_name);
pass->graph_dump_initialized = true;
}
timevar_pop (TV_DUMP); timevar_pop (TV_DUMP);
return initializing_dump; return initializing_dump;
} }
...@@ -2230,7 +2243,7 @@ execute_one_pass (opt_pass *pass) ...@@ -2230,7 +2243,7 @@ execute_one_pass (opt_pass *pass)
verify_interpass_invariants (); verify_interpass_invariants ();
if (dump_file) if (dump_file)
do_per_function (execute_function_dump, NULL); do_per_function (execute_function_dump, pass);
if (pass->type == IPA_PASS) if (pass->type == IPA_PASS)
{ {
struct cgraph_node *node; struct cgraph_node *node;
......
...@@ -114,6 +114,11 @@ public: ...@@ -114,6 +114,11 @@ public:
/* Static pass number, used as a fragment of the dump file name. */ /* Static pass number, used as a fragment of the dump file name. */
int static_pass_number; int static_pass_number;
/* When a given dump file is being initialized, this flag is set to
true if the corresponding TDF_graph dump file has also been
initialized. */
bool graph_dump_initialized;
protected: protected:
gcc::context *m_ctxt; gcc::context *m_ctxt;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment