This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[lto][patch] Create a execute_regular_ipa_pass_list function


With a dedicated function for running regular ipa passes, we no longer
need the summaries_generated trick and it is much easier to understand
what is going on.

2008-10-08 Rafael Espindola  <espindola@google.com>

	* cgraphunit.c (ipa_passes): Use execute_regular_ipa_pass_list.
	* passes.c (execute_ipa_pass_list): Don't run
	execute_ipa_summary_passes.
	(execute_regular_ipa_pass_list): New.

Cheers,
-- 
Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index ce10799..b5153ac 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1248,7 +1248,7 @@ ipa_passes (void)
   gimple_register_cfg_hooks ();
   bitmap_obstack_initialize (NULL);
   execute_ipa_pass_list (all_ipa_passes);
-  execute_ipa_pass_list (all_regular_ipa_passes);
+  execute_regular_ipa_pass_list (all_regular_ipa_passes);
   bitmap_obstack_release (NULL);
 }
 
diff --git a/gcc/passes.c b/gcc/passes.c
index 2768c93..292519c 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -1443,23 +1443,11 @@ ipa_read_summaries (void)
 void
 execute_ipa_pass_list (struct opt_pass *pass)
 {
-  bool summaries_generated = false;
   do
     {
       gcc_assert (!current_function_decl);
       gcc_assert (!cfun);
       gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
-      if (pass->type == IPA_PASS && (!pass->gate || pass->gate ()))
-	{
-	  if (!summaries_generated)
-	    {
-	      if (!quiet_flag && !cfun)
-		fprintf (stderr, " <summary generate>");
-	      execute_ipa_summary_passes ((struct ipa_opt_pass *) pass);
-              ipa_write_summaries ();
-	    }
-	  summaries_generated = true;
-	}
       if (execute_one_pass (pass) && pass->sub)
 	{
 	  if (pass->sub->type == GIMPLE_PASS)
@@ -1471,13 +1459,26 @@ execute_ipa_pass_list (struct opt_pass *pass)
 	  else
 	    gcc_unreachable ();
 	}
-      if (!current_function_decl)
-	cgraph_process_new_functions ();
+      gcc_assert (!current_function_decl);
+      cgraph_process_new_functions ();
       pass = pass->next;
     }
   while (pass);
 }
 
+/* Same as execute_pass_list but assume that subpasses of IPA passes
+   are local passes.  */
+void
+execute_regular_ipa_pass_list (struct opt_pass *pass)
+{
+  if (!quiet_flag && !cfun)
+    fprintf (stderr, " <summary generate>");
+  execute_ipa_summary_passes ((struct ipa_opt_pass *) pass);
+  ipa_write_summaries ();
+
+  execute_ipa_pass_list (pass);
+}
+
 extern void debug_properties (unsigned int);
 extern void dump_properties (FILE *, unsigned int);
 
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index fbc3d6b..63247e5 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -531,6 +531,7 @@ extern struct opt_pass *current_pass;
 extern struct opt_pass * get_pass_for_id (int);
 extern void execute_pass_list (struct opt_pass *);
 extern void execute_ipa_pass_list (struct opt_pass *);
+extern void execute_regular_ipa_pass_list (struct opt_pass *);
 extern void print_current_pass (FILE *);
 extern void debug_pass (void);
 extern void ipa_write_summaries (void);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]