llvm.org GIT mirror llvm / 055c7eb
Fixed stack frame addressing bug git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41160 91177308-0d34-0410-b5e6-96231b3b80d8 Bruno Cardoso Lopes 13 years ago
1 changed file(s) with 8 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
270270 MipsFunctionInfo *MipsFI = MF.getInfo();
271271 MachineBasicBlock::iterator MBBI = MBB.begin();
272272
273 // Get the number of bytes to allocate from the FrameInfo
273 // Get the number of bytes to allocate from the FrameInfo.
274274 int NumBytes = (int) MFI->getStackSize();
275275
276276 #ifndef NDEBUG
277 DOUT << "\n<--- EMIT PROLOGUE --->";
277 DOUT << "\n<--- EMIT PROLOGUE --->\n";
278278 DOUT << "Stack size :" << NumBytes << "\n";
279279 #endif
280280
281 // Do we need to allocate space on the stack?
281 // Don't need to allocate space on the stack.
282282 if (NumBytes == 0) return;
283283
284284 int FPOffset, RAOffset;
288288 // using FP, the last stack slot becomes empty
289289 // and RA is saved before it.
290290 if ((hasFP(MF)) && (MFI->hasCalls())) {
291 FPOffset = NumBytes;
292 RAOffset = (NumBytes+4);
291 FPOffset = NumBytes+4;
292 RAOffset = (NumBytes+8);
293293 } else if ((!hasFP(MF)) && (MFI->hasCalls())) {
294294 FPOffset = 0;
295 RAOffset = NumBytes;
295 RAOffset = NumBytes+4;
296296 } else if ((hasFP(MF)) && (!MFI->hasCalls())) {
297 FPOffset = NumBytes;
297 FPOffset = NumBytes+4;
298298 RAOffset = 0;
299299 }
300300
309309 #endif
310310
311311 // Align stack.
312 NumBytes += 8;
312 NumBytes += 12;
313313 unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment();
314314 NumBytes = ((NumBytes+Align-1)/Align*Align);
315315