summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MipsSERegisterInfo.cpp
diff options
context:
space:
mode:
authorVasileios Kalintiris <Vasileios.Kalintiris@imgtec.com>2015-06-02 13:14:46 +0000
committerVasileios Kalintiris <Vasileios.Kalintiris@imgtec.com>2015-06-02 13:14:46 +0000
commitbb698c7d5f23474930fae702ac44ee5ab8e03781 (patch)
tree396c2a5e09d20a93b4c77957e1729d864a3094df /llvm/lib/Target/Mips/MipsSERegisterInfo.cpp
parente62307421053f527e2837e7a4d1d3c246b39303f (diff)
downloadbcm5719-llvm-bb698c7d5f23474930fae702ac44ee5ab8e03781.tar.gz
bcm5719-llvm-bb698c7d5f23474930fae702ac44ee5ab8e03781.zip
[mips] Add support for dynamic stack realignment.
Summary: With this change we are able to realign the stack dynamically, whenever it contains objects with alignment requirements that are larger than the alignment specified from the given ABI. We have to use the $fp register as the frame pointer when we perform dynamic stack realignment. In complex stack frames, with variably-sized objects, we reserve additionally the callee-saved register $s7 as the base pointer in order to reference locals. Reviewers: dsanders Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8633 llvm-svn: 238829
Diffstat (limited to 'llvm/lib/Target/Mips/MipsSERegisterInfo.cpp')
-rw-r--r--llvm/lib/Target/Mips/MipsSERegisterInfo.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Target/Mips/MipsSERegisterInfo.cpp b/llvm/lib/Target/Mips/MipsSERegisterInfo.cpp
index 8c74a98ecca..132c3a1001a 100644
--- a/llvm/lib/Target/Mips/MipsSERegisterInfo.cpp
+++ b/llvm/lib/Target/Mips/MipsSERegisterInfo.cpp
@@ -110,8 +110,11 @@ void MipsSERegisterInfo::eliminateFI(MachineBasicBlock::iterator II,
MachineFunction &MF = *MI.getParent()->getParent();
MachineFrameInfo *MFI = MF.getFrameInfo();
MipsFunctionInfo *MipsFI = MF.getInfo<MipsFunctionInfo>();
+
MipsABIInfo ABI =
static_cast<const MipsTargetMachine &>(MF.getTarget()).getABI();
+ const MipsRegisterInfo *RegInfo =
+ static_cast<const MipsRegisterInfo *>(MF.getSubtarget().getRegisterInfo());
const std::vector<CalleeSavedInfo> &CSI = MFI->getCalleeSavedInfo();
int MinCSFI = 0;
@@ -135,7 +138,14 @@ void MipsSERegisterInfo::eliminateFI(MachineBasicBlock::iterator II,
if ((FrameIndex >= MinCSFI && FrameIndex <= MaxCSFI) || EhDataRegFI)
FrameReg = ABI.GetStackPtr();
- else
+ else if (RegInfo->needsStackRealignment(MF)) {
+ if (MFI->hasVarSizedObjects() && !MFI->isFixedObjectIndex(FrameIndex))
+ FrameReg = ABI.GetBasePtr();
+ else if (MFI->isFixedObjectIndex(FrameIndex))
+ FrameReg = getFrameRegister(MF);
+ else
+ FrameReg = ABI.GetStackPtr();
+ } else
FrameReg = getFrameRegister(MF);
// Calculate final offset.
OpenPOWER on IntegriCloud