OSDN Git Service

* tree-sra.c (all_callers_have_enough_arguments_p): Rename to ...
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Jun 2011 12:53:48 +0000 (12:53 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Jun 2011 12:53:48 +0000 (12:53 +0000)
(not_all_callers_have_enough_arguments_p): ... this one; turn into
worker for cgraph_for_node_and_aliases.
(convert_callers_for_node): Break out from ...
(convert_callers): ... here.
(modify_function): Use collect_callers_of_node.
(ipa_early_sra): Use cgraph_for_node_and_aliases.

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

gcc/ChangeLog
gcc/tree-sra.c

index 29a87a3..14cc6d8 100644 (file)
@@ -1,3 +1,13 @@
+2011-06-10  Jan Hubicka  <jh@suse.cz>
+
+       * tree-sra.c (all_callers_have_enough_arguments_p): Rename to ...
+       (not_all_callers_have_enough_arguments_p): ... this one; turn into
+       worker for cgraph_for_node_and_aliases.
+       (convert_callers_for_node): Break out from ...
+       (convert_callers): ... here.
+       (modify_function): Use collect_callers_of_node.
+       (ipa_early_sra): Use cgraph_for_node_and_aliases.
+
 2011-06-10  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/49361
index 47d4471..8ad84be 100644 (file)
@@ -4304,31 +4304,30 @@ sra_ipa_reset_debug_stmts (ipa_parm_adjustment_vec adjustments)
     }
 }
 
-/* Return true iff all callers have at least as many actual arguments as there
+/* Return false iff all callers have at least as many actual arguments as there
    are formal parameters in the current function.  */
 
 static bool
-all_callers_have_enough_arguments_p (struct cgraph_node *node)
+not_all_callers_have_enough_arguments_p (struct cgraph_node *node,
+                                        void *data ATTRIBUTE_UNUSED)
 {
   struct cgraph_edge *cs;
   for (cs = node->callers; cs; cs = cs->next_caller)
     if (!callsite_has_enough_arguments_p (cs->call_stmt))
-      return false;
+      return true;
 
-  return true;
+  return false;
 }
 
+/* Convert all callers of NODE.  */
 
-/* Convert all callers of NODE to pass parameters as given in ADJUSTMENTS.  */
-
-static void
-convert_callers (struct cgraph_node *node, tree old_decl,
-                ipa_parm_adjustment_vec adjustments)
+static bool
+convert_callers_for_node (struct cgraph_node *node,
+                         void *data)
 {
-  tree old_cur_fndecl = current_function_decl;
-  struct cgraph_edge *cs;
-  basic_block this_block;
+  ipa_parm_adjustment_vec adjustments = (ipa_parm_adjustment_vec)data;
   bitmap recomputed_callers = BITMAP_ALLOC (NULL);
+  struct cgraph_edge *cs;
 
   for (cs = node->callers; cs; cs = cs->next_caller)
     {
@@ -4352,6 +4351,21 @@ convert_callers (struct cgraph_node *node, tree old_decl,
       compute_inline_parameters (cs->caller, true);
   BITMAP_FREE (recomputed_callers);
 
+  return true;
+}
+
+/* Convert all callers of NODE to pass parameters as given in ADJUSTMENTS.  */
+
+static void
+convert_callers (struct cgraph_node *node, tree old_decl,
+                ipa_parm_adjustment_vec adjustments)
+{
+  tree old_cur_fndecl = current_function_decl;
+  basic_block this_block;
+
+  cgraph_for_node_and_aliases (node, convert_callers_for_node,
+                              adjustments, false);
+
   current_function_decl = old_cur_fndecl;
 
   if (!encountered_recursive_call)
@@ -4388,17 +4402,8 @@ static bool
 modify_function (struct cgraph_node *node, ipa_parm_adjustment_vec adjustments)
 {
   struct cgraph_node *new_node;
-  struct cgraph_edge *cs;
   bool cfg_changed;
-  VEC (cgraph_edge_p, heap) * redirect_callers;
-  int node_callers;
-
-  node_callers = 0;
-  for (cs = node->callers; cs != NULL; cs = cs->next_caller)
-    node_callers++;
-  redirect_callers = VEC_alloc (cgraph_edge_p, heap, node_callers);
-  for (cs = node->callers; cs != NULL; cs = cs->next_caller)
-    VEC_quick_push (cgraph_edge_p, redirect_callers, cs);
+  VEC (cgraph_edge_p, heap) * redirect_callers = collect_callers_of_node (node);
 
   rebuild_cgraph_edges ();
   pop_cfun ();
@@ -4503,7 +4508,8 @@ ipa_early_sra (void)
       goto simple_out;
     }
 
-  if (!all_callers_have_enough_arguments_p (node))
+  if (cgraph_for_node_and_aliases (node, not_all_callers_have_enough_arguments_p,
+                                  NULL, true))
     {
       if (dump_file)
        fprintf (dump_file, "There are callers with insufficient number of "