Fixed call stack alignment. Improved AsmPrinter alignment issues.
[oota-llvm.git] / lib / Target / Mips / MipsRegisterInfo.cpp
index cd42abd3003ec7a4ef3a4547c7002574e5be92a2..2c92060be905cf34d09ae04611750117d38a58c0 100644 (file)
@@ -267,7 +267,7 @@ emitPrologue(MachineFunction &MF) const
   #endif
 
   // No need to allocate space on the stack.
-  if (NumBytes == 0) return;
+  if (NumBytes == 0 && !MFI->hasCalls()) return;
 
   int FPOffset, RAOffset;
   
@@ -389,7 +389,8 @@ void MipsRegisterInfo::
 processFunctionBeforeFrameFinalized(MachineFunction &MF) const {
   // Set the SPOffset on the FI where GP must be saved/loaded.
   MachineFrameInfo *MFI = MF.getFrameInfo();
-  if (MFI->hasCalls()) { 
+  bool isPIC = (MF.getTarget().getRelocationModel() == Reloc::PIC_);
+  if (MFI->hasCalls() && isPIC) { 
     MipsFunctionInfo *MipsFI = MF.getInfo<MipsFunctionInfo>();
     #ifndef NDEBUG
     DOUT << "processFunctionBeforeFrameFinalized\n";