mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
Don't spill LR as a callee saved register.
llvm-svn: 34533
This commit is contained in:
parent
7c2f17b629
commit
704423b797
@ -26,6 +26,10 @@ private:
|
||||
/// stored. Also used as an anchor for instructions that need to be altered
|
||||
/// when using frame pointers (dyna_add, dyna_sub.)
|
||||
int FramePointerSaveIndex;
|
||||
|
||||
/// UsesLR - Indicates whether LR is used in the current function.
|
||||
///
|
||||
bool UsesLR;
|
||||
|
||||
public:
|
||||
PPCFunctionInfo(MachineFunction& MF)
|
||||
@ -34,6 +38,9 @@ public:
|
||||
|
||||
int getFramePointerSaveIndex() const { return FramePointerSaveIndex; }
|
||||
void setFramePointerSaveIndex(int Idx) { FramePointerSaveIndex = Idx; }
|
||||
|
||||
void setUsesLR(bool U) { UsesLR = U; }
|
||||
bool usesLR() { return UsesLR; }
|
||||
|
||||
};
|
||||
|
||||
|
@ -439,8 +439,8 @@ bool PPCRegisterInfo::hasFP(const MachineFunction &MF) const {
|
||||
/// usesLR - Returns if the link registers (LR) has been used in the function.
|
||||
///
|
||||
bool PPCRegisterInfo::usesLR(MachineFunction &MF) const {
|
||||
const bool *PhysRegsUsed = MF.getUsedPhysregs();
|
||||
return PhysRegsUsed[getRARegister()];
|
||||
PPCFunctionInfo *FI = MF.getInfo<PPCFunctionInfo>();
|
||||
return FI->usesLR();
|
||||
}
|
||||
|
||||
void PPCRegisterInfo::
|
||||
@ -774,6 +774,15 @@ void PPCRegisterInfo::determineFrameLayout(MachineFunction &MF) const {
|
||||
MFI->setStackSize(FrameSize);
|
||||
}
|
||||
|
||||
void PPCRegisterInfo::processFunctionBeforeCalleeSavedScan(MachineFunction &MF)
|
||||
const {
|
||||
// Save and clear the LR state.
|
||||
PPCFunctionInfo *FI = MF.getInfo<PPCFunctionInfo>();
|
||||
unsigned LR = getRARegister();
|
||||
FI->setUsesLR(MF.isPhysRegUsed(LR));
|
||||
MF.changePhyRegUsed(LR, false);
|
||||
}
|
||||
|
||||
void PPCRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
MachineBasicBlock &MBB = MF.front(); // Prolog goes in entry BB
|
||||
MachineBasicBlock::iterator MBBI = MBB.begin();
|
||||
|
@ -82,6 +82,7 @@ public:
|
||||
/// frame size.
|
||||
void determineFrameLayout(MachineFunction &MF) const;
|
||||
|
||||
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF) const;
|
||||
void emitPrologue(MachineFunction &MF) const;
|
||||
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user