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
This commit is contained in:
Richard Biener 2014-04-28 11:30:09 +00:00 committed by Richard Biener
parent ba21a04a1e
commit 2cbf2d9595
5 changed files with 82 additions and 53 deletions

View File

@ -1,3 +1,25 @@
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>
* configure.ac: Tweak GAS check for LEON instructions on SPARC.

View File

@ -1696,8 +1696,8 @@ release_function_body (tree decl)
}
if (cfun->cfg)
{
gcc_assert (dom_computed[0] == DOM_NONE);
gcc_assert (dom_computed[1] == DOM_NONE);
free_dominance_info (CDI_DOMINATORS);
free_dominance_info (CDI_POST_DOMINATORS);
clear_edges ();
cfun->cfg = NULL;
}

View File

@ -520,7 +520,7 @@ cgraph_add_new_function (tree fndecl, bool lowered)
push_cfun (DECL_STRUCT_FUNCTION (fndecl));
gimple_register_cfg_hooks ();
bitmap_obstack_initialize (NULL);
execute_pass_list (passes->all_lowering_passes);
execute_pass_list (cfun, passes->all_lowering_passes);
passes->execute_early_local_passes ();
bitmap_obstack_release (NULL);
pop_cfun ();
@ -658,7 +658,7 @@ analyze_function (struct cgraph_node *node)
gimple_register_cfg_hooks ();
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_DOMINATORS);
compact_blocks ();
@ -1771,7 +1771,7 @@ expand_function (struct cgraph_node *node)
/* Signal the start of passes. */
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. */
invoke_plugin_callbacks (PLUGIN_ALL_PASSES_END, NULL);

View File

@ -132,7 +132,7 @@ opt_pass::opt_pass (const pass_data &data, context *ctxt)
void
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
@ -1498,27 +1498,17 @@ pass_manager::pass_manager (context *ctxt)
call CALLBACK on the current function. */
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)
callback (data);
callback (cfun, data);
else
{
struct cgraph_node *node;
FOR_EACH_DEFINED_FUNCTION (node)
if (node->analyzed && gimple_has_body_p (node->decl)
&& (!node->clone_of || node->decl != node->clone_of->decl))
{
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 ();
}
callback (DECL_STRUCT_FUNCTION (node->decl), data);
}
}
@ -1533,12 +1523,12 @@ static GTY ((length ("nnodes"))) cgraph_node_ptr *order;
call CALLBACK on the current function.
This function is global so that plugins can use it. */
void
do_per_function_toporder (void (*callback) (void *data), void *data)
do_per_function_toporder (void (*callback) (function *, void *data), void *data)
{
int i;
if (current_function_decl)
callback (data);
callback (cfun, data);
else
{
gcc_assert (!order);
@ -1554,15 +1544,7 @@ do_per_function_toporder (void (*callback) (void *data), void *data)
order[i] = NULL;
node->process = 0;
if (cgraph_function_with_gimple_body_p (node))
{
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 ();
}
callback (DECL_STRUCT_FUNCTION (node->decl), data);
}
}
ggc_free (order);
@ -1573,14 +1555,16 @@ do_per_function_toporder (void (*callback) (void *data), void *data)
/* Helper function to perform function body dump. */
static void
execute_function_dump (void *data)
execute_function_dump (function *fn, void *data)
{
opt_pass *pass = (opt_pass *)data;
if (dump_file && current_function_decl)
if (dump_file)
{
if (cfun->curr_properties & PROP_trees)
dump_function_to_file (current_function_decl, dump_file, dump_flags);
push_cfun (fn);
if (fn->curr_properties & PROP_trees)
dump_function_to_file (fn->decl, dump_file, dump_flags);
else
print_rtl_with_bb (dump_file, get_insns (), dump_flags);
@ -1588,7 +1572,7 @@ execute_function_dump (void *data)
close the file before aborting. */
fflush (dump_file);
if ((cfun->curr_properties & PROP_cfg)
if ((fn->curr_properties & PROP_cfg)
&& (dump_flags & TDF_GRAPH))
{
if (!pass->graph_dump_initialized)
@ -1596,8 +1580,10 @@ execute_function_dump (void *data)
clean_graph_dump_file (dump_file_name);
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
/* Perform all TODO actions that ought to be done on each function. */
static void
execute_function_todo (void *data)
execute_function_todo (function *fn, void *data)
{
unsigned int flags = (size_t)data;
flags &= ~cfun->last_verified;
flags &= ~fn->last_verified;
if (!flags)
return;
push_cfun (fn);
/* Always cleanup the CFG before trying to update SSA. */
if (flags & TODO_cleanup_cfg)
{
@ -1774,7 +1762,10 @@ execute_function_todo (void *data)
/* If we've seen errors do not bother running any verifiers. */
if (seen_error ())
return;
{
pop_cfun ();
return;
}
#if defined ENABLE_CHECKING
if (flags & TODO_verify_ssa
@ -1793,7 +1784,9 @@ execute_function_todo (void *data)
verify_rtl_sharing ();
#endif
cfun->last_verified = flags & TODO_verify_all;
fn->last_verified = flags & TODO_verify_all;
pop_cfun ();
}
/* Perform all TODO actions. */
@ -1855,9 +1848,9 @@ verify_interpass_invariants (void)
/* Clear the last verified flag. */
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
@ -1865,10 +1858,10 @@ clear_last_verified (void *data ATTRIBUTE_UNUSED)
#ifdef ENABLE_CHECKING
static void
verify_curr_properties (void *data)
verify_curr_properties (function *fn, void *data)
{
unsigned int props = (size_t)data;
gcc_assert ((cfun->curr_properties & props) == props);
gcc_assert ((fn->curr_properties & props) == props);
}
#endif
@ -1927,11 +1920,11 @@ pass_fini_dump_file (opt_pass *pass)
properties. */
static void
update_properties_after_pass (void *data)
update_properties_after_pass (function *fn, void *data)
{
opt_pass *pass = (opt_pass *) data;
cfun->curr_properties = (cfun->curr_properties | pass->properties_provided)
& ~pass->properties_destroyed;
fn->curr_properties = (fn->curr_properties | pass->properties_provided)
& ~pass->properties_destroyed;
}
/* Execute summary generation for all of the passes in IPA_PASS. */
@ -2206,20 +2199,33 @@ execute_one_pass (opt_pass *pass)
return true;
}
void
execute_pass_list (opt_pass *pass)
static void
execute_pass_list_1 (opt_pass *pass)
{
do
{
gcc_assert (pass->type == GIMPLE_PASS
|| pass->type == RTL_PASS);
if (execute_one_pass (pass) && pass->sub)
execute_pass_list (pass->sub);
execute_pass_list_1 (pass->sub);
pass = pass->next;
}
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. */
static void
write_lto (void)
@ -2543,7 +2549,8 @@ execute_ipa_pass_list (opt_pass *pass)
if (pass->sub->type == GIMPLE_PASS)
{
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);
invoke_plugin_callbacks (PLUGIN_EARLY_GIMPLE_PASSES_END, NULL);
}

View File

@ -586,7 +586,7 @@ extern gimple_opt_pass *make_pass_convert_switch (gcc::context *ctxt);
extern opt_pass *current_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_summary_passes (ipa_opt_pass_d *);
extern void execute_all_ipa_transforms (void);
@ -614,7 +614,7 @@ extern bool function_called_by_processed_nodes_p (void);
extern bool first_pass_instance;
/* 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 enable_pass (const char *);