Some code clean up.

llvm-svn: 55881
This commit is contained in:
Evan Cheng 2008-09-07 09:07:23 +00:00
parent b9a0abb129
commit 6f343bd543
1 changed files with 21 additions and 26 deletions

View File

@ -1088,13 +1088,11 @@ CCAssignFn *X86TargetLowering::CCAssignFnForNode(SDValue Op) const {
if (Subtarget->is64Bit()) {
if (Subtarget->isTargetWin64())
return CC_X86_Win64_C;
else {
if (CC == CallingConv::Fast && PerformTailCallOpt)
else if (CC == CallingConv::Fast && PerformTailCallOpt)
return CC_X86_64_TailCall;
else
return CC_X86_64_C;
}
}
if (CC == CallingConv::X86_FastCall)
return CC_X86_32_FastCall;
@ -1294,7 +1292,7 @@ X86TargetLowering::LowerFORMAL_ARGUMENTS(SDValue Op, SelectionDAG &DAG) {
unsigned StackSize = CCInfo.getNextStackOffset();
// align stack specially for tail calls
if (CC == CallingConv::Fast)
if (PerformTailCallOpt && CC == CallingConv::Fast)
StackSize = GetAlignedArgumentStackSize(StackSize, DAG);
// If the function takes variable number of arguments, make a frame index for
@ -1485,7 +1483,7 @@ SDValue X86TargetLowering::LowerCALL(SDValue Op, SelectionDAG &DAG) {
// Get a count of how many bytes are to be pushed on the stack.
unsigned NumBytes = CCInfo.getNextStackOffset();
if (CC == CallingConv::Fast)
if (IsTailCall)
NumBytes = GetAlignedArgumentStackSize(NumBytes, DAG);
int FPDiff = 0;
@ -1829,7 +1827,6 @@ SDValue X86TargetLowering::LowerCALL(SDValue Op, SelectionDAG &DAG) {
/// for a 16 byte align requirement.
unsigned X86TargetLowering::GetAlignedArgumentStackSize(unsigned StackSize,
SelectionDAG& DAG) {
if (PerformTailCallOpt) {
MachineFunction &MF = DAG.getMachineFunction();
const TargetMachine &TM = MF.getTarget();
const TargetFrameInfo &TFI = *TM.getFrameInfo();
@ -1845,9 +1842,7 @@ unsigned X86TargetLowering::GetAlignedArgumentStackSize(unsigned StackSize,
Offset = ((~AlignMask) & Offset) + StackAlignment +
(StackAlignment-SlotSize);
}
StackSize = Offset;
}
return StackSize;
return Offset;
}
/// IsEligibleForTailCallElimination - Check to see whether the next instruction