cgraph.c: Include ipa-utils.h
authorJan Hubicka <jh@suse.cz>
Tue, 11 May 2010 08:12:07 +0000 (10:12 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 11 May 2010 08:12:07 +0000 (08:12 +0000)
* cgraph.c: Include ipa-utils.h
(cgraph_create_virtual_clone): Update references.
* Makefile.in (cgraph.o): Add dependency at ipa-utils.h

From-SVN: r159258

gcc/ChangeLog
gcc/Makefile.in
gcc/cgraph.c

index 4ade883db3adaa13c3c0d87aba1da1326e0720a2..3727c6b0a858297f706c07686beb51e416ec72b2 100644 (file)
@@ -1,3 +1,9 @@
+2010-05-11  Jan Hubicka  <jh@suse.cz>
+
+       * cgraph.c: Include ipa-utils.h
+       (cgraph_create_virtual_clone): Update references.
+       * Makefile.in (cgraph.o): Add dependency at ipa-utils.h
+
 2010-05-11  Christian Borntraeger  <borntraeger@de.ibm.com>
 
         * tree-ssa-loop-prefetch.c (prune_ref_by_group_reuse): Reset
index d919261f59a957902ecaf07a1c00887685365f25..1e6749a47bcd29b231899217d6d364a95d267493 100644 (file)
@@ -2883,7 +2883,7 @@ cgraph.o : cgraph.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
    langhooks.h $(TOPLEV_H) $(FLAGS_H) $(GGC_H) $(TARGET_H) $(CGRAPH_H) \
    gt-cgraph.h output.h intl.h $(BASIC_BLOCK_H) debug.h $(HASHTAB_H) \
    $(TREE_INLINE_H) $(TREE_DUMP_H) $(TREE_FLOW_H) cif-code.def \
-   value-prof.h $(EXCEPT_H)
+   value-prof.h $(EXCEPT_H) $(IPA_UTILS_H)
 cgraphunit.o : cgraphunit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(TREE_H) langhooks.h $(TREE_INLINE_H) $(TOPLEV_H) $(FLAGS_H) $(GGC_H) \
    $(TARGET_H) $(CGRAPH_H) intl.h pointer-set.h $(FUNCTION_H) $(GIMPLE_H) \
index 64a9c6559ccba7b8ceda0dbc6f063c1c8d1cb8d9..5f609aaf4341f732b0772bf373a3e2822fd3951d 100644 (file)
@@ -96,6 +96,7 @@ The callgraph:
 #include "except.h"
 #include "diagnostic.h"
 #include "rtl.h"
+#include "ipa-utils.h"
 
 static void cgraph_node_remove_callers (struct cgraph_node *node);
 static inline void cgraph_edge_remove_caller (struct cgraph_edge *e);
@@ -2139,6 +2140,8 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
   struct cgraph_node *new_node = NULL;
   tree new_decl;
   struct cgraph_node key, **slot;
+  size_t i;
+  struct ipa_replace_map *map;
 
   gcc_assert  (tree_versionable_function_p (old_decl));
 
@@ -2170,6 +2173,26 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
   DECL_WEAK (new_node->decl) = 0;
   new_node->clone.tree_map = tree_map;
   new_node->clone.args_to_skip = args_to_skip;
+  for (i = 0; VEC_iterate (ipa_replace_map_p, tree_map, i, map); i++)
+    {
+      tree var = map->new_tree;
+
+      STRIP_NOPS (var);
+      if (TREE_CODE (var) != ADDR_EXPR)
+       continue;
+      var = get_base_var (var);
+      if (!var)
+       continue;
+
+      /* Record references of the future statement initializing the constant
+        argument.  */
+      if (TREE_CODE (var) == FUNCTION_DECL)
+       ipa_record_reference (new_node, NULL, cgraph_node (var),
+                             NULL, IPA_REF_ADDR, NULL);
+      else if (TREE_CODE (var) == VAR_DECL)
+       ipa_record_reference (new_node, NULL, NULL, varpool_node (var),
+                             IPA_REF_ADDR, NULL);
+    }
   if (!args_to_skip)
     new_node->clone.combined_args_to_skip = old_node->clone.combined_args_to_skip;
   else if (old_node->clone.combined_args_to_skip)