calls.c (expand_call): Handle CALL_EXPR_HAS_RETURN_SLOT_ADDR with special struct...
authorJason Merrill <jason@redhat.com>
Tue, 17 Dec 2002 21:29:29 +0000 (16:29 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 17 Dec 2002 21:29:29 +0000 (16:29 -0500)
        * calls.c (expand_call): Handle CALL_EXPR_HAS_RETURN_SLOT_ADDR
        with special struct-return ABIs.

cp/
        * semantics.c (simplify_aggr_init_exprs_r): Don't change the type
        of the CALL_EXPR.

From-SVN: r60223

gcc/calls.c
gcc/cp/ChangeLog
gcc/cp/semantics.c

index 4d6cdd7..09398e8 100644 (file)
@@ -2248,8 +2248,20 @@ expand_call (exp, target, ignore)
        struct_value_size = int_size_in_bytes (TREE_TYPE (exp));
 
        if (CALL_EXPR_HAS_RETURN_SLOT_ADDR (exp))
-         /* The structure value address arg is already in actparms.  */
-         structure_value_addr_parm = 1;
+         {
+           /* The structure value address arg is already in actparms.  */
+           if (struct_value_rtx == 0)
+             /* We want to pass it as a normal argument, so leave it.  */
+             structure_value_addr_parm = 1;
+           else
+             {
+               /* We want to pass it in a special location.  */
+               tree return_arg = TREE_VALUE (actparms);
+               actparms = TREE_CHAIN (actparms);
+               structure_value_addr = expand_expr (return_arg, struct_value_rtx,
+                                                   VOIDmode, EXPAND_NORMAL);
+             }
+         }
        else if (target && GET_CODE (target) == MEM)
          structure_value_addr = XEXP (target, 0);
        else
index a1b5038..1e50ff9 100644 (file)
@@ -1,5 +1,8 @@
 2002-12-16  Jason Merrill  <jason@redhat.com>
 
+       * semantics.c (simplify_aggr_init_exprs_r): Don't change the type
+       of the CALL_EXPR.
+
        * semantics.c (do_pushlevel): Call pushlevel after adding the
        SCOPE_STMT.
        (do_poplevel): Call poplevel before adding the SCOPE_STMT.
index 763916a..e402a72 100644 (file)
@@ -2250,14 +2250,9 @@ simplify_aggr_init_exprs_r (tp, walk_subtrees, data)
   TREE_SIDE_EFFECTS (call_expr) = 1;
 
   if (style == arg)
-    {
-      /* Tell the backend that we've added our return slot to the argument
-        list.  */
-      CALL_EXPR_HAS_RETURN_SLOT_ADDR (call_expr) = 1;
-      /* And don't let anyone use the value of the call directly in a
-        larger expression.  */
-      TREE_TYPE (call_expr) = void_type_node;
-    }
+    /* Tell the backend that we've added our return slot to the argument
+       list.  */
+    CALL_EXPR_HAS_RETURN_SLOT_ADDR (call_expr) = 1;
   else if (style == pcc)
     {
       /* If we're using the non-reentrant PCC calling convention, then we