[PATCH] X86 ABI fix for return values > 24 bytes.

Quentin Colombet qcolombet at apple.com
Wed Feb 4 17:44:19 PST 2015


Hi Andy,

I have one question regarding this comment:

+  // Checking Function.hasStructRetAttr() here is insufficient because the IR
+  // may not have an explicit sret argument. If FuncInfo.CanLowerReturn is
+  // false, then an sret argument may be implicitly inserted in the SelDAG.

When this is set implicitly, how do we know that the caller will have allocated the right among of space to return the structure?

I am not saying your patch is wrong on the contrary, I just wonder how that works because if we made that mistake in the callee, I believe we may have done something silly in the caller too.

Thanks,
-Quentin

> On Feb 4, 2015, at 10:11 AM, Andrew Trick <atrick at apple.com> wrote:
> 
> The return value's address must be returned in %rax.
> i.e. the callee needs to copy the sret argument (%rdi)
> into the return value (%rax).
> 
> This probably won't manifest as a bug when the caller is LLVM-compiled
> code. But it is an ABI guarantee and tools expect it.
> 
> -Andy
> 
> <0001-X86-ABI-fix-for-return-values-24-bytes.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list