]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-ssa-alias.c (is_escape_site): Remove.
authorRichard Guenther <rguenther@suse.de>
Tue, 16 Jun 2009 14:12:44 +0000 (14:12 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 16 Jun 2009 14:12:44 +0000 (14:12 +0000)
2009-06-16  Richard Guenther  <rguenther@suse.de>

* tree-ssa-alias.c (is_escape_site): Remove.
* tree-ssa-alias.h (enum escape_type): Remove.
(is_escape_site): Likewise.
* tree-ssa-structalias.c (find_func_aliases): Handle escapes
via casts and asms without deferring to is_escape_site.

From-SVN: r148534

gcc/ChangeLog
gcc/tree-ssa-alias.c
gcc/tree-ssa-alias.h
gcc/tree-ssa-structalias.c

index bbf4e60feb8dfca658edd97c9412078a127ca7a8..ab1db07bc94a222d9fc974521e8173f33b33a56d 100644 (file)
@@ -1,3 +1,11 @@
+2009-06-16  Richard Guenther  <rguenther@suse.de>
+
+       * tree-ssa-alias.c (is_escape_site): Remove.
+       * tree-ssa-alias.h (enum escape_type): Remove.
+       (is_escape_site): Likewise.
+       * tree-ssa-structalias.c (find_func_aliases): Handle escapes
+       via casts and asms without deferring to is_escape_site.
+
 2009-06-16  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/40446
index 0b8c2515fee28b0a00b2c51a1190d38d1f8772ae..6cbec5de2bf5a2a01e9bff50f7ed30650313096c 100644 (file)
@@ -232,82 +232,6 @@ ptr_derefs_may_alias_p (tree ptr1, tree ptr2)
   return pt_solutions_intersect (&pi1->pt, &pi2->pt);
 }
 
-/* Return true if STMT is an "escape" site from the current function.  Escape
-   sites those statements which might expose the address of a variable
-   outside the current function.  STMT is an escape site iff:
-
-       1- STMT is a function call, or
-       2- STMT is an __asm__ expression, or
-       3- STMT is an assignment to a non-local variable, or
-       4- STMT is a return statement.
-
-   Return the type of escape site found, if we found one, or NO_ESCAPE
-   if none.  */
-
-enum escape_type
-is_escape_site (gimple stmt)
-{
-  if (is_gimple_call (stmt))
-    {
-      if (gimple_call_flags (stmt) & (ECF_PURE | ECF_CONST))
-       return ESCAPE_TO_PURE_CONST;
-
-      return ESCAPE_TO_CALL;
-    }
-  else if (gimple_code (stmt) == GIMPLE_ASM)
-    return ESCAPE_TO_ASM;
-  else if (is_gimple_assign (stmt))
-    {
-      tree lhs = gimple_assign_lhs (stmt);
-
-      /* Get to the base of _REF nodes.  */
-      if (TREE_CODE (lhs) != SSA_NAME)
-       lhs = get_base_address (lhs);
-
-      /* If we couldn't recognize the LHS of the assignment, assume that it
-        is a non-local store.  */
-      if (lhs == NULL_TREE)
-       return ESCAPE_UNKNOWN;
-
-      if (gimple_assign_cast_p (stmt))
-       {
-         tree from = TREE_TYPE (gimple_assign_rhs1 (stmt));
-         tree to = TREE_TYPE (lhs);
-
-         /* If the RHS is a conversion between a pointer and an integer, the
-            pointer escapes since we can't track the integer.  */
-         if (POINTER_TYPE_P (from) && !POINTER_TYPE_P (to))
-           return ESCAPE_BAD_CAST;
-       }
-
-      /* If the LHS is an SSA name, it can't possibly represent a non-local
-        memory store.  */
-      if (TREE_CODE (lhs) == SSA_NAME)
-       return NO_ESCAPE;
-
-      /* If the LHS is a non-global decl, it isn't a non-local memory store.
-        If the LHS escapes, the RHS escape is dealt with in the PTA solver.  */
-      if (DECL_P (lhs)
-         && !is_global_var (lhs))
-       return NO_ESCAPE;
-
-      /* FIXME: LHS is not an SSA_NAME.  Even if it's an assignment to a
-        local variables we cannot be sure if it will escape, because we
-        don't have information about objects not in SSA form.  Need to
-        implement something along the lines of
-
-        J.-D. Choi, M. Gupta, M. J. Serrano, V. C. Sreedhar, and S. P.
-        Midkiff, ``Escape analysis for java,'' in Proceedings of the
-        Conference on Object-Oriented Programming Systems, Languages, and
-        Applications (OOPSLA), pp. 1-19, 1999.  */
-      return ESCAPE_STORED_IN_GLOBAL;
-    }
-  else if (gimple_code (stmt) == GIMPLE_RETURN)
-    return ESCAPE_TO_RETURN;
-
-  return NO_ESCAPE;
-}
-
 
 /* Dump alias information on FILE.  */
 
index 115d393551212f33ce7d4a4639337ead63c6d669..9115e61c22c376d2921231d25d7357bdb743988b 100644 (file)
 #include "coretypes.h"
 
 
-/* The reasons a variable may escape a function.  */
-enum escape_type 
-{
-  NO_ESCAPE = 0,                       /* Doesn't escape.  */
-  ESCAPE_STORED_IN_GLOBAL = 1 << 0,
-  ESCAPE_TO_ASM = 1 << 1,              /* Passed by address to an assembly
-                                          statement.  */
-  ESCAPE_TO_CALL = 1 << 2,             /* Escapes to a function call.  */
-  ESCAPE_BAD_CAST = 1 << 3,            /* Cast from pointer to integer */
-  ESCAPE_TO_RETURN = 1 << 4,           /* Returned from function.  */
-  ESCAPE_TO_PURE_CONST = 1 << 5,       /* Escapes to a pure or constant
-                                          function call.  */
-  ESCAPE_IS_GLOBAL = 1 << 6,           /* Is a global variable.  */
-  ESCAPE_IS_PARM = 1 << 7,             /* Is an incoming function argument.  */
-  ESCAPE_UNKNOWN = 1 << 8              /* We believe it escapes for
-                                          some reason not enumerated
-                                          above.  */
-};
-
-
 /* The points-to solution.
 
    The points-to solution is a union of pt_vars and the abstract
@@ -107,7 +87,6 @@ typedef struct ao_ref_s
 extern void ao_ref_init (ao_ref *, tree);
 extern tree ao_ref_base (ao_ref *);
 extern alias_set_type ao_ref_alias_set (ao_ref *);
-extern enum escape_type is_escape_site (gimple);
 extern bool ptr_deref_may_alias_global_p (tree);
 extern bool refs_may_alias_p (tree, tree);
 extern bool refs_anti_dependent_p (tree, tree);
index 62a1e43309eecea79a35a8abc4bdec8770ca7c6f..f60b24c9c521dcf4a39d3346190d42075d0e73b0 100644 (file)
@@ -3561,7 +3561,6 @@ find_func_aliases (gimple origt)
   VEC(ce_s, heap) *lhsc = NULL;
   VEC(ce_s, heap) *rhsc = NULL;
   struct constraint_expr *c;
-  enum escape_type stmt_escape_type;
 
   /* Now build constraints expressions.  */
   if (gimple_code (t) == GIMPLE_PHI)
@@ -3759,16 +3758,15 @@ find_func_aliases (gimple origt)
          && is_global_var (lhsop))
        make_escape_constraint (rhsop);
     }
-
-  stmt_escape_type = is_escape_site (t);
-  if (stmt_escape_type == ESCAPE_BAD_CAST)
+  /* For conversions of pointers to non-pointers the pointer escapes.  */
+  else if (gimple_assign_cast_p (t)
+          && POINTER_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (t)))
+          && !POINTER_TYPE_P (TREE_TYPE (gimple_assign_lhs (t))))
     {
-      gcc_assert (is_gimple_assign (t));
-      gcc_assert (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (t))
-                 || gimple_assign_rhs_code (t) == VIEW_CONVERT_EXPR);
       make_escape_constraint (gimple_assign_rhs1 (t));
     }
-  else if (stmt_escape_type == ESCAPE_TO_ASM)
+  /* Handle asms conservatively by adding escape constraints to everything.  */
+  else if (gimple_code (t) == GIMPLE_ASM)
     {
       unsigned i, noutputs;
       const char **oconstraints;