On May 12, 2011, at 12:30 AM, Sandeep Patel wrote:> On Wed, May 11, 2011 at 11:42 PM, Stuart Hastings <stuart at apple.com> wrote: >> >> On May 9, 2011, at 1:41 PM, Renato Golin wrote: >> >> [snip] >> >>> One example is the struct byval. The ARM back-end still doesn't >>> support struct byval (maybe now it does, I was away for a while), >> >> The ARM backend now supports struct byval for APCS. Extending it to support AAPCS shouldn't be too difficult. Alas, I won't have time to revisit this in the near future. > > It's slightly unclear to me what byval means for an ABI that passes > some structs in registers, such as AAPCS-VFP.IIUC, the byval attribute on a pointer to a structure means "this struct should really be passed by value." If you ignore the byval attribute, the IR mis-represents what the developer wrote. The target ISel is supposed to notice the byval attribute and replace the pointer argument with a copy of the structure in the generated code. I'm not familiar with AAPCS-VFP, but I'd assume that any byval struct should be passed by value, as if byval didn't exist. The ABI should not be aware that byval is in use. stuart
On 12 May 2011 15:43, Stuart Hastings <stuart at apple.com> wrote:> I'm not familiar with AAPCS-VFP, but I'd assume that any byval struct should be passed by value, as if byval didn't exist.Not if the argument(s) fits into the specified registers. There's where the ABI comes in. In a nutshell, the AAPCS-VFP extends the AAPCS to include cases where the arguments are floating point, either literals or small vectors, when they fit in VFP registers. This is similar to the AAPCS extending the base standard regarding standard registers. cheers, --renato
On May 12, 2011, at 9:22 AM, Renato Golin wrote:> On 12 May 2011 15:43, Stuart Hastings <stuart at apple.com> wrote: >> I'm not familiar with AAPCS-VFP, but I'd assume that any byval struct should be passed by value, as if byval didn't exist. > > Not if the argument(s) fits into the specified registers. There's > where the ABI comes in. > > In a nutshell, the AAPCS-VFP extends the AAPCS to include cases where > the arguments are floating point, either literals or small vectors, > when they fit in VFP registers. This is similar to the AAPCS extending > the base standard regarding standard registers.O.K. I guess I wasn't clear. When I said "by value" above, I meant "by value, whether in memory or registers". stuart