From: Jason Merrill Date: Sat, 7 Aug 2004 20:47:48 +0000 (-0400) Subject: revert: gimplify.c (gimplify_call_expr): Make return in memory explicit. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9ee7a5c06ac3c1de0f90aad7f36a1a75fafb42d3;p=gcc.git revert: gimplify.c (gimplify_call_expr): Make return in memory explicit. Revert: * gimplify.c (gimplify_call_expr): Make return in memory explicit. (gimplify_modify_expr_rhs): Likewise. From-SVN: r85676 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5cea2153d21..db17d3e15a5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -29,8 +29,6 @@ Don't dereference a RESULT_DECL directly inside a RETURN_EXPR. (cp_genericize): Handle the RESULT_DECL. Unset TREE_ADDRESSABLE. - * gimplify.c (gimplify_call_expr): Make return in memory explicit. - (gimplify_modify_expr_rhs): Likewise. * c-common.c (c_warn_unused_result): Check TREE_USED before warning about a CALL_EXPR with an unused value. diff --git a/gcc/gimplify.c b/gcc/gimplify.c index c6478ec40f5..3675c8a942f 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1808,7 +1808,6 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value) tree decl; tree arglist; enum gimplify_status ret; - tree slot; #if defined ENABLE_CHECKING if (TREE_CODE (*expr_p) != CALL_EXPR) @@ -1871,19 +1870,6 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value) ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, NULL, is_gimple_call_addr, fb_rvalue); - /* Make the return slot explicit if it isn't already. */ - if (aggregate_value_p (*expr_p, decl) - && !CALL_EXPR_HAS_RETURN_SLOT_ADDR (*expr_p)) - { - slot = create_tmp_var (TREE_TYPE (*expr_p), NULL); - arglist = build_fold_addr_expr (slot); - arglist = tree_cons (NULL_TREE, arglist, TREE_OPERAND (*expr_p, 1)); - TREE_OPERAND (*expr_p, 1) = arglist; - CALL_EXPR_HAS_RETURN_SLOT_ADDR (*expr_p) = 1; - } - else - slot = NULL_TREE; - if (PUSH_ARGS_REVERSED) TREE_OPERAND (*expr_p, 1) = nreverse (TREE_OPERAND (*expr_p, 1)); for (arglist = TREE_OPERAND (*expr_p, 1); arglist; @@ -1921,22 +1907,6 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value) && (call_expr_flags (*expr_p) & (ECF_CONST | ECF_PURE))) TREE_SIDE_EFFECTS (*expr_p) = 0; - /* If we have a return slot, use it in the containing expression. */ - if (want_value && CALL_EXPR_HAS_RETURN_SLOT_ADDR (*expr_p)) - { - /* Don't warn about an unused return value. */ - TREE_USED (*expr_p) = 1; - - if (slot == NULL_TREE) - { - slot = TREE_OPERAND (*expr_p, 1); - slot = TREE_VALUE (slot); - slot = build_fold_indirect_ref (slot); - } - append_to_statement_list (*expr_p, pre_p); - *expr_p = slot; - } - return ret; } @@ -2739,39 +2709,6 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, tree *pre_p, ret = GS_UNHANDLED; break; - case CALL_EXPR: - /* Transform 'a = f();' to 'f(&a), a' if f returns in memory. */ - if (aggregate_value_p (*from_p, *from_p)) - { - tree arg; - if (CALL_EXPR_HAS_RETURN_SLOT_ADDR (*from_p)) - abort (); - - ret = gimplify_expr (to_p, pre_p, post_p, is_gimple_lvalue, - fb_lvalue); - if (ret == GS_ERROR) - return ret; - - arg = build_fold_addr_expr (*to_p); - arg = tree_cons (NULL_TREE, arg, TREE_OPERAND (*from_p, 1)); - TREE_OPERAND (*from_p, 1) = arg; - CALL_EXPR_HAS_RETURN_SLOT_ADDR (*from_p) = 1; - /* Don't warn about an unused return value. */ - TREE_USED (*from_p) = 1; - - if (want_value) - { - gimplify_and_add (*from_p, pre_p); - *expr_p = *to_p; - } - else - *expr_p = *from_p; - return GS_OK; - } - else - ret = GS_UNHANDLED; - break; - default: ret = GS_UNHANDLED; break;