[LLVMdev] PSA: Perfectly forwarding thunks can now be expressed in LLVM IR with musttail and varargs

David Chisnall David.Chisnall at cl.cam.ac.uk
Thu Oct 9 11:10:03 PDT 2014


On 9 Oct 2014, at 19:02, Reid Kleckner <rnk at google.com> wrote:

> As an aside, the Windows x64 calling convention has an interesting solution to this problem. They require the caller to allocate stack space for all the register parameters that might be passed. If it turns out that the callee is variadic, it can simply spill the register parameters in order to the stack and use a simple char * for the va_list type. It has the downside that vectors cannot be passed directly in xmm registers, because a vector argument is bigger than the normal 8-byte register parameter stack slot, hence the recent addition of __vectorcall.

That's more or less the same approach taken by MIPS.  Our specific problem was that MIPS n64 passes the first 8 doublewords of arguments in integer registers, but passing capabilities in integer registers is not possible, so we had to tweak the variadic convention a bit.

David





More information about the llvm-dev mailing list