Skip to content

Commit 97ba769

Browse files
committed
Pass the correct call frame size to callseq_start node. This is needed to
replace uses of function getMaxCallFrameSize defined in MipsFunctionInfo with the one MachineFrameInfo has. llvm-svn: 160841
1 parent 7aab229 commit 97ba769

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

llvm/lib/Target/Mips/MipsISelLowering.cpp

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2674,6 +2674,14 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
26742674

26752675
// Get a count of how many bytes are to be pushed on the stack.
26762676
unsigned NextStackOffset = CCInfo.getNextStackOffset();
2677+
unsigned StackAlignment = TFL->getStackAlignment();
2678+
NextStackOffset = RoundUpToAlignment(NextStackOffset, StackAlignment);
2679+
2680+
// Update size of the maximum argument space.
2681+
// For O32, a minimum of four words (16 bytes) of argument space is
2682+
// allocated.
2683+
if (IsO32 && (CallConv != CallingConv::Fast))
2684+
NextStackOffset = std::max(NextStackOffset, (unsigned)16);
26772685

26782686
// Chain is the output chain of the last Load/Store or CopyToReg node.
26792687
// ByValChain is the output chain of the last Memcpy node created for copying
@@ -2687,24 +2695,12 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
26872695
// of dynamically allocated area on the stack.
26882696
int DynAllocFI = MipsFI->getDynAllocFI();
26892697

2690-
// Update size of the maximum argument space.
2691-
// For O32, a minimum of four words (16 bytes) of argument space is
2692-
// allocated.
2693-
if (IsO32 && (CallConv != CallingConv::Fast))
2694-
NextStackOffset = std::max(NextStackOffset, (unsigned)16);
2695-
2696-
unsigned MaxCallFrameSize = MipsFI->getMaxCallFrameSize();
2697-
2698-
if (MaxCallFrameSize < NextStackOffset) {
2698+
if (MipsFI->getMaxCallFrameSize() < NextStackOffset) {
26992699
MipsFI->setMaxCallFrameSize(NextStackOffset);
27002700

27012701
// Set the offsets relative to $sp of the $gp restore slot and dynamically
27022702
// allocated stack space. These offsets must be aligned to a boundary
27032703
// determined by the stack alignment of the ABI.
2704-
unsigned StackAlignment = TFL->getStackAlignment();
2705-
NextStackOffset = (NextStackOffset + StackAlignment - 1) /
2706-
StackAlignment * StackAlignment;
2707-
27082704
MFI->setObjectOffset(DynAllocFI, NextStackOffset);
27092705
}
27102706

@@ -2933,8 +2929,7 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
29332929
InFlag = Chain.getValue(1);
29342930

29352931
// Create the CALLSEQ_END node.
2936-
Chain = DAG.getCALLSEQ_END(Chain,
2937-
DAG.getIntPtrConstant(NextStackOffset, true),
2932+
Chain = DAG.getCALLSEQ_END(Chain, NextStackOffsetVal,
29382933
DAG.getIntPtrConstant(0, true), InFlag);
29392934
InFlag = Chain.getValue(1);
29402935

0 commit comments

Comments
 (0)