[LLVMdev] Structs as first class values.

Chris Lattner clattner at apple.com
Mon Jul 21 23:23:48 PDT 2008


On Jul 21, 2008, at 1:19 PM, David Greene wrote:
> This is not the same on all architectures.  For x86-64, for example,  
> structs
> are returned through the hidden first argument except if they are  
> small
> enough, in which case they are returned in registers.
>
> I'm rather worried about Chris' statements regarding ABI  
> compliance.  This
> is a very important issue for us and I would guess most commercial  
> vendors.
> We absolutely must be able to interoperate with third-party libraries.

David, I'm not sure I follow.  It is, of course, very important for us  
that llvm-gcc generate ABI compliant code on x86-64.  I'm just saying  
that if struct-return does not provide the ABI required for a specific  
source construct that another lowering would be needed.

In the case of X86-64, llvm-gcc does use aggregate return (for the  
interesting cases which return things in registers) and it does do the  
right thing.  However, returning a {i64, i64, i64, i64} by value and  
having it automatically be returned "by pointer" is less interesting,  
as we already have a direct way to handle that (and llvm-gcc already  
produces it).

AFAIK, llvm-gcc/g++ does an *extremely* good job of matching the  
X86-64 ABI on mainline.

-Chris



More information about the llvm-dev mailing list