[LLVMdev] Structs as first class values.

David Greene dag at cray.com
Mon Jul 21 13:19:16 PDT 2008


On Monday 21 July 2008 08:37, Matthijs Kooijman wrote:

> This pass only operates on internal functions, though, so it does not have
> to deal with ABI issues. If you want to support the C ABI (which requires a
> pointer in the first argument to return any struct AFAIK), you might be
> better off generating such code in your frontend. Any internal function can
> then be simplified by the sretpromotion pass (perhaps it could be modified
> to take an option for the maximum number of elements to put in the real
> return struct?)

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.

Yes, we can implement the functionality ourselves but better that we have
one community-owned implementation than a bunch of private forks.

I'm hoping we can collectively discuss some of this at the dev meeting.

                                             -Dave



More information about the llvm-dev mailing list