[llvm-commits] [llvm] r41160 - /llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp
Bruno Cardoso Lopes
bruno.cardoso at gmail.com
Fri Aug 17 19:19:09 PDT 2007
Author: bruno
Date: Fri Aug 17 21:19:09 2007
New Revision: 41160
URL: http://llvm.org/viewvc/llvm-project?rev=41160&view=rev
Log:
Fixed stack frame addressing bug
Modified:
llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp
Modified: llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp?rev=41160&r1=41159&r2=41160&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp Fri Aug 17 21:19:09 2007
@@ -271,15 +271,15 @@
MipsFunctionInfo *MipsFI = MF.getInfo<MipsFunctionInfo>();
MachineBasicBlock::iterator MBBI = MBB.begin();
- // Get the number of bytes to allocate from the FrameInfo
+ // Get the number of bytes to allocate from the FrameInfo.
int NumBytes = (int) MFI->getStackSize();
#ifndef NDEBUG
- DOUT << "\n<--- EMIT PROLOGUE --->";
+ DOUT << "\n<--- EMIT PROLOGUE --->\n";
DOUT << "Stack size :" << NumBytes << "\n";
#endif
- // Do we need to allocate space on the stack?
+ // Don't need to allocate space on the stack.
if (NumBytes == 0) return;
int FPOffset, RAOffset;
@@ -289,13 +289,13 @@
// using FP, the last stack slot becomes empty
// and RA is saved before it.
if ((hasFP(MF)) && (MFI->hasCalls())) {
- FPOffset = NumBytes;
- RAOffset = (NumBytes+4);
+ FPOffset = NumBytes+4;
+ RAOffset = (NumBytes+8);
} else if ((!hasFP(MF)) && (MFI->hasCalls())) {
FPOffset = 0;
- RAOffset = NumBytes;
+ RAOffset = NumBytes+4;
} else if ((hasFP(MF)) && (!MFI->hasCalls())) {
- FPOffset = NumBytes;
+ FPOffset = NumBytes+4;
RAOffset = 0;
}
@@ -310,7 +310,7 @@
#endif
// Align stack.
- NumBytes += 8;
+ NumBytes += 12;
unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment();
NumBytes = ((NumBytes+Align-1)/Align*Align);
More information about the llvm-commits
mailing list