[llvm-commits] [PATCH] Bug in APCS

Chris Lattner clattner at apple.com
Tue Oct 12 12:31:43 PDT 2010


On Oct 12, 2010, at 12:28 PM, Eric Christopher wrote:

> 
> On Oct 12, 2010, at 12:14 PM, Tanya Lattner wrote:
> 
>> 
>> Hello,
>> 
>> I discovered a bug in APCS when returning a vector of size 3 and type double. It hits llvm_unreachable because it runs out of registers to use when attempting to return the double3 via the calling convention APCS. 
>> 
>> Attached is a patch with my suggested changes and a test case. I'd appreciate a review of this patch.
> 
> Since it's greater than 128-bits I think the abi says to pass it by reference and return in memory?
> 
> ...
> A 128-bit containerized vector is returned in r0-r3.
> ...
> A Composite Type larger than 4 bytes, or whose size cannot be determined statically by both caller and callee, is stored in memory at an address passed as an extra argument when the function was called (ยง5.5, rule A.4).

Typically that would be handled by the frontend, not in the code generator.  If a <3 x double> makes it into LLVM IR, the code generator can do whatever it wants.  Similar things happen on X86 etc.

-Chris



More information about the llvm-commits mailing list