[llvm-commits] [llvm] r56436 - in /llvm/trunk: lib/Target/X86/X86CallingConv.td lib/Target/X86/X86FastISel.cpp lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/tailcall-stackalign.ll test/CodeGen/X86/tailcallbyval.ll test/CodeGen/X86/tailcallfp2.ll
Arnold Schwaighofer
arnold.schwaighofer at gmail.com
Mon Sep 22 07:50:07 PDT 2008
Author: arnolds
Date: Mon Sep 22 09:50:07 2008
New Revision: 56436
URL: http://llvm.org/viewvc/llvm-project?rev=56436&view=rev
Log:
Change the calling convention used when tail call optimization is enabled from CC_X86_32_TailCall to CC_X86_32_FastCC.
Modified:
llvm/trunk/lib/Target/X86/X86CallingConv.td
llvm/trunk/lib/Target/X86/X86FastISel.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/test/CodeGen/X86/tailcall-stackalign.ll
llvm/trunk/test/CodeGen/X86/tailcallbyval.ll
llvm/trunk/test/CodeGen/X86/tailcallfp2.ll
Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=56436&r1=56435&r2=56436&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86CallingConv.td (original)
+++ llvm/trunk/lib/Target/X86/X86CallingConv.td Mon Sep 22 09:50:07 2008
@@ -312,22 +312,6 @@
CCDelegateTo<CC_X86_32_Common>
]>;
-/// Same as C calling convention except for non-free ECX which is used for storing
-/// a potential pointer to the tail called function.
-def CC_X86_32_TailCall : CallingConv<[
- // Promote i8/i16 arguments to i32.
- CCIfType<[i8, i16], CCPromoteToType<i32>>,
-
- // Nested function trampolines are currently not supported by fastcc.
-
- // The first 3 integer arguments, if marked 'inreg' and if the call is not
- // a vararg call, are passed in integer registers.
- CCIfNotVarArg<CCIfInReg<CCIfType<[i32], CCAssignToReg<[EAX, EDX]>>>>,
-
- // Otherwise, same as everything else.
- CCDelegateTo<CC_X86_32_Common>
-]>;
-
def CC_X86_32_FastCall : CallingConv<[
// Promote i8/i16 arguments to i32.
CCIfType<[i8, i16], CCPromoteToType<i32>>,
Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=56436&r1=56435&r2=56436&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Mon Sep 22 09:50:07 2008
@@ -142,8 +142,6 @@
if (CC == CallingConv::X86_FastCall)
return CC_X86_32_FastCall;
- else if (CC == CallingConv::Fast && isTaillCall)
- return CC_X86_32_TailCall;
else if (CC == CallingConv::Fast)
return CC_X86_32_FastCC;
else
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=56436&r1=56435&r2=56436&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Sep 22 09:50:07 2008
@@ -890,7 +890,7 @@
SDValue TargetAddress = TailCall.getOperand(1);
SDValue StackAdjustment = TailCall.getOperand(2);
assert(((TargetAddress.getOpcode() == ISD::Register &&
- (cast<RegisterSDNode>(TargetAddress)->getReg() == X86::ECX ||
+ (cast<RegisterSDNode>(TargetAddress)->getReg() == X86::EAX ||
cast<RegisterSDNode>(TargetAddress)->getReg() == X86::R9)) ||
TargetAddress.getOpcode() == ISD::TargetExternalSymbol ||
TargetAddress.getOpcode() == ISD::TargetGlobalAddress) &&
@@ -1098,8 +1098,6 @@
if (CC == CallingConv::X86_FastCall)
return CC_X86_32_FastCall;
- else if (CC == CallingConv::Fast && PerformTailCallOpt)
- return CC_X86_32_TailCall;
else if (CC == CallingConv::Fast)
return CC_X86_32_FastCC;
else
@@ -1700,7 +1698,7 @@
} else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee)) {
Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy());
} else if (IsTailCall) {
- unsigned Opc = Is64Bit ? X86::R9 : X86::ECX;
+ unsigned Opc = Is64Bit ? X86::R9 : X86::EAX;
Chain = DAG.getCopyToReg(Chain,
DAG.getRegister(Opc, getPointerTy()),
Modified: llvm/trunk/test/CodeGen/X86/tailcall-stackalign.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tailcall-stackalign.ll?rev=56436&r1=56435&r2=56436&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/tailcall-stackalign.ll (original)
+++ llvm/trunk/test/CodeGen/X86/tailcall-stackalign.ll Mon Sep 22 09:50:07 2008
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -mtriple=i686-unknown-linux -tailcallopt | grep -A 1 call | grep -A 1 tailcaller | grep subl | grep 20
+; RUN: llvm-as < %s | llc -mtriple=i686-unknown-linux -tailcallopt | grep -A 1 call | grep -A 1 tailcaller | grep subl | grep 12
; Linux has 8 byte alignment so the params cause stack size 20 when tailcallopt
; is enabled, ensure that a normal fastcc call has matching stack size
Modified: llvm/trunk/test/CodeGen/X86/tailcallbyval.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tailcallbyval.ll?rev=56436&r1=56435&r2=56436&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/tailcallbyval.ll (original)
+++ llvm/trunk/test/CodeGen/X86/tailcallbyval.ll Mon Sep 22 09:50:07 2008
@@ -1,6 +1,6 @@
; RUN: llvm-as < %s | llc -march=x86 -tailcallopt | grep TAILCALL
; check for the 2 byval moves
-; RUN: llvm-as < %s | llc -march=x86 -tailcallopt | grep rep | wc -l | grep 2
+; RUN: llvm-as < %s | llc -march=x86 -tailcallopt | grep movl | grep ecx | grep eax | wc -l | grep 1
%struct.s = type {i32, i32, i32, i32, i32, i32, i32, i32,
i32, i32, i32, i32, i32, i32, i32, i32,
i32, i32, i32, i32, i32, i32, i32, i32 }
Modified: llvm/trunk/test/CodeGen/X86/tailcallfp2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tailcallfp2.ll?rev=56436&r1=56435&r2=56436&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/tailcallfp2.ll (original)
+++ llvm/trunk/test/CodeGen/X86/tailcallfp2.ll Mon Sep 22 09:50:07 2008
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -march=x86 -tailcallopt | grep {jmp} | grep {\\*%ecx}
+; RUN: llvm-as < %s | llc -march=x86 -tailcallopt | grep {jmp} | grep {\\*%eax}
declare i32 @putchar(i32)
More information about the llvm-commits
mailing list