diff options
author | Richard Guenther <rguenther@suse.de> | 2009-06-16 14:12:44 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-06-16 14:12:44 +0000 |
commit | 2e4078422e64a42224ca69daa70604885698a942 (patch) | |
tree | 7cde33eea870313f90b60f30132fd44837a55153 | |
parent | f2ff88729a86a0db86cc6a6ea98d3d5ebfeaa231 (diff) | |
download | gcc-2e4078422e64a42224ca69daa70604885698a942.zip gcc-2e4078422e64a42224ca69daa70604885698a942.tar.gz gcc-2e4078422e64a42224ca69daa70604885698a942.tar.bz2 |
tree-ssa-alias.c (is_escape_site): Remove.
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
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/tree-ssa-alias.c | 76 | ||||
-rw-r--r-- | gcc/tree-ssa-alias.h | 21 | ||||
-rw-r--r-- | gcc/tree-ssa-structalias.c | 14 |
4 files changed, 14 insertions, 105 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bbf4e60..ab1db07 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 0b8c251..6cbec5d 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -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. */ diff --git a/gcc/tree-ssa-alias.h b/gcc/tree-ssa-alias.h index 115d393..9115e61 100644 --- a/gcc/tree-ssa-alias.h +++ b/gcc/tree-ssa-alias.h @@ -24,26 +24,6 @@ #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); diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 62a1e43..f60b24c 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -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; |