summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit2f28a3cf08df472a349ff5ea4860736e17eb7cea (patch)
tree6418e66b6a2185b77da801254eebe049b675fff9 /llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
parent3e906c48d3e5e7204087331b4a750231e6efd06c (diff)
downloadbcm5719-llvm-2f28a3cf08df472a349ff5ea4860736e17eb7cea.tar.gz
bcm5719-llvm-2f28a3cf08df472a349ff5ea4860736e17eb7cea.zip
Don't spill LR as a callee saved register.
llvm-svn: 34533
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp b/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
index 1dda53a342c..86d17f6fa3c 100644
--- a/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
+++ b/llvm/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();
OpenPOWER on IntegriCloud