This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Allow passmanager to switch between IPA and local passes
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, rth at redhat dot com
- Date: Sun, 5 Jun 2005 12:21:08 +0200
- Subject: [PATCH] Allow passmanager to switch between IPA and local passes
Hi,
for early inlining I need to run the local optimization passes as part
of IPA passes queue. While this can be done by new entry point to the
passmanager and IPA pass executing it for each function, it seems
prettier to be able to register local passes as part of the whole queue
(this might allow us to eventually get rid of tree_rest_of_compilation
too as the tree_rest_of_compilation and rest_of_compilation can just
be last pass of the overall pass queue so we will move more control to
passmanager rather doing it in the cgraphunit driver).
I am not quite sure what the API for this should be. This patch takes
the easy route of simply assuming that subpasses of IPA pass are local.
Does this sound resonable or are there better idea? (perhaps pass
should have flag whether it is IPA or not, but the properties flag don't
seem to match this use very well as they are cummulated at construction
time)
Bootstrapped/regtested i686-pc-gnu-linux.
Honza
2005-06-05 Jan Hubicka <jh@suse.cz>
* tree-optimize.c (execute_pass_list): Execute subpasses of the
IPA pass once per each function.
(ipa_passes): NULLify cfun.
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 2.104
diff -c -3 -p -r2.104 tree-optimize.c
*** tree-optimize.c 3 Jun 2005 02:11:04 -0000 2.104
--- tree-optimize.c 5 Jun 2005 10:15:59 -0000
*************** execute_pass_list (struct tree_opt_pass
*** 659,665 ****
do
{
if (execute_one_pass (pass) && pass->sub)
! execute_pass_list (pass->sub);
pass = pass->next;
}
while (pass);
--- 713,739 ----
do
{
if (execute_one_pass (pass) && pass->sub)
! {
! if (cfun)
! execute_pass_list (pass->sub);
! else
! {
! struct cgraph_node *node;
! tree_register_cfg_hooks ();
! for (node = cgraph_nodes; node; node = node->next)
! if (node->analyzed)
! {
! push_cfun (DECL_STRUCT_FUNCTION (node->decl));
! current_function_decl = node->decl;
! execute_pass_list (pass->sub);
! free_dominance_info (CDI_DOMINATORS);
! free_dominance_info (CDI_POST_DOMINATORS);
! current_function_decl = NULL;
! pop_cfun ();
! ggc_collect ();
! }
! }
! }
pass = pass->next;
}
while (pass);
*************** tree_lowering_passes (tree fn)
*** 686,691 ****
--- 760,766 ----
void
ipa_passes (void)
{
+ cfun = NULL;
bitmap_obstack_initialize (NULL);
execute_pass_list (all_ipa_passes);
bitmap_obstack_release (NULL);