This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Make union-inside-struct args work in 64-bit Darwin


One more step to 64-bit nirvana for Darwin; for arguments that
have unions embedded in structs it's simpler to handle UNION_TYPE
manually in rs6000.c, making a set of regular registers, than to
try to get emit_group_load to know about reg:BLK inside a parallel.
With this, 64-bit libstdc++ builds for the first time with the new
ABI. Also tested with a bootstrap, and committed to trunk.

Function results next...

Stan

* config/rs6000/rs6000.c: (rs6000_darwin64_function_arg): Add UNION_TYPE case.
(function_arg): Move darwin test up, sniff mode first for efficiency, test
for union type.


Index: rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.746
diff -p -r1.746 rs6000.c
*** rs6000.c    18 Nov 2004 22:30:58 -0000      1.746
--- rs6000.c    22 Nov 2004 05:34:50 -0000
*************** rs6000_darwin64_function_arg (CUMULATIVE
*** 5156,5161 ****
--- 5156,5178 ----
         }
       break;

+ case UNION_TYPE:
+ tot = rs6000_arg_size (mode, type);
+ if (tot <= 0)
+ return NULL_RTX;
+ bytepos = 0;
+
+ for (j = 0; j < tot; ++j)
+ {
+ sub = gen_rtx_REG ((TARGET_64BIT ? DImode : SImode), GP_ARG_MIN_REG + cum->words++);
+ roffset = gen_rtx_CONST_INT (SImode, bytepos);
+ rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, sub, roffset);
+ if (cum->words >= GP_ARG_NUM_REG)
+ break;
+ bytepos += (TARGET_64BIT ? 8 : 4);
+ }
+ break;
+
case ARRAY_TYPE:
tot = int_size_in_bytes (type);
if (tot <= 0)
*************** function_arg (CUMULATIVE_ARGS *cum, enum
*** 5319,5324 ****
--- 5336,5353 ----
return GEN_INT (cum->call_cookie);
}


+   if (mode == BLKmode
+       && rs6000_darwin64_abi
+       && (TREE_CODE (type) == RECORD_TYPE
+         || TREE_CODE (type) == UNION_TYPE
+         || TREE_CODE (type) == ARRAY_TYPE))
+     {
+       rtx rslt = rs6000_darwin64_function_arg (cum, mode, type, named);
+       if (rslt != NULL_RTX)
+       return rslt;
+       /* Else fall through to usual handling.  */
+     }
+
   if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, named))
     if (TARGET_64BIT && ! cum->prototype)
       {
*************** function_arg (CUMULATIVE_ARGS *cum, enum
*** 5393,5404 ****
                                         || mode == DCmode))))
     return rs6000_spe_function_arg (cum, mode, type);

-   else if (rs6000_darwin64_abi
-          && mode == BLKmode
-          && (TREE_CODE (type) == RECORD_TYPE
-              || TREE_CODE (type) == ARRAY_TYPE))
-     return rs6000_darwin64_function_arg (cum, mode, type, named);
-
   else if (abi == ABI_V4)
     {
       if (TARGET_HARD_FLOAT && TARGET_FPRS
--- 5422,5427 ----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]