aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2012-04-27 11:58:20 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2012-04-27 11:58:20 +0000
commit209be5530933e20eee6b7d7141c11a535f0461e2 (patch)
tree414ccb0957bfcd13bd3b6838959bdaa52d3ef9c4 /gcc/tree-ssa-alias.c
parentc813039daf28641024012fda1497960147923757 (diff)
downloadgcc-209be5530933e20eee6b7d7141c11a535f0461e2.zip
gcc-209be5530933e20eee6b7d7141c11a535f0461e2.tar.gz
gcc-209be5530933e20eee6b7d7141c11a535f0461e2.tar.bz2
tree-flow.h (is_hidden_global_store): Remove.
2012-04-27 Richard Guenther <rguenther@suse.de> * tree-flow.h (is_hidden_global_store): Remove. * tree-ssa-sink.c (is_hidden_global_store): Likewise. * tree-ssa-alias.h (ref_may_alias_global_p): Declare. (stmt_may_clobber_global_p): Likewise. * tree-ssa-alias.c (ref_may_alias_global_p): New function. (stmt_may_clobber_global_p): Likewise. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Call stmt_may_clobber_global_p. * tree-ssa-dse.c (dse_possible_dead_store_p): Likewise. From-SVN: r186903
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 4a859eb..ec1bbbe 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -328,6 +328,52 @@ ptr_deref_may_alias_ref_p_1 (tree ptr, ao_ref *ref)
return true;
}
+/* Return true whether REF may refer to global memory. */
+
+bool
+ref_may_alias_global_p (tree ref)
+{
+ tree base = get_base_address (ref);
+ if (DECL_P (base))
+ return is_global_var (base);
+ else if (TREE_CODE (base) == MEM_REF
+ || TREE_CODE (base) == TARGET_MEM_REF)
+ return ptr_deref_may_alias_global_p (TREE_OPERAND (base, 0));
+ return true;
+}
+
+/* Return true whether STMT may clobber global memory. */
+
+bool
+stmt_may_clobber_global_p (gimple stmt)
+{
+ tree lhs;
+
+ if (!gimple_vdef (stmt))
+ return false;
+
+ /* ??? We can ask the oracle whether an artificial pointer
+ dereference with a pointer with points-to information covering
+ all global memory (what about non-address taken memory?) maybe
+ clobbered by this call. As there is at the moment no convenient
+ way of doing that without generating garbage do some manual
+ checking instead.
+ ??? We could make a NULL ao_ref argument to the various
+ predicates special, meaning any global memory. */
+
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_ASSIGN:
+ lhs = gimple_assign_lhs (stmt);
+ return (TREE_CODE (lhs) != SSA_NAME
+ && ref_may_alias_global_p (lhs));
+ case GIMPLE_CALL:
+ return true;
+ default:
+ return true;
+ }
+}
+
/* Dump alias information on FILE. */