Commit 7f5e6307 by Richard Henderson Committed by Richard Henderson

tree.h (SAVE_EXPR_RESOLVED_P): New.

        * tree.h (SAVE_EXPR_RESOLVED_P): New.
        * gimplify.c (gimplify_save_expr): Use it.
        * expr.c (expand_expr_real_1): Likewise.  Also set DECL_IGNORED_P
        on the temporary variable.

From-SVN: r86387
parent f8d0aee5
2004-08-22 Richard Hendersion <rth@redhat.com>
* tree.h (SAVE_EXPR_RESOLVED_P): New.
* gimplify.c (gimplify_save_expr): Use it.
* expr.c (expand_expr_real_1): Likewise. Also set DECL_IGNORED_P
on the temporary variable.
2004-08-22 Andrew Pinski <pinskia@physics.uc.edu> 2004-08-22 Andrew Pinski <pinskia@physics.uc.edu>
* fold-const.c (rtl_expr_nonnegative_p): Delete. * fold-const.c (rtl_expr_nonnegative_p): Delete.
......
...@@ -6497,7 +6497,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, ...@@ -6497,7 +6497,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
tree val = TREE_OPERAND (exp, 0); tree val = TREE_OPERAND (exp, 0);
rtx ret = expand_expr_real_1 (val, target, tmode, modifier, alt_rtl); rtx ret = expand_expr_real_1 (val, target, tmode, modifier, alt_rtl);
if (TREE_CODE (val) != VAR_DECL || !DECL_ARTIFICIAL (val)) if (!SAVE_EXPR_RESOLVED_P (exp))
{ {
/* We can indeed still hit this case, typically via builtin /* We can indeed still hit this case, typically via builtin
expanders calling save_expr immediately before expanding expanders calling save_expr immediately before expanding
...@@ -6508,7 +6508,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, ...@@ -6508,7 +6508,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
val = build_decl (VAR_DECL, NULL, TREE_TYPE (exp)); val = build_decl (VAR_DECL, NULL, TREE_TYPE (exp));
DECL_ARTIFICIAL (val) = 1; DECL_ARTIFICIAL (val) = 1;
DECL_IGNORED_P (val) = 1;
TREE_OPERAND (exp, 0) = val; TREE_OPERAND (exp, 0) = val;
SAVE_EXPR_RESOLVED_P (exp) = 1;
if (!CONSTANT_P (ret)) if (!CONSTANT_P (ret))
ret = copy_to_reg (ret); ret = copy_to_reg (ret);
......
...@@ -3068,27 +3068,28 @@ gimplify_save_expr (tree *expr_p, tree *pre_p, tree *post_p) ...@@ -3068,27 +3068,28 @@ gimplify_save_expr (tree *expr_p, tree *pre_p, tree *post_p)
val = TREE_OPERAND (*expr_p, 0); val = TREE_OPERAND (*expr_p, 0);
/* If the operand is already a GIMPLE temporary, just re-write the /* If the SAVE_EXPR has not been resolved, then evaluate it once. */
SAVE_EXPR node. */ if (!SAVE_EXPR_RESOLVED_P (*expr_p))
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
being executed only for its side-effects. */
else if (TREE_TYPE (val) == void_type_node)
{ {
tree body = TREE_OPERAND (*expr_p, 0); /* The operand may be a void-valued expression such as SAVE_EXPRs
ret = gimplify_expr (& body, pre_p, post_p, is_gimple_stmt, fb_none); generated by the Java frontend for class initialization. It is
append_to_statement_list (body, pre_p); being executed only for its side-effects. */
*expr_p = NULL; if (TREE_TYPE (val) == void_type_node)
} {
else ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
{ is_gimple_stmt, fb_none);
val = get_initialized_tmp_var (val, pre_p, post_p); append_to_statement_list (TREE_OPERAND (*expr_p, 0), pre_p);
DECL_GIMPLE_FORMAL_TEMP_P (val) = 1; val = NULL;
*expr_p = TREE_OPERAND (*expr_p, 0) = val; }
else
val = get_initialized_tmp_var (val, pre_p, post_p);
TREE_OPERAND (*expr_p, 0) = val;
SAVE_EXPR_RESOLVED_P (*expr_p) = 1;
} }
*expr_p = val;
return ret; return ret;
} }
......
...@@ -232,6 +232,8 @@ struct tree_common GTY(()) ...@@ -232,6 +232,8 @@ struct tree_common GTY(())
ASM_EXPR ASM_EXPR
TYPE_CACHED_VALUES_P in TYPE_CACHED_VALUES_P in
..._TYPE ..._TYPE
SAVE_EXPR_RESOLVED_P in
SAVE_EXPR
private_flag: private_flag:
...@@ -788,6 +790,11 @@ extern void tree_operand_check_failed (int, enum tree_code, ...@@ -788,6 +790,11 @@ extern void tree_operand_check_failed (int, enum tree_code,
of cached values, or is something else. */ of cached values, or is something else. */
#define TYPE_CACHED_VALUES_P(NODE) (TYPE_CHECK(NODE)->common.public_flag) #define TYPE_CACHED_VALUES_P(NODE) (TYPE_CHECK(NODE)->common.public_flag)
/* In a SAVE_EXPR, indicates that the original expression has already
been substituted with a VAR_DECL that contains the value. */
#define SAVE_EXPR_RESOLVED_P(NODE) \
(TREE_CHECK (NODE, SAVE_EXPR)->common.public_flag)
/* In any expression, decl, or constant, nonzero means it has side effects or /* In any expression, decl, or constant, nonzero means it has side effects or
reevaluation of the whole expression could produce a different value. reevaluation of the whole expression could produce a different value.
This is set if any subexpression is a function call, a side effect or a This is set if any subexpression is a function call, a side effect or a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment