diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-18 07:46:33 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-18 07:46:33 +0000 |
commit | d471893dcbdfab38ec021b746517d648db7dbb42 (patch) | |
tree | 699c6e9907b0c33f5cd057a408e8a232bd118ec9 /gcc/tree-gimple.c | |
parent | b4a82ea7cc767f1abe921b835ff0324c082a8231 (diff) | |
download | gcc-d471893dcbdfab38ec021b746517d648db7dbb42.tar.gz |
* tree.h (struct tree_decl): Add gimple_formal_temp.
(DECL_GIMPLE_FORMAL_TEMP_P): New.
* gimplify.c (pop_gimplify_context): Clear it.
(lookup_tmp_var): Set it, if is_formal.
(gimplify_init_constructor): Use rhs_predicate_for for COMPLEX.
Use is_gimple_val for VECTOR. Simplify return value.
(gimplify_save_expr): Use and set DECL_GIMPLE_FORMAL_TEMP_P.
(gimplify_expr): Likewise.
* tree-gimple.c (is_gimple_formal_tmp_rhs): Rename from
is_gimple_tmp_rhs for clarity. Update all callers.
(is_gimple_reg_rhs): Simplify logic.
(is_gimple_formal_tmp_var): Rename from is_gimple_tmp_var for
clarity; use DECL_GIMPLE_FORMAL_TEMP_P.
(is_gimple_formal_tmp_reg): Similarly.
* tree-gimple.h: Update decls.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Use
DECL_IGNORED_P, not DECL_ARTIFICIAL. Tidy formatting.
* tree-ssa-live.c (var_union, type_var_init): Likewise.
java/
* java-gimplify.c (java_gimplify_expr): Move '2' handling into
default case. Treat '<' similarly. Update for
is_gimple_formal_tmp_var name change.
testsuite/
* gcc.dg/20040206-1.c: XFAIL.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86176 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-gimple.c')
-rw-r--r-- | gcc/tree-gimple.c | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/gcc/tree-gimple.c b/gcc/tree-gimple.c index e2088935515..cabe5469eba 100644 --- a/gcc/tree-gimple.c +++ b/gcc/tree-gimple.c @@ -195,7 +195,7 @@ static inline bool is_gimple_id (tree); /* Return true if T is a GIMPLE RHS for an assignment to a temporary. */ bool -is_gimple_tmp_rhs (tree t) +is_gimple_formal_tmp_rhs (tree t) { enum tree_code code = TREE_CODE (t); @@ -235,28 +235,27 @@ is_gimple_tmp_rhs (tree t) return is_gimple_lvalue (t) || is_gimple_val (t); } -/* Returns true iff T is a valid RHS for an assignment to a renamed user - variable. */ +/* Returns true iff T is a valid RHS for an assignment to a renamed + user -- or front-end generated artificial -- variable. */ bool is_gimple_reg_rhs (tree t) { - /* If the RHS of the MODIFY_EXPR may throw or make a nonlocal goto and - the LHS is a user variable, then we need to introduce a temporary. - ie temp = RHS; LHS = temp. + /* If the RHS of the MODIFY_EXPR may throw or make a nonlocal goto + and the LHS is a user variable, then we need to introduce a formal + temporary. This way the optimizers can determine that the user + variable is only modified if evaluation of the RHS does not throw. + + Don't force a temp of a non-renamable type; the copy could be + arbitrarily expensive. Instead we will generate a V_MAY_DEF for + the assignment. */ - This way the optimizers can determine that the user variable is - only modified if evaluation of the RHS does not throw. */ if (is_gimple_reg_type (TREE_TYPE (t)) - && TREE_SIDE_EFFECTS (t) - && (TREE_CODE (t) == CALL_EXPR - || (flag_non_call_exceptions && tree_could_trap_p (t)))) - return is_gimple_val (t); - else - /* Don't force a temp of a non-renamable type; the copy could be - arbitrarily expensive. Instead we will generate a V_MAY_DEF for - the assignment. */ - return is_gimple_tmp_rhs (t); + && ((TREE_CODE (t) == CALL_EXPR && TREE_SIDE_EFFECTS (t)) + || tree_could_throw_p (t))) + return false; + + return is_gimple_formal_tmp_rhs (t); } /* Returns true iff T is a valid RHS for an assignment to an un-renamed @@ -270,7 +269,7 @@ is_gimple_mem_rhs (tree t) if (is_gimple_reg_type (TREE_TYPE (t))) return is_gimple_val (t); else - return is_gimple_tmp_rhs (t); + return is_gimple_formal_tmp_rhs (t); } /* Returns the appropriate RHS predicate for this LHS. */ @@ -278,8 +277,8 @@ is_gimple_mem_rhs (tree t) gimple_predicate rhs_predicate_for (tree lhs) { - if (is_gimple_tmp_var (lhs)) - return is_gimple_tmp_rhs; + if (is_gimple_formal_tmp_var (lhs)) + return is_gimple_formal_tmp_rhs; else if (is_gimple_reg (lhs)) return is_gimple_reg_rhs; else @@ -444,20 +443,18 @@ is_gimple_reg (tree t) && ! needs_to_live_in_memory (t)); } -/* Returns true if T is a GIMPLE temporary variable, false otherwise. */ +/* Returns true if T is a GIMPLE formal temporary variable. */ bool -is_gimple_tmp_var (tree t) +is_gimple_formal_tmp_var (tree t) { - /* FIXME this could trigger for other local artificials, too. */ - return (TREE_CODE (t) == VAR_DECL && DECL_ARTIFICIAL (t) - && !TREE_STATIC (t) && !DECL_EXTERNAL (t)); + return TREE_CODE (t) == VAR_DECL && DECL_GIMPLE_FORMAL_TEMP_P (t); } -/* Returns true if T is a GIMPLE temporary register variable. */ +/* Returns true if T is a GIMPLE formal temporary register variable. */ bool -is_gimple_tmp_reg (tree t) +is_gimple_formal_tmp_reg (tree t) { /* The intent of this is to get hold of a value that won't change. An SSA_NAME qualifies no matter if its of a user variable or not. */ @@ -465,7 +462,7 @@ is_gimple_tmp_reg (tree t) return true; /* We don't know the lifetime characteristics of user variables. */ - if (TREE_CODE (t) != VAR_DECL || !DECL_ARTIFICIAL (t)) + if (!is_gimple_formal_tmp_var (t)) return false; /* Finally, it must be capable of being placed in a register. */ |