[LLVMdev] Pass and return of large objects

Duncan Sands baldrick at free.fr
Tue Mar 2 01:13:53 PST 2010


Hi Russell,

> No, I'm just trying for correctness -- most of the time, only small
> objects will be passed by value, for obvious efficiency reasons. If it
> turns out the limit is the same as for integers, for example, i.e. the
> size of two pointers, then I can say, OK, that's the threshold, and
> anything bigger than that gets explicitly implemented as sret.

if you want correct ABI conformance, then (sadly) the front-end has to do
the lowering itself.  For example, even on platforms for which the code
generators can handle returning arbitrarily large values from a function,
the way in which it returns them may not be how the ABI says they should
be returned.  If you don't want correct ABI conformance, then you can do
whatever you like.  For example, there is no need to use the sret attribute,
you can just pass the pointer - the sret attribute only exists to get ABI
conformance on some platforms.

Ciao,

Duncan.



More information about the llvm-dev mailing list