OSDN Git Service

2009-11-10 Martin Jambor <mjambor@suse.cz>
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Nov 2009 14:43:20 +0000 (14:43 +0000)
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Nov 2009 14:43:20 +0000 (14:43 +0000)
* tree-pass.h (struct ipa_opt_pass_d): Added stmt_fixup field.
(execute_all_ipa_stmt_fixups): Declare.
* ipa-cp.c (pass_ipa_cp): Added stmt_fixup value.
* ipa-inline.c (pass_ipa_inline): Likewise.
* ipa-pure-const.c (pass_ipa_pure_cons): Likewise.
* ipa-reference.c (pass_ipa_reference): Likewise.
* ipa.c (pass_ipa_whole_program_visibility): Likewise.
* lto-streamer-out.c (pass_ipa_lto_gimple_out): Likewise.
(pass_ipa_lto_finish_out): Likewise.
* lto-wpa-fixup.c (pass_ipa_lto_wpa_fixup): Likewise.
* passes.c (execute_ipa_stmt_fixups): New function.
(execute_all_ipa_stmt_fixups): New function.
* lto-streamer-in.c (input_function): Call execute_all_ipa_stmt_fixups.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154064 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/ipa-cp.c
gcc/ipa-inline.c
gcc/ipa-pure-const.c
gcc/ipa-reference.c
gcc/ipa.c
gcc/lto-streamer-in.c
gcc/lto-streamer-out.c
gcc/lto-wpa-fixup.c
gcc/passes.c
gcc/tree-pass.h

index 20477c4..7bcc946 100644 (file)
@@ -1,3 +1,19 @@
+2009-11-10  Martin Jambor  <mjambor@suse.cz>
+
+       * tree-pass.h (struct ipa_opt_pass_d): Added stmt_fixup field.
+       (execute_all_ipa_stmt_fixups): Declare.
+       * ipa-cp.c (pass_ipa_cp): Added stmt_fixup value.
+       * ipa-inline.c (pass_ipa_inline): Likewise.
+       * ipa-pure-const.c (pass_ipa_pure_cons): Likewise.
+       * ipa-reference.c (pass_ipa_reference): Likewise.
+       * ipa.c (pass_ipa_whole_program_visibility): Likewise.
+       * lto-streamer-out.c (pass_ipa_lto_gimple_out): Likewise.
+       (pass_ipa_lto_finish_out): Likewise.
+       * lto-wpa-fixup.c (pass_ipa_lto_wpa_fixup): Likewise.
+       * passes.c (execute_ipa_stmt_fixups): New function.
+       (execute_all_ipa_stmt_fixups): New function.
+       * lto-streamer-in.c (input_function): Call execute_all_ipa_stmt_fixups.
+
 2009-11-10  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR ada/20548
index 79ff16e..2c3b5b7 100644 (file)
@@ -1327,6 +1327,7 @@ struct ipa_opt_pass_d pass_ipa_cp =
  ipcp_write_summary,                   /* write_summary */
  ipcp_read_summary,                    /* read_summary */
  NULL,                                 /* function_read_summary */
+ NULL,                                 /* stmt_fixup */
  0,                                    /* TODOs */
  NULL,                                 /* function_transform */
  NULL,                                 /* variable_transform */
index bc7048f..08088dd 100644 (file)
@@ -2020,6 +2020,7 @@ struct ipa_opt_pass_d pass_ipa_inline =
  inline_write_summary,                 /* write_summary */
  inline_read_summary,                  /* read_summary */
  NULL,                                 /* function_read_summary */
+ NULL,                                 /* stmt_fixup */
  0,                                    /* TODOs */
  inline_transform,                     /* function_transform */
  NULL,                                 /* variable_transform */
index e37af05..bc03bff 100644 (file)
@@ -1100,6 +1100,7 @@ struct ipa_opt_pass_d pass_ipa_pure_const =
  pure_const_write_summary,             /* write_summary */
  pure_const_read_summary,              /* read_summary */
  NULL,                                 /* function_read_summary */
+ NULL,                                 /* stmt_fixup */
  0,                                    /* TODOs */
  NULL,                                 /* function_transform */
  NULL                                  /* variable_transform */
index 8610f13..074aea6 100644 (file)
@@ -1511,6 +1511,7 @@ struct ipa_opt_pass_d pass_ipa_reference =
  ipa_reference_write_summary,          /* write_summary */
  ipa_reference_read_summary,           /* read_summary */
  NULL,                                 /* function_read_summary */
+ NULL,                                 /* stmt_fixup */
  0,                                    /* TODOs */
  NULL,                                 /* function_transform */
  NULL                                  /* variable_transform */
index c859242..b082efe 100644 (file)
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -425,6 +425,7 @@ struct ipa_opt_pass_d pass_ipa_whole_program_visibility =
  NULL,                                 /* write_summary */
  NULL,                                 /* read_summary */
  NULL,                                 /* function_read_summary */
+ NULL,                                 /* stmt_fixup */
  0,                                    /* TODOs */
  NULL,                                 /* function_transform */
  NULL,                                 /* variable_transform */
index f7c7936..7e1559c 100644 (file)
@@ -1261,6 +1261,7 @@ input_function (tree fn_decl, struct data_in *data_in,
   gimple *stmts;
   basic_block bb;
   struct bitpack_d *bp;
+  struct cgraph_node *node;
 
   fn = DECL_STRUCT_FUNCTION (fn_decl);
   tag = input_record_start (ib);
@@ -1340,7 +1341,9 @@ input_function (tree fn_decl, struct data_in *data_in,
     gimple_set_body (fn_decl, bb_seq (ei_edge (ei)->dest));
   }
 
-  fixup_call_stmt_edges (cgraph_node (fn_decl), stmts);
+  node = cgraph_node (fn_decl);
+  fixup_call_stmt_edges (node, stmts);
+  execute_all_ipa_stmt_fixups (node, stmts);
 
   update_ssa (TODO_update_ssa_only_virtuals); 
   free_dominance_info (CDI_DOMINATORS);
index 1ed1939..fee2372 100644 (file)
@@ -2115,6 +2115,7 @@ struct ipa_opt_pass_d pass_ipa_lto_gimple_out =
  lto_output,                                   /* write_summary */
  NULL,                                 /* read_summary */
  NULL,                                 /* function_read_summary */
+ NULL,                                 /* stmt_fixup */
  0,                                    /* TODOs */
  NULL,                                 /* function_transform */
  NULL                                  /* variable_transform */
@@ -2545,6 +2546,7 @@ struct ipa_opt_pass_d pass_ipa_lto_finish_out =
  produce_asm_for_decls,                        /* write_summary */
  NULL,                                 /* read_summary */
  NULL,                                 /* function_read_summary */
+ NULL,                                 /* stmt_fixup */
  0,                                    /* TODOs */
  NULL,                                 /* function_transform */
  NULL                                  /* variable_transform */
index 4411588..469af5a 100644 (file)
@@ -274,6 +274,7 @@ struct ipa_opt_pass_d pass_ipa_lto_wpa_fixup =
  lto_output_wpa_fixup,                 /* write_summary */
  lto_input_wpa_fixup,                  /* read_summary */
  NULL,                                 /* function_read_summary */
+ NULL,                                 /* stmt_fixup */
  0,                                    /* TODOs */
  NULL,                                 /* function_transform */
  NULL                                  /* variable_transform */
index 1cef349..fb0dd83 100644 (file)
@@ -1755,6 +1755,50 @@ execute_ipa_pass_list (struct opt_pass *pass)
   while (pass);
 }
 
+/* Execute stmt fixup hooks of all passes in PASS for NODE and STMTS.  */
+
+static void
+execute_ipa_stmt_fixups (struct opt_pass *pass,
+                         struct cgraph_node *node, gimple *stmts)
+{
+  while (pass)
+    {
+      /* Execute all of the IPA_PASSes in the list.  */
+      if (pass->type == IPA_PASS
+         && (!pass->gate || pass->gate ()))
+       {
+         struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *) pass;
+
+         if (ipa_pass->stmt_fixup)
+           {
+             pass_init_dump_file (pass);
+             /* If a timevar is present, start it.  */
+             if (pass->tv_id)
+               timevar_push (pass->tv_id);
+
+             ipa_pass->stmt_fixup (node, stmts);
+
+             /* Stop timevar.  */
+             if (pass->tv_id)
+               timevar_pop (pass->tv_id);
+             pass_fini_dump_file (pass);
+           }
+         if (pass->sub)
+           execute_ipa_stmt_fixups (pass->sub, node, stmts);
+       }
+      pass = pass->next;
+    }
+}
+
+/* Execute stmt fixup hooks of all IPA passes for NODE and STMTS.  */
+
+void
+execute_all_ipa_stmt_fixups (struct cgraph_node *node, gimple *stmts)
+{
+  execute_ipa_stmt_fixups (all_regular_ipa_passes, node, stmts);
+}
+
+
 extern void debug_properties (unsigned int);
 extern void dump_properties (FILE *, unsigned int);
 
index e8d6fae..bff027b 100644 (file)
@@ -185,7 +185,10 @@ struct ipa_opt_pass_d
      as needed so both calls are necessary.  */
   void (*read_summary) (void);
   void (*function_read_summary) (struct cgraph_node *);
-  
+  /* Hook to convert gimple stmt uids into true gimple statements.  The second
+     parameter is an array of statements indexed by their uid. */
+  void (*stmt_fixup) (struct cgraph_node *, gimple *);
+
   /* Results of interprocedural propagation of an IPA pass is applied to
      function body via this hook.  */
   unsigned int function_transform_todo_flags_start;
@@ -566,6 +569,7 @@ extern void execute_pass_list (struct opt_pass *);
 extern void execute_ipa_pass_list (struct opt_pass *);
 extern void execute_ipa_summary_passes (struct ipa_opt_pass_d *);
 extern void execute_all_ipa_transforms (void);
+extern void execute_all_ipa_stmt_fixups (struct cgraph_node *, gimple *);
 
 extern void print_current_pass (FILE *);
 extern void debug_pass (void);