OSDN Git Service

gcc/
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa-alias.c
index 121f645..1607c71 100644 (file)
@@ -1162,6 +1162,7 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
       struct alias_map_d *p_map = ai->pointers[i];
       tree tag = var_ann (p_map->var)->symbol_mem_tag;
       var_ann_t tag_ann = var_ann (tag);
+      tree var;
 
       /* Call-clobbering information is not finalized yet at this point.  */
       if (PTR_IS_REF_ALL (p_map->var))
@@ -1170,11 +1171,15 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
       p_map->total_alias_vops = 0;
       p_map->may_aliases = BITMAP_ALLOC (&alias_obstack);
 
+      /* Add any pre-existing may_aliases to the bitmap used to represent
+        TAG's alias set in case we need to group aliases.  */
+      for (j = 0; VEC_iterate (tree, tag_ann->may_aliases, j, var); ++j)
+       bitmap_set_bit (p_map->may_aliases, DECL_UID (var));
+
       for (j = 0; j < ai->num_addressable_vars; j++)
        {
          struct alias_map_d *v_map;
          var_ann_t v_ann;
-         tree var;
          bool tag_stored_p, var_stored_p;
          
          v_map = ai->addressable_vars[j];
@@ -2687,93 +2692,6 @@ is_aliased_with (tree tag, tree sym)
 }
 
 
-/* Add VAR to the list of may-aliases of PTR's symbol tag.  If PTR
-   doesn't already have a symbol tag, create one.  */
-
-void
-add_type_alias (tree ptr, tree var)
-{
-  VEC(tree, gc) *aliases;
-  tree tag, al;
-  var_ann_t ann = var_ann (ptr);
-  subvar_t svars;
-  VEC (tree, heap) *varvec = NULL;  
-  unsigned i;
-
-  if (ann->symbol_mem_tag == NULL_TREE)
-    {
-      tree q = NULL_TREE;
-      tree tag_type = TREE_TYPE (TREE_TYPE (ptr));
-      HOST_WIDE_INT tag_set = get_alias_set (tag_type);
-      safe_referenced_var_iterator rvi;
-
-      /* PTR doesn't have a symbol tag, create a new one and add VAR to
-        the new tag's alias set.
-
-        FIXME, This is slower than necessary.  We need to determine
-        whether there is another pointer Q with the same alias set as
-        PTR.  This could be sped up by having symbol tags associated
-        with types.  */
-      FOR_EACH_REFERENCED_VAR_SAFE (q, varvec, rvi)
-       {
-         if (POINTER_TYPE_P (TREE_TYPE (q))
-             && tag_set == get_alias_set (TREE_TYPE (TREE_TYPE (q))))
-           {
-             /* Found another pointer Q with the same alias set as
-                the PTR's pointed-to type.  If Q has a symbol tag, use
-                it.  Otherwise, create a new memory tag for PTR.  */
-             var_ann_t ann1 = var_ann (q);
-             if (ann1->symbol_mem_tag)
-               ann->symbol_mem_tag = ann1->symbol_mem_tag;
-             else
-               ann->symbol_mem_tag = create_memory_tag (tag_type, true);
-             goto found_tag;
-           }
-       }
-
-      /* Couldn't find any other pointer with a symbol tag we could use.
-        Create a new memory tag for PTR.  */
-      ann->symbol_mem_tag = create_memory_tag (tag_type, true);
-    }
-
-found_tag:
-  /* If VAR is not already PTR's symbol tag, add it to the may-alias set
-     for PTR's symbol tag.  */
-  gcc_assert (!MTAG_P (var));
-  tag = ann->symbol_mem_tag;
-
-  /* If VAR has subvars, add the subvars to the tag instead of the
-     actual var.  */
-  if (var_can_have_subvars (var)
-      && (svars = get_subvars_for_var (var)))
-    {
-      subvar_t sv;      
-      for (sv = svars; sv; sv = sv->next)
-       add_may_alias (tag, sv->var);
-    }
-  else
-    add_may_alias (tag, var);
-
-  /* TAG and its set of aliases need to be marked for renaming.  */
-  mark_sym_for_renaming (tag);
-  if ((aliases = var_ann (tag)->may_aliases) != NULL)
-    {
-      for (i = 0; VEC_iterate (tree, aliases, i, al); i++)
-       mark_sym_for_renaming (al);
-    }
-
-  /* If we had grouped aliases, VAR may have aliases of its own.  Mark
-     them for renaming as well.  Other statements referencing the
-     aliases of VAR will need to be updated.  */
-  if ((aliases = var_ann (var)->may_aliases) != NULL)
-    {
-      for (i = 0; VEC_iterate (tree, aliases, i, al); i++)
-       mark_sym_for_renaming (al);
-    }
-  VEC_free (tree, heap, varvec);
-}
-
-
 /* Create a new symbol tag for PTR.  Construct the may-alias list of this type
    tag so that it has the aliasing of VAR.