[llvm-commits] [llvm] r86543 - in /llvm/trunk/lib/Target/Mips: MipsMachineFunction.h MipsRegisterInfo.cpp
Bruno Cardoso Lopes
bruno.cardoso at gmail.com
Mon Nov 9 06:27:49 PST 2009
Author: bruno
Date: Mon Nov 9 08:27:49 2009
New Revision: 86543
URL: http://llvm.org/viewvc/llvm-project?rev=86543&view=rev
Log:
Fix PR5149.
http://llvm.org/bugs/show_bug.cgi?id=5149
Modified:
llvm/trunk/lib/Target/Mips/MipsMachineFunction.h
llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp
Modified: llvm/trunk/lib/Target/Mips/MipsMachineFunction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsMachineFunction.h?rev=86543&r1=86542&r2=86543&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsMachineFunction.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsMachineFunction.h Mon Nov 9 08:27:49 2009
@@ -103,6 +103,7 @@
int getGPFI() const { return GPHolder.FI; }
void setGPStackOffset(int Off) { GPHolder.SPOffset = Off; }
void setGPFI(int FI) { GPHolder.FI = FI; }
+ bool needGPSaveRestore() const { return GPHolder.SPOffset != -1; }
bool hasLoadArgs() const { return HasLoadArgs; }
bool hasStoreVarArgs() const { return HasStoreVarArgs; }
Modified: llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp?rev=86543&r1=86542&r2=86543&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp Mon Nov 9 08:27:49 2009
@@ -438,11 +438,10 @@
.addReg(Mips::SP).addReg(Mips::ZERO);
}
- // PIC speficic function prologue
- if ((isPIC) && (MFI->hasCalls())) {
+ // Restore GP from the saved stack location
+ if (MipsFI->needGPSaveRestore())
BuildMI(MBB, MBBI, dl, TII.get(Mips::CPRESTORE))
.addImm(MipsFI->getGPStackOffset());
- }
}
void MipsRegisterInfo::
@@ -489,13 +488,11 @@
void MipsRegisterInfo::
processFunctionBeforeFrameFinalized(MachineFunction &MF) const {
- // Set the SPOffset on the FI where GP must be saved/loaded.
+ // Set the stack offset where GP must be saved/loaded from.
MachineFrameInfo *MFI = MF.getFrameInfo();
- bool isPIC = (MF.getTarget().getRelocationModel() == Reloc::PIC_);
- if (MFI->hasCalls() && isPIC) {
- MipsFunctionInfo *MipsFI = MF.getInfo<MipsFunctionInfo>();
+ MipsFunctionInfo *MipsFI = MF.getInfo<MipsFunctionInfo>();
+ if (MipsFI->needGPSaveRestore())
MFI->setObjectOffset(MipsFI->getGPFI(), MipsFI->getGPStackOffset());
- }
}
unsigned MipsRegisterInfo::
More information about the llvm-commits
mailing list