summaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/PPCRegisterInfo.cpp
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2007-02-23 20:34:16 +0000
committerJim Laskey <jlaskey@mac.com>2007-02-23 20:34:16 +0000
commit2a27a7598b90359696e31cb665914206f369d1f0 (patch)
tree8d168f806a5d67325afc59a07545838c75140bbe /lib/Target/PowerPC/PPCRegisterInfo.cpp
parent600c383e5c96d4b107b3e6ed4515eac25246cb02 (diff)
downloadllvm-2a27a7598b90359696e31cb665914206f369d1f0.tar.gz
llvm-2a27a7598b90359696e31cb665914206f369d1f0.tar.bz2
llvm-2a27a7598b90359696e31cb665914206f369d1f0.tar.xz
Don't spill LR as a callee saved register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34533 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCRegisterInfo.cpp')
-rw-r--r--lib/Target/PowerPC/PPCRegisterInfo.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Target/PowerPC/PPCRegisterInfo.cpp b/lib/Target/PowerPC/PPCRegisterInfo.cpp
index 1dda53a342..86d17f6fa3 100644
--- a/lib/Target/PowerPC/PPCRegisterInfo.cpp
+++ b/lib/Target/PowerPC/PPCRegisterInfo.cpp
@@ -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();