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
This commit is contained in:
parent
f8d0aee5c1
commit
7f5e63076a
@ -1,3 +1,10 @@
|
||||
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>
|
||||
|
||||
* fold-const.c (rtl_expr_nonnegative_p): Delete.
|
||||
|
@ -6497,7 +6497,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
|
||||
tree val = TREE_OPERAND (exp, 0);
|
||||
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
|
||||
expanders calling save_expr immediately before expanding
|
||||
@ -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));
|
||||
DECL_ARTIFICIAL (val) = 1;
|
||||
DECL_IGNORED_P (val) = 1;
|
||||
TREE_OPERAND (exp, 0) = val;
|
||||
SAVE_EXPR_RESOLVED_P (exp) = 1;
|
||||
|
||||
if (!CONSTANT_P (ret))
|
||||
ret = copy_to_reg (ret);
|
||||
|
@ -3068,27 +3068,28 @@ gimplify_save_expr (tree *expr_p, tree *pre_p, tree *post_p)
|
||||
|
||||
val = TREE_OPERAND (*expr_p, 0);
|
||||
|
||||
/* If the operand is already a GIMPLE temporary, just re-write the
|
||||
SAVE_EXPR node. */
|
||||
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)
|
||||
/* If the SAVE_EXPR has not been resolved, then evaluate it once. */
|
||||
if (!SAVE_EXPR_RESOLVED_P (*expr_p))
|
||||
{
|
||||
tree body = TREE_OPERAND (*expr_p, 0);
|
||||
ret = gimplify_expr (& body, pre_p, post_p, is_gimple_stmt, fb_none);
|
||||
append_to_statement_list (body, pre_p);
|
||||
*expr_p = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
/* 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. */
|
||||
if (TREE_TYPE (val) == void_type_node)
|
||||
{
|
||||
ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
|
||||
is_gimple_stmt, fb_none);
|
||||
append_to_statement_list (TREE_OPERAND (*expr_p, 0), pre_p);
|
||||
val = NULL;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -232,6 +232,8 @@ struct tree_common GTY(())
|
||||
ASM_EXPR
|
||||
TYPE_CACHED_VALUES_P in
|
||||
..._TYPE
|
||||
SAVE_EXPR_RESOLVED_P in
|
||||
SAVE_EXPR
|
||||
|
||||
private_flag:
|
||||
|
||||
@ -788,6 +790,11 @@ extern void tree_operand_check_failed (int, enum tree_code,
|
||||
of cached values, or is something else. */
|
||||
#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
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user