@@ -2674,6 +2674,14 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
2674
2674
2675
2675
// Get a count of how many bytes are to be pushed on the stack.
2676
2676
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 );
2677
2685
2678
2686
// Chain is the output chain of the last Load/Store or CopyToReg node.
2679
2687
// ByValChain is the output chain of the last Memcpy node created for copying
@@ -2687,24 +2695,12 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
2687
2695
// of dynamically allocated area on the stack.
2688
2696
int DynAllocFI = MipsFI->getDynAllocFI ();
2689
2697
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) {
2699
2699
MipsFI->setMaxCallFrameSize (NextStackOffset);
2700
2700
2701
2701
// Set the offsets relative to $sp of the $gp restore slot and dynamically
2702
2702
// allocated stack space. These offsets must be aligned to a boundary
2703
2703
// determined by the stack alignment of the ABI.
2704
- unsigned StackAlignment = TFL->getStackAlignment ();
2705
- NextStackOffset = (NextStackOffset + StackAlignment - 1 ) /
2706
- StackAlignment * StackAlignment;
2707
-
2708
2704
MFI->setObjectOffset (DynAllocFI, NextStackOffset);
2709
2705
}
2710
2706
@@ -2933,8 +2929,7 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
2933
2929
InFlag = Chain.getValue (1 );
2934
2930
2935
2931
// Create the CALLSEQ_END node.
2936
- Chain = DAG.getCALLSEQ_END (Chain,
2937
- DAG.getIntPtrConstant (NextStackOffset, true ),
2932
+ Chain = DAG.getCALLSEQ_END (Chain, NextStackOffsetVal,
2938
2933
DAG.getIntPtrConstant (0 , true ), InFlag);
2939
2934
InFlag = Chain.getValue (1 );
2940
2935
0 commit comments