diff options
author | Richard Henderson <rth@redhat.com> | 2004-08-18 00:46:33 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2004-08-18 00:46:33 -0700 |
commit | 17ad5b5ec26d9c6d7edc84c89d69931552d138ff (patch) | |
tree | 699c6e9907b0c33f5cd057a408e8a232bd118ec9 /gcc/gimplify.c | |
parent | 5b0eba617b824ab3442bee5fc4f7c7d40d112aa6 (diff) | |
download | gcc-17ad5b5ec26d9c6d7edc84c89d69931552d138ff.zip gcc-17ad5b5ec26d9c6d7edc84c89d69931552d138ff.tar.gz gcc-17ad5b5ec26d9c6d7edc84c89d69931552d138ff.tar.bz2 |
tree.h (struct tree_decl): Add gimple_formal_temp.
* 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.
From-SVN: r86176
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 60 |
1 files changed, 36 insertions, 24 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 21d8f45..21328e6 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -128,9 +128,14 @@ push_gimplify_context (void) void pop_gimplify_context (tree body) { + tree t; + if (!gimplify_ctxp || gimplify_ctxp->current_bind_expr) abort (); + for (t = gimplify_ctxp->temps; t ; t = TREE_CHAIN (t)) + DECL_GIMPLE_FORMAL_TEMP_P (t) = 0; + if (body) declare_tmp_vars (gimplify_ctxp->temps, body); else @@ -402,8 +407,10 @@ create_tmp_from_val (tree val) static tree lookup_tmp_var (tree val, bool is_formal) { + tree ret; + if (!is_formal || TREE_SIDE_EFFECTS (val)) - return create_tmp_from_val (val); + ret = create_tmp_from_val (val); else { elt_t elt, *elt_p; @@ -415,15 +422,20 @@ lookup_tmp_var (tree val, bool is_formal) { elt_p = xmalloc (sizeof (*elt_p)); elt_p->val = val; - elt_p->temp = create_tmp_from_val (val); - TREE_READONLY (elt_p->temp) = 1; + elt_p->temp = ret = create_tmp_from_val (val); *slot = (void *) elt_p; } else - elt_p = (elt_t *) *slot; - - return elt_p->temp; + { + elt_p = (elt_t *) *slot; + ret = elt_p->temp; + } } + + if (is_formal) + DECL_GIMPLE_FORMAL_TEMP_P (ret) = 1; + + return ret; } /* Returns a formal temporary variable initialized with VAL. PRE_P is as @@ -444,7 +456,7 @@ internal_get_tmp_var (tree val, tree *pre_p, tree *post_p, bool is_formal) tree t, mod; char class; - gimplify_expr (&val, pre_p, post_p, is_gimple_tmp_rhs, fb_rvalue); + gimplify_expr (&val, pre_p, post_p, is_gimple_formal_tmp_rhs, fb_rvalue); t = lookup_tmp_var (val, is_formal); @@ -1571,7 +1583,7 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p, { TREE_OPERAND (t, 2) = low; tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p, post_p, - is_gimple_tmp_reg, fb_rvalue); + is_gimple_formal_tmp_reg, fb_rvalue); ret = MIN (ret, tret); } } @@ -1590,7 +1602,7 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p, { TREE_OPERAND (t, 3) = elmt_size; tret = gimplify_expr (&TREE_OPERAND (t, 3), pre_p, post_p, - is_gimple_tmp_reg, fb_rvalue); + is_gimple_formal_tmp_reg, fb_rvalue); ret = MIN (ret, tret); } } @@ -1612,7 +1624,7 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p, { TREE_OPERAND (t, 2) = offset; tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p, post_p, - is_gimple_tmp_reg, fb_rvalue); + is_gimple_formal_tmp_reg, fb_rvalue); ret = MIN (ret, tret); } } @@ -1643,7 +1655,7 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p, if (!is_gimple_min_invariant (TREE_OPERAND (t, 1))) { tret = gimplify_expr (&TREE_OPERAND (t, 1), pre_p, post_p, - is_gimple_tmp_reg, fb_rvalue); + is_gimple_formal_tmp_reg, fb_rvalue); ret = MIN (ret, tret); } } @@ -2744,7 +2756,8 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p, ctor = build (COMPLEX_EXPR, type, r, i); TREE_OPERAND (*expr_p, 1) = ctor; ret = gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, post_p, - is_gimple_tmp_rhs, fb_rvalue); + rhs_predicate_for (TREE_OPERAND (*expr_p, 0)), + fb_rvalue); } } break; @@ -2761,7 +2774,7 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p, { enum gimplify_status tret; tret = gimplify_expr (&TREE_VALUE (elt_list), pre_p, post_p, - is_gimple_constructor_elt, fb_rvalue); + is_gimple_val, fb_rvalue); if (tret == GS_ERROR) ret = GS_ERROR; } @@ -2932,19 +2945,14 @@ gimplify_modify_expr (tree *expr_p, tree *pre_p, tree *post_p, bool want_value) } } - /* If the destination is already simple, nothing else needed. */ - if (is_gimple_tmp_var (*to_p) || !want_value) - ret = GS_ALL_DONE; - else - ret = GS_OK; - if (want_value) { append_to_statement_list (*expr_p, pre_p); *expr_p = *to_p; + return GS_OK; } - return ret; + return GS_ALL_DONE; } /* Gimplify a comparison between two variable-sized objects. Do this @@ -3090,7 +3098,7 @@ gimplify_save_expr (tree *expr_p, tree *pre_p, tree *post_p) /* If the operand is already a GIMPLE temporary, just re-write the SAVE_EXPR node. */ - if (is_gimple_tmp_var (val)) + if (TREE_CODE (val) == VAR_DECL && DECL_GIMPLE_FORMAL_TEMP_P (val)) *expr_p = val; /* The operand may be a void-valued expression such as SAVE_EXPRs generated by the Java frontend for class initialization. It is @@ -3103,8 +3111,11 @@ gimplify_save_expr (tree *expr_p, tree *pre_p, tree *post_p) *expr_p = NULL; } else - *expr_p = TREE_OPERAND (*expr_p, 0) - = get_initialized_tmp_var (val, pre_p, post_p); + { + val = get_initialized_tmp_var (val, pre_p, post_p); + DECL_GIMPLE_FORMAL_TEMP_P (val) = 1; + *expr_p = TREE_OPERAND (*expr_p, 0) = val; + } return ret; } @@ -4095,7 +4106,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, gimplify_expr (&tmp, pre_p, post_p, is_gimple_reg, fb_rvalue); *expr_p = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (tmp)), tmp); } - else if ((fallback & fb_rvalue) && is_gimple_tmp_rhs (*expr_p)) + else if ((fallback & fb_rvalue) && is_gimple_formal_tmp_rhs (*expr_p)) { #if defined ENABLE_CHECKING if (VOID_TYPE_P (TREE_TYPE (*expr_p))) @@ -4112,6 +4123,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, *expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p); else *expr_p = get_formal_tmp_var (*expr_p, pre_p); + DECL_GIMPLE_FORMAL_TEMP_P (*expr_p) = 1; } else if (fallback & fb_mayfail) { |