[LLVMdev] Aggregate returns possibly failing across JIT boundaries

Garrison Venn gvenn.cfe.dev at gmail.com
Thu Jul 28 04:14:49 PDT 2011

Using in memory IR, I believe I'm seeing aggregate returns fail when either 
a generated function calls an external function (not generated), which returns 
an aggregate, or when an external non-generated function calls a generated 
one which returns an aggregate. Is this a known issue?

Specifically when using a "non-generated" structure with two unsigned char, or two 
unsigned fields, the second field is always set to zero on the retrieving side when 
such an instance is returned by value to a generated calling function. The same 
happens for a "generated" structure composed of two llvm::IntegerType::get(context, 8) 
fields when returned to a non-generated function,. I have not used other aggregate 
types or sizes, and am on OS X 64bit. When the appropriate functions, are on the 
same side of JIT boundary (generated calling generated, and obviously non-generated 
calling non-generated), the aggregate return works correctly.

If this is not a known issue, I will further elaborate with code later. As I switched to using
aggregate returning generated functions for generated callees, I have forward progress
on my current project albeit with some extra coding effort. ;-)

Also can someone point me to the source where such a two member structure is lowered
into two registers by the JIT when this structure is used in a return by value scenario?

Thanks in advance


More information about the llvm-dev mailing list