diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-22 21:58:48 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-22 21:58:48 +0000 |
commit | 0c8fe10f97135696161ac53fd73669c25e2cbe57 (patch) | |
tree | 8c78d03d629c9690690dd3a65b9e2d84e426d6dd /gcc/gimplify.c | |
parent | f888a3fbbbd3a36235de36669410e6ea2d485e13 (diff) | |
download | gcc-0c8fe10f97135696161ac53fd73669c25e2cbe57.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86387 138bc75d-0d04-0410-961f-82ee72b054a4
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 3dba42d9b85..3c9ff202dc4 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; } |