[mips] Use correct frame register for DWARF info when dynamically realigning the...
[oota-llvm.git] / lib / Target / Mips / MipsSEFrameLowering.cpp
index 70f4a63721717bda5aff0c79a606893b22eb4451..a4abd62ee607f7053f527d9c0bb8f8ccbf7dbb06 100644 (file)
@@ -548,8 +548,8 @@ void MipsSEFrameLowering::emitInterruptPrologueStub(
   // clearing is not provided so reject that configuration.
   if (!STI.hasMips32r2())
     report_fatal_error(
-        "\"interrupt\" attribute is not supported on pre-r2 MIPS or"
-        "Mips16 targets.");
+        "\"interrupt\" attribute is not supported on pre-MIPS32R2 or "
+        "MIPS16 targets.");
 
   // The GP register contains the "user" value, so we cannot perform
   // any gp relative loads until we restore the "kernel" or "system" gp
@@ -561,7 +561,7 @@ void MipsSEFrameLowering::emitInterruptPrologueStub(
 
   if (!STI.isABI_O32() || STI.hasMips64())
     report_fatal_error("\"interrupt\" attribute is only supported for the "
-                       "O32 ABI on MIPS32r2+ at the present time.");
+                       "O32 ABI on MIPS32R2+ at the present time.");
 
   // Perform ISR handling like GCC
   StringRef IntKind =
@@ -753,6 +753,21 @@ void MipsSEFrameLowering::emitInterruptEpilogueStub(
       .addImm(0);
 }
 
+int MipsSEFrameLowering::getFrameIndexReference(const MachineFunction &MF,
+                                                int FI,
+                                                unsigned &FrameReg) const {
+  const MachineFrameInfo *MFI = MF.getFrameInfo();
+  MipsABIInfo ABI = STI.getABI();
+
+  if (MFI->isFixedObjectIndex(FI))
+    FrameReg = hasFP(MF) ? ABI.GetFramePtr() : ABI.GetStackPtr();
+  else
+    FrameReg = hasBP(MF) ? ABI.GetBasePtr() : ABI.GetStackPtr();
+
+  return MFI->getObjectOffset(FI) + MFI->getStackSize() -
+         getOffsetOfLocalArea() + MFI->getOffsetAdjustment();
+}
+
 bool MipsSEFrameLowering::
 spillCalleeSavedRegisters(MachineBasicBlock &MBB,
                           MachineBasicBlock::iterator MI,