aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-07-23 15:37:23 -0700
committerRichard Henderson <rth@gcc.gnu.org>2004-07-23 15:37:23 -0700
commitab8907ef75b71c987932a299bddf04cb73907c69 (patch)
tree6fa3fcbf916c4e6bd0c3081ee4de2cf5ae950925 /gcc/tree-ssa-alias.c
parent5aa33bdb4f75939b9467a4580aa13bb6997f192c (diff)
downloadgcc-ab8907ef75b71c987932a299bddf04cb73907c69.zip
gcc-ab8907ef75b71c987932a299bddf04cb73907c69.tar.gz
gcc-ab8907ef75b71c987932a299bddf04cb73907c69.tar.bz2
expr.c (expand_expr_real_1): Don't handle non-local variables.
* expr.c (expand_expr_real_1): Don't handle non-local variables. * expr.h (fix_lexical_addr): Remove. * function.c (NEED_SEPARATE_AP): Remove. (fix_lexical_addr): Remove. * tree-alias-common.c (get_alias_var_decl): Check TREE_STATIC, not null decl_function_context. (create_alias_vars): Likewise. * tree-cfg.c (make_ctrl_stmt_edges): Don't check for non-local labels. (simple_goto_p): Likewise. * tree-dfa.c (add_referenced_var): Don't check for non-local variables. * tree-ssa-ccp.c (get_default_value): Likewise. * tree-tailcall.c (suitable_for_tail_opt_p): Likewise. * tree.c (needs_to_live_in_memory): Likewise. * tree-flow-inline.h (may_be_aliased): Move... * tree-ssa-alias.c (may_be_aliased): ... here. Enhance check for when TREE_STATIC variables may be addressable. From-SVN: r85099
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index bf11fe2..a854b0b 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -2473,3 +2473,34 @@ debug_may_aliases_for (tree var)
{
dump_may_aliases_for (stderr, var);
}
+
+/* Return true if VAR may be aliased. */
+
+bool
+may_be_aliased (tree var)
+{
+ /* Obviously. */
+ if (TREE_ADDRESSABLE (var))
+ return true;
+
+ /* Automatic variables can't have their addresses escape any other way. */
+ if (!TREE_STATIC (var))
+ return false;
+
+ /* Globally visible variables can have their addresses taken by other
+ translation units. */
+ if (DECL_EXTERNAL (var) || TREE_PUBLIC (var))
+ return true;
+
+ /* If we're in unit-at-a-time mode, then we must have seen all occurrences
+ of address-of operators, and so we can trust TREE_ADDRESSABLE. Otherwise
+ we can only be sure the variable isn't addressable if it's local to the
+ current function. */
+ if (flag_unit_at_a_time)
+ return false;
+ if (decl_function_context (var) == current_function_decl)
+ return false;
+
+ return true;
+}
+