diff options
author | Richard Henderson <rth@redhat.com> | 2004-08-22 14:58:48 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2004-08-22 14:58:48 -0700 |
commit | 7f5e63076a3e596e2dd88825f0fe2659c20a5e84 (patch) | |
tree | 8c78d03d629c9690690dd3a65b9e2d84e426d6dd /gcc/gimplify.c | |
parent | f8d0aee5c105df1c5d073a9a91fb467cd603f600 (diff) | |
download | gcc-7f5e63076a3e596e2dd88825f0fe2659c20a5e84.zip gcc-7f5e63076a3e596e2dd88825f0fe2659c20a5e84.tar.gz gcc-7f5e63076a3e596e2dd88825f0fe2659c20a5e84.tar.bz2 |
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
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 3dba42d..3c9ff20 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -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; } |