diff options
author | Nico Weber <nicolasweber@gmx.de> | 2016-07-14 01:52:51 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2016-07-14 01:52:51 +0000 |
commit | af7e8465e1fabdfff6c3a08a14cdb83ed79a10dc (patch) | |
tree | f6c84ac95b6576362dd62115c088ffe6cefe33ed /llvm/lib/Target/X86/X86FastISel.cpp | |
parent | 8484f92f7f32575c9b48819b0d1e06316cd5ab4f (diff) | |
download | bcm5719-llvm-af7e8465e1fabdfff6c3a08a14cdb83ed79a10dc.tar.gz bcm5719-llvm-af7e8465e1fabdfff6c3a08a14cdb83ed79a10dc.zip |
Teach fast isel about thiscall (and callee-pop) calls.
http://reviews.llvm.org/D22315
llvm-svn: 275360
Diffstat (limited to 'llvm/lib/Target/X86/X86FastISel.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86FastISel.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/lib/Target/X86/X86FastISel.cpp b/llvm/lib/Target/X86/X86FastISel.cpp index 6258e4f6cf3..182731fe8d2 100644 --- a/llvm/lib/Target/X86/X86FastISel.cpp +++ b/llvm/lib/Target/X86/X86FastISel.cpp @@ -2983,9 +2983,9 @@ bool X86FastISel::fastLowerArguments() { return true; } -static unsigned computeBytesPoppedByCallee(const X86Subtarget *Subtarget, - CallingConv::ID CC, - ImmutableCallSite *CS) { +static unsigned computeBytesPoppedByCalleeForSRet(const X86Subtarget *Subtarget, + CallingConv::ID CC, + ImmutableCallSite *CS) { if (Subtarget->is64Bit()) return 0; if (Subtarget->getTargetTriple().isOSMSVCRT()) @@ -3025,6 +3025,7 @@ bool X86FastISel::fastLowerCall(CallLoweringInfo &CLI) { case CallingConv::WebKit_JS: case CallingConv::Swift: case CallingConv::X86_FastCall: + case CallingConv::X86_ThisCall: case CallingConv::X86_64_Win64: case CallingConv::X86_64_SysV: break; @@ -3052,11 +3053,6 @@ bool X86FastISel::fastLowerCall(CallLoweringInfo &CLI) { if (Flag.isSwiftError()) return false; - // Fast-isel doesn't know about callee-pop yet. - if (X86::isCalleePop(CC, Subtarget->is64Bit(), IsVarArg, - TM.Options.GuaranteedTailCallOpt)) - return false; - SmallVector<MVT, 16> OutVTs; SmallVector<unsigned, 16> ArgRegs; @@ -3336,7 +3332,10 @@ bool X86FastISel::fastLowerCall(CallLoweringInfo &CLI) { // Issue CALLSEQ_END unsigned NumBytesForCalleeToPop = - computeBytesPoppedByCallee(Subtarget, CC, CLI.CS); + X86::isCalleePop(CC, Subtarget->is64Bit(), IsVarArg, + TM.Options.GuaranteedTailCallOpt) + ? NumBytes // Callee pops everything. + : computeBytesPoppedByCalleeForSRet(Subtarget, CC, CLI.CS); unsigned AdjStackUp = TII.getCallFrameDestroyOpcode(); BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(AdjStackUp)) .addImm(NumBytes).addImm(NumBytesForCalleeToPop); |