Commit 2cbf2d95 by Richard Biener Committed by Richard Biener

tree-pass.h (execute_pass_list): Adjust prototype.

2014-04-28  Richard Biener  <rguenther@suse.de>

	* tree-pass.h (execute_pass_list): Adjust prototype.
	* passes.c (pass_manager::execute_early_local_passes):
	Adjust.
	(do_per_function): Change callback signature, push all actual
	work to the callbals.
	(do_per_function_toporder): Likewise.
	(execute_function_dump): Adjust.
	(execute_function_todo): Likewise.
	(clear_last_verified): Likewise.
	(verify_curr_properties): Likewise.
	(update_properties_after_pass): Likewise.
	(execute_pass_list_1): Split out from ...
	(execute_pass_list): ... here.  Adjust.
	(execute_ipa_pass_list): Likewise.
	* cgraphunit.c (cgraph_add_new_function): Adjust.
	(analyze_function): Likewise.
	(expand_function): Likewise.
	* cgraph.c (release_function_body): Free dominance info
	here instead of asserting it was magically freed elsewhere.

From-SVN: r209856
parent ba21a04a
2014-04-28 Richard Biener <rguenther@suse.de>
* tree-pass.h (execute_pass_list): Adjust prototype.
* passes.c (pass_manager::execute_early_local_passes):
Adjust.
(do_per_function): Change callback signature, push all actual
work to the callbals.
(do_per_function_toporder): Likewise.
(execute_function_dump): Adjust.
(execute_function_todo): Likewise.
(clear_last_verified): Likewise.
(verify_curr_properties): Likewise.
(update_properties_after_pass): Likewise.
(execute_pass_list_1): Split out from ...
(execute_pass_list): ... here. Adjust.
(execute_ipa_pass_list): Likewise.
* cgraphunit.c (cgraph_add_new_function): Adjust.
(analyze_function): Likewise.
(expand_function): Likewise.
* cgraph.c (release_function_body): Free dominance info
here instead of asserting it was magically freed elsewhere.
2014-04-28 Eric Botcazou <ebotcazou@adacore.com> 2014-04-28 Eric Botcazou <ebotcazou@adacore.com>
* configure.ac: Tweak GAS check for LEON instructions on SPARC. * configure.ac: Tweak GAS check for LEON instructions on SPARC.
......
...@@ -1696,8 +1696,8 @@ release_function_body (tree decl) ...@@ -1696,8 +1696,8 @@ release_function_body (tree decl)
} }
if (cfun->cfg) if (cfun->cfg)
{ {
gcc_assert (dom_computed[0] == DOM_NONE); free_dominance_info (CDI_DOMINATORS);
gcc_assert (dom_computed[1] == DOM_NONE); free_dominance_info (CDI_POST_DOMINATORS);
clear_edges (); clear_edges ();
cfun->cfg = NULL; cfun->cfg = NULL;
} }
......
...@@ -520,7 +520,7 @@ cgraph_add_new_function (tree fndecl, bool lowered) ...@@ -520,7 +520,7 @@ cgraph_add_new_function (tree fndecl, bool lowered)
push_cfun (DECL_STRUCT_FUNCTION (fndecl)); push_cfun (DECL_STRUCT_FUNCTION (fndecl));
gimple_register_cfg_hooks (); gimple_register_cfg_hooks ();
bitmap_obstack_initialize (NULL); bitmap_obstack_initialize (NULL);
execute_pass_list (passes->all_lowering_passes); execute_pass_list (cfun, passes->all_lowering_passes);
passes->execute_early_local_passes (); passes->execute_early_local_passes ();
bitmap_obstack_release (NULL); bitmap_obstack_release (NULL);
pop_cfun (); pop_cfun ();
...@@ -658,7 +658,7 @@ analyze_function (struct cgraph_node *node) ...@@ -658,7 +658,7 @@ analyze_function (struct cgraph_node *node)
gimple_register_cfg_hooks (); gimple_register_cfg_hooks ();
bitmap_obstack_initialize (NULL); bitmap_obstack_initialize (NULL);
execute_pass_list (g->get_passes ()->all_lowering_passes); execute_pass_list (cfun, g->get_passes ()->all_lowering_passes);
free_dominance_info (CDI_POST_DOMINATORS); free_dominance_info (CDI_POST_DOMINATORS);
free_dominance_info (CDI_DOMINATORS); free_dominance_info (CDI_DOMINATORS);
compact_blocks (); compact_blocks ();
...@@ -1771,7 +1771,7 @@ expand_function (struct cgraph_node *node) ...@@ -1771,7 +1771,7 @@ expand_function (struct cgraph_node *node)
/* Signal the start of passes. */ /* Signal the start of passes. */
invoke_plugin_callbacks (PLUGIN_ALL_PASSES_START, NULL); invoke_plugin_callbacks (PLUGIN_ALL_PASSES_START, NULL);
execute_pass_list (g->get_passes ()->all_passes); execute_pass_list (cfun, g->get_passes ()->all_passes);
/* Signal the end of passes. */ /* Signal the end of passes. */
invoke_plugin_callbacks (PLUGIN_ALL_PASSES_END, NULL); invoke_plugin_callbacks (PLUGIN_ALL_PASSES_END, NULL);
......
...@@ -132,7 +132,7 @@ opt_pass::opt_pass (const pass_data &data, context *ctxt) ...@@ -132,7 +132,7 @@ opt_pass::opt_pass (const pass_data &data, context *ctxt)
void void
pass_manager::execute_early_local_passes () pass_manager::execute_early_local_passes ()
{ {
execute_pass_list (pass_early_local_passes_1->sub); execute_pass_list (cfun, pass_early_local_passes_1->sub);
} }
unsigned int unsigned int
...@@ -1498,27 +1498,17 @@ pass_manager::pass_manager (context *ctxt) ...@@ -1498,27 +1498,17 @@ pass_manager::pass_manager (context *ctxt)
call CALLBACK on the current function. */ call CALLBACK on the current function. */
static void static void
do_per_function (void (*callback) (void *data), void *data) do_per_function (void (*callback) (function *, void *data), void *data)
{ {
if (current_function_decl) if (current_function_decl)
callback (data); callback (cfun, data);
else else
{ {
struct cgraph_node *node; struct cgraph_node *node;
FOR_EACH_DEFINED_FUNCTION (node) FOR_EACH_DEFINED_FUNCTION (node)
if (node->analyzed && gimple_has_body_p (node->decl) if (node->analyzed && gimple_has_body_p (node->decl)
&& (!node->clone_of || node->decl != node->clone_of->decl)) && (!node->clone_of || node->decl != node->clone_of->decl))
{ callback (DECL_STRUCT_FUNCTION (node->decl), data);
push_cfun (DECL_STRUCT_FUNCTION (node->decl));
callback (data);
if (!flag_wpa)
{
free_dominance_info (CDI_DOMINATORS);
free_dominance_info (CDI_POST_DOMINATORS);
}
pop_cfun ();
ggc_collect ();
}
} }
} }
...@@ -1533,12 +1523,12 @@ static GTY ((length ("nnodes"))) cgraph_node_ptr *order; ...@@ -1533,12 +1523,12 @@ static GTY ((length ("nnodes"))) cgraph_node_ptr *order;
call CALLBACK on the current function. call CALLBACK on the current function.
This function is global so that plugins can use it. */ This function is global so that plugins can use it. */
void void
do_per_function_toporder (void (*callback) (void *data), void *data) do_per_function_toporder (void (*callback) (function *, void *data), void *data)
{ {
int i; int i;
if (current_function_decl) if (current_function_decl)
callback (data); callback (cfun, data);
else else
{ {
gcc_assert (!order); gcc_assert (!order);
...@@ -1554,15 +1544,7 @@ do_per_function_toporder (void (*callback) (void *data), void *data) ...@@ -1554,15 +1544,7 @@ do_per_function_toporder (void (*callback) (void *data), void *data)
order[i] = NULL; order[i] = NULL;
node->process = 0; node->process = 0;
if (cgraph_function_with_gimple_body_p (node)) if (cgraph_function_with_gimple_body_p (node))
{ callback (DECL_STRUCT_FUNCTION (node->decl), data);
cgraph_get_body (node);
push_cfun (DECL_STRUCT_FUNCTION (node->decl));
callback (data);
free_dominance_info (CDI_DOMINATORS);
free_dominance_info (CDI_POST_DOMINATORS);
pop_cfun ();
ggc_collect ();
}
} }
} }
ggc_free (order); ggc_free (order);
...@@ -1573,14 +1555,16 @@ do_per_function_toporder (void (*callback) (void *data), void *data) ...@@ -1573,14 +1555,16 @@ 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) execute_function_dump (function *fn, void *data)
{ {
opt_pass *pass = (opt_pass *)data; opt_pass *pass = (opt_pass *)data;
if (dump_file && current_function_decl) if (dump_file)
{ {
if (cfun->curr_properties & PROP_trees) push_cfun (fn);
dump_function_to_file (current_function_decl, dump_file, dump_flags);
if (fn->curr_properties & PROP_trees)
dump_function_to_file (fn->decl, dump_file, dump_flags);
else else
print_rtl_with_bb (dump_file, get_insns (), dump_flags); print_rtl_with_bb (dump_file, get_insns (), dump_flags);
...@@ -1588,7 +1572,7 @@ execute_function_dump (void *data) ...@@ -1588,7 +1572,7 @@ execute_function_dump (void *data)
close the file before aborting. */ close the file before aborting. */
fflush (dump_file); fflush (dump_file);
if ((cfun->curr_properties & PROP_cfg) if ((fn->curr_properties & PROP_cfg)
&& (dump_flags & TDF_GRAPH)) && (dump_flags & TDF_GRAPH))
{ {
if (!pass->graph_dump_initialized) if (!pass->graph_dump_initialized)
...@@ -1596,8 +1580,10 @@ execute_function_dump (void *data) ...@@ -1596,8 +1580,10 @@ execute_function_dump (void *data)
clean_graph_dump_file (dump_file_name); clean_graph_dump_file (dump_file_name);
pass->graph_dump_initialized = true; pass->graph_dump_initialized = true;
} }
print_graph_cfg (dump_file_name, cfun); print_graph_cfg (dump_file_name, fn);
} }
pop_cfun ();
} }
} }
...@@ -1728,13 +1714,15 @@ pass_manager::dump_profile_report () const ...@@ -1728,13 +1714,15 @@ pass_manager::dump_profile_report () const
/* Perform all TODO actions that ought to be done on each function. */ /* Perform all TODO actions that ought to be done on each function. */
static void static void
execute_function_todo (void *data) execute_function_todo (function *fn, void *data)
{ {
unsigned int flags = (size_t)data; unsigned int flags = (size_t)data;
flags &= ~cfun->last_verified; flags &= ~fn->last_verified;
if (!flags) if (!flags)
return; return;
push_cfun (fn);
/* Always cleanup the CFG before trying to update SSA. */ /* Always cleanup the CFG before trying to update SSA. */
if (flags & TODO_cleanup_cfg) if (flags & TODO_cleanup_cfg)
{ {
...@@ -1774,7 +1762,10 @@ execute_function_todo (void *data) ...@@ -1774,7 +1762,10 @@ execute_function_todo (void *data)
/* If we've seen errors do not bother running any verifiers. */ /* If we've seen errors do not bother running any verifiers. */
if (seen_error ()) if (seen_error ())
return; {
pop_cfun ();
return;
}
#if defined ENABLE_CHECKING #if defined ENABLE_CHECKING
if (flags & TODO_verify_ssa if (flags & TODO_verify_ssa
...@@ -1793,7 +1784,9 @@ execute_function_todo (void *data) ...@@ -1793,7 +1784,9 @@ execute_function_todo (void *data)
verify_rtl_sharing (); verify_rtl_sharing ();
#endif #endif
cfun->last_verified = flags & TODO_verify_all; fn->last_verified = flags & TODO_verify_all;
pop_cfun ();
} }
/* Perform all TODO actions. */ /* Perform all TODO actions. */
...@@ -1855,9 +1848,9 @@ verify_interpass_invariants (void) ...@@ -1855,9 +1848,9 @@ verify_interpass_invariants (void)
/* Clear the last verified flag. */ /* Clear the last verified flag. */
static void static void
clear_last_verified (void *data ATTRIBUTE_UNUSED) clear_last_verified (function *fn, void *data ATTRIBUTE_UNUSED)
{ {
cfun->last_verified = 0; fn->last_verified = 0;
} }
/* Helper function. Verify that the properties has been turn into the /* Helper function. Verify that the properties has been turn into the
...@@ -1865,10 +1858,10 @@ clear_last_verified (void *data ATTRIBUTE_UNUSED) ...@@ -1865,10 +1858,10 @@ clear_last_verified (void *data ATTRIBUTE_UNUSED)
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
static void static void
verify_curr_properties (void *data) verify_curr_properties (function *fn, void *data)
{ {
unsigned int props = (size_t)data; unsigned int props = (size_t)data;
gcc_assert ((cfun->curr_properties & props) == props); gcc_assert ((fn->curr_properties & props) == props);
} }
#endif #endif
...@@ -1927,11 +1920,11 @@ pass_fini_dump_file (opt_pass *pass) ...@@ -1927,11 +1920,11 @@ pass_fini_dump_file (opt_pass *pass)
properties. */ properties. */
static void static void
update_properties_after_pass (void *data) update_properties_after_pass (function *fn, void *data)
{ {
opt_pass *pass = (opt_pass *) data; opt_pass *pass = (opt_pass *) data;
cfun->curr_properties = (cfun->curr_properties | pass->properties_provided) fn->curr_properties = (fn->curr_properties | pass->properties_provided)
& ~pass->properties_destroyed; & ~pass->properties_destroyed;
} }
/* Execute summary generation for all of the passes in IPA_PASS. */ /* Execute summary generation for all of the passes in IPA_PASS. */
...@@ -2206,20 +2199,33 @@ execute_one_pass (opt_pass *pass) ...@@ -2206,20 +2199,33 @@ execute_one_pass (opt_pass *pass)
return true; return true;
} }
void static void
execute_pass_list (opt_pass *pass) execute_pass_list_1 (opt_pass *pass)
{ {
do do
{ {
gcc_assert (pass->type == GIMPLE_PASS gcc_assert (pass->type == GIMPLE_PASS
|| pass->type == RTL_PASS); || pass->type == RTL_PASS);
if (execute_one_pass (pass) && pass->sub) if (execute_one_pass (pass) && pass->sub)
execute_pass_list (pass->sub); execute_pass_list_1 (pass->sub);
pass = pass->next; pass = pass->next;
} }
while (pass); while (pass);
} }
void
execute_pass_list (function *fn, opt_pass *pass)
{
push_cfun (fn);
execute_pass_list_1 (pass);
if (fn->cfg)
{
free_dominance_info (CDI_DOMINATORS);
free_dominance_info (CDI_POST_DOMINATORS);
}
pop_cfun ();
}
/* Write out all LTO data. */ /* Write out all LTO data. */
static void static void
write_lto (void) write_lto (void)
...@@ -2543,7 +2549,8 @@ execute_ipa_pass_list (opt_pass *pass) ...@@ -2543,7 +2549,8 @@ execute_ipa_pass_list (opt_pass *pass)
if (pass->sub->type == GIMPLE_PASS) if (pass->sub->type == GIMPLE_PASS)
{ {
invoke_plugin_callbacks (PLUGIN_EARLY_GIMPLE_PASSES_START, NULL); invoke_plugin_callbacks (PLUGIN_EARLY_GIMPLE_PASSES_START, NULL);
do_per_function_toporder ((void (*)(void *))execute_pass_list, do_per_function_toporder ((void (*)(function *, void *))
execute_pass_list,
pass->sub); pass->sub);
invoke_plugin_callbacks (PLUGIN_EARLY_GIMPLE_PASSES_END, NULL); invoke_plugin_callbacks (PLUGIN_EARLY_GIMPLE_PASSES_END, NULL);
} }
......
...@@ -586,7 +586,7 @@ extern gimple_opt_pass *make_pass_convert_switch (gcc::context *ctxt); ...@@ -586,7 +586,7 @@ extern gimple_opt_pass *make_pass_convert_switch (gcc::context *ctxt);
extern opt_pass *current_pass; extern opt_pass *current_pass;
extern bool execute_one_pass (opt_pass *); extern bool execute_one_pass (opt_pass *);
extern void execute_pass_list (opt_pass *); extern void execute_pass_list (function *, opt_pass *);
extern void execute_ipa_pass_list (opt_pass *); extern void execute_ipa_pass_list (opt_pass *);
extern void execute_ipa_summary_passes (ipa_opt_pass_d *); extern void execute_ipa_summary_passes (ipa_opt_pass_d *);
extern void execute_all_ipa_transforms (void); extern void execute_all_ipa_transforms (void);
...@@ -614,7 +614,7 @@ extern bool function_called_by_processed_nodes_p (void); ...@@ -614,7 +614,7 @@ extern bool function_called_by_processed_nodes_p (void);
extern bool first_pass_instance; extern bool first_pass_instance;
/* Declare for plugins. */ /* Declare for plugins. */
extern void do_per_function_toporder (void (*) (void *), void *); extern void do_per_function_toporder (void (*) (function *, void *), void *);
extern void disable_pass (const char *); extern void disable_pass (const char *);
extern void enable_pass (const char *); extern void enable_pass (const char *);
......
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