aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cp-gimplify.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/cp-gimplify.c')
-rw-r--r--gcc/cp/cp-gimplify.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 6545392..154fa70 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -638,6 +638,22 @@ lvalue_has_side_effects (tree e)
return TREE_SIDE_EFFECTS (e);
}
+/* Gimplify *EXPR_P as rvalue into an expression that can't be modified
+ by expressions with side-effects in other operands. */
+
+static enum gimplify_status
+gimplify_to_rvalue (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
+ bool (*gimple_test_f) (tree))
+{
+ enum gimplify_status t
+ = gimplify_expr (expr_p, pre_p, post_p, gimple_test_f, fb_rvalue);
+ if (t == GS_ERROR)
+ return GS_ERROR;
+ else if (is_gimple_variable (*expr_p) && TREE_CODE (*expr_p) != SSA_NAME)
+ *expr_p = get_initialized_tmp_var (*expr_p, pre_p, NULL);
+ return t;
+}
+
/* Do C++-specific gimplification. Args are as for gimplify_expr. */
int
@@ -823,15 +839,10 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
&& cp_get_callee_fndecl_nofold (*expr_p) == NULL_TREE)
{
enum gimplify_status t
- = gimplify_expr (&CALL_EXPR_FN (*expr_p), pre_p, NULL,
- is_gimple_call_addr, fb_rvalue);
+ = gimplify_to_rvalue (&CALL_EXPR_FN (*expr_p), pre_p, NULL,
+ is_gimple_call_addr);
if (t == GS_ERROR)
ret = GS_ERROR;
- else if (is_gimple_variable (CALL_EXPR_FN (*expr_p))
- && TREE_CODE (CALL_EXPR_FN (*expr_p)) != SSA_NAME)
- CALL_EXPR_FN (*expr_p)
- = get_initialized_tmp_var (CALL_EXPR_FN (*expr_p), pre_p,
- NULL);
}
if (!CALL_EXPR_FN (*expr_p))
/* Internal function call. */;