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]

Re: PATCH: 64-bit Darwin ABI change for structs passed by value


> The bad news is that the testsuite shows some problems with
> handling structs by value in varargs cases still, and it seems
> that it will need some generic changes. In particular, rs6000
> code returns null rtxes as parallels to indicate the need to
> push as well as pass in registers, but the generic code is not
> prepared to deal with, say, an eight-way parallel that includes
> four nulls within the parallel.

My understanding is that this is not a valid PARALLEL, only the first element 
can be null according to the manual.  So it's not surprising the middle-end 
is not prepared to handle this.

> No doubt more will turn up, since it seems no other ABI does quite the same 
> thing.

SPARC 64-bit for about a decade. :-)  For example config/sparc/sparc.c:5579:

  /* If at least one field must be passed on the stack, generate
     (parallel [(expr_list (nil) ...) ...]) so that all fields will
     also be passed on the stack.  We can't do much better because the
     semantics of FUNCTION_ARG_PARTIAL_NREGS doesn't handle the case
     of structures for which the fields passed exclusively in registers
     are not at the beginning of the structure.  */
  if (parms.stack)
    XVECEXP (parms.ret, 0, 0)
      = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx);

> So the purpose of this posting is to solicit comments on the
> strategy (despite the s-to-s analogy, backend seems less
> disruptive than doing this with gimple hacking, for instance),
> and to give people a heads-up - I'm sure this patch has a
> hundred things wrong with it. :-) 

I think that enhancing the middle-end to fully support mixed structures would 
be nice.

-- 
Eric Botcazou


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