[LLVMdev] First-class aggregate semantics

David Greene dag at cray.com
Fri Jan 8 16:02:30 PST 2010

On Thursday 07 January 2010 20:52, Jon Harrop wrote:

> Good question. There was a very interesting discussion about this here a
> while ago and everyone coming to LLVM says the same thing: why doesn't LLVM
> just handle this for me automatically? The answer is that LLVM cannot make
> that decision because it depends upon the ABI. C99 apparently returns
> user-defined structs of two doubles by reference but complex numbers in
> registers. So the ABI requires knowledge of the front-end and, therefore,
> LLVM cannot fully automate this.

It's not a C99 thing, but an ABI thing.

And for the x86-64 ABI, complex double and a struct of two doubles is
returned in exactly the same way.  That may not be true for other ABIs.
I'm not as familiar with them.

On some targets it certainly should be possible to do the right thing.


More information about the llvm-dev mailing list