aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/Mips
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@mips.com>2012-07-26 23:27:01 +0000
committerAkira Hatanaka <ahatanaka@mips.com>2012-07-26 23:27:01 +0000
commit480eeb54315e35b9d18213c2d56d2166e154b62d (patch)
tree58939fc0670ec46d054a1de5ec127c1157409195 /lib/Target/Mips
parent7971de4178d3be9b31ac03c20e2b50c3e7f4641c (diff)
downloadexternal_llvm-480eeb54315e35b9d18213c2d56d2166e154b62d.zip
external_llvm-480eeb54315e35b9d18213c2d56d2166e154b62d.tar.gz
external_llvm-480eeb54315e35b9d18213c2d56d2166e154b62d.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160841 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips')
-rw-r--r--lib/Target/Mips/MipsISelLowering.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/lib/Target/Mips/MipsISelLowering.cpp b/lib/Target/Mips/MipsISelLowering.cpp
index 0f6adad..b0acb23 100644
--- a/lib/Target/Mips/MipsISelLowering.cpp
+++ b/lib/Target/Mips/MipsISelLowering.cpp
@@ -2674,6 +2674,14 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
// Get a count of how many bytes are to be pushed on the stack.
unsigned NextStackOffset = CCInfo.getNextStackOffset();
+ unsigned StackAlignment = TFL->getStackAlignment();
+ NextStackOffset = RoundUpToAlignment(NextStackOffset, StackAlignment);
+
+ // Update size of the maximum argument space.
+ // For O32, a minimum of four words (16 bytes) of argument space is
+ // allocated.
+ if (IsO32 && (CallConv != CallingConv::Fast))
+ NextStackOffset = std::max(NextStackOffset, (unsigned)16);
// Chain is the output chain of the last Load/Store or CopyToReg node.
// ByValChain is the output chain of the last Memcpy node created for copying
@@ -2687,24 +2695,12 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
// of dynamically allocated area on the stack.
int DynAllocFI = MipsFI->getDynAllocFI();
- // Update size of the maximum argument space.
- // For O32, a minimum of four words (16 bytes) of argument space is
- // allocated.
- if (IsO32 && (CallConv != CallingConv::Fast))
- NextStackOffset = std::max(NextStackOffset, (unsigned)16);
-
- unsigned MaxCallFrameSize = MipsFI->getMaxCallFrameSize();
-
- if (MaxCallFrameSize < NextStackOffset) {
+ if (MipsFI->getMaxCallFrameSize() < NextStackOffset) {
MipsFI->setMaxCallFrameSize(NextStackOffset);
// Set the offsets relative to $sp of the $gp restore slot and dynamically
// allocated stack space. These offsets must be aligned to a boundary
// determined by the stack alignment of the ABI.
- unsigned StackAlignment = TFL->getStackAlignment();
- NextStackOffset = (NextStackOffset + StackAlignment - 1) /
- StackAlignment * StackAlignment;
-
MFI->setObjectOffset(DynAllocFI, NextStackOffset);
}
@@ -2933,8 +2929,7 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
InFlag = Chain.getValue(1);
// Create the CALLSEQ_END node.
- Chain = DAG.getCALLSEQ_END(Chain,
- DAG.getIntPtrConstant(NextStackOffset, true),
+ Chain = DAG.getCALLSEQ_END(Chain, NextStackOffsetVal,
DAG.getIntPtrConstant(0, true), InFlag);
InFlag = Chain.getValue(1);