musttail: Forward regparms of variadic functions on x86_64
authorReid Kleckner <reid@kleckner.net>
Fri, 29 Aug 2014 21:42:08 +0000 (21:42 +0000)
committerReid Kleckner <reid@kleckner.net>
Fri, 29 Aug 2014 21:42:08 +0000 (21:42 +0000)
commit9436574d1bc2207b9c088b1f7847dc8d21c7f460
treecc4f492add9e6ae134a2c0580181627e5332948f
parentdae28732f44add82857b7a802b7985b93aaf054e
musttail: Forward regparms of variadic functions on x86_64

Summary:
If a variadic function body contains a musttail call, then we copy all
of the remaining register parameters into virtual registers in the
function prologue. We track the virtual registers through the function
body, and add them as additional registers to pass to the call. Because
this is all done in virtual registers, the register allocator usually
gives us good code. If the function does a call, however, it will have
to spill and reload all argument registers (ew).

Forwarding regparms on x86_32 is not implemented because most compilers
don't support varargs in 32-bit with regparms.

Reviewers: majnemer

Subscribers: aemerson, llvm-commits

Differential Revision: http://reviews.llvm.org/D5060

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216780 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/MachineFrameInfo.h
lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86MachineFunctionInfo.h
test/CodeGen/X86/musttail-varargs.ll [new file with mode: 0644]