[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.h PPCRegisterInfo.cpp PPCRegisterInfo.h

Jim Laskey jlaskey at apple.com
Fri Feb 23 12:34:33 PST 2007



Changes in directory llvm/lib/Target/PowerPC:

PPCMachineFunctionInfo.h updated: 1.2 -> 1.3
PPCRegisterInfo.cpp updated: 1.110 -> 1.111
PPCRegisterInfo.h updated: 1.28 -> 1.29
---
Log message:

Don't spill LR as a callee saved register.

---
Diffs of the changes:  (+19 -2)

 PPCMachineFunctionInfo.h |    7 +++++++
 PPCRegisterInfo.cpp      |   13 +++++++++++--
 PPCRegisterInfo.h        |    1 +
 3 files changed, 19 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.h
diff -u llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.h:1.2 llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.h:1.3
--- llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.h:1.2	Fri Nov 24 23:41:02 2006
+++ llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.h	Fri Feb 23 14:34:16 2007
@@ -26,6 +26,10 @@
   /// 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 @@
 
   int getFramePointerSaveIndex() const { return FramePointerSaveIndex; }
   void setFramePointerSaveIndex(int Idx) { FramePointerSaveIndex = Idx; }
+  
+  void setUsesLR(bool U) { UsesLR = U; }
+  bool usesLR()          { return UsesLR; }
 
 };
 


Index: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.110 llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.111
--- llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.110	Thu Feb 22 19:10:03 2007
+++ llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp	Fri Feb 23 14:34:16 2007
@@ -439,8 +439,8 @@
 /// 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 @@
   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();


Index: llvm/lib/Target/PowerPC/PPCRegisterInfo.h
diff -u llvm/lib/Target/PowerPC/PPCRegisterInfo.h:1.28 llvm/lib/Target/PowerPC/PPCRegisterInfo.h:1.29
--- llvm/lib/Target/PowerPC/PPCRegisterInfo.h:1.28	Wed Feb 21 16:54:50 2007
+++ llvm/lib/Target/PowerPC/PPCRegisterInfo.h	Fri Feb 23 14:34:16 2007
@@ -82,6 +82,7 @@
   /// frame size.
   void determineFrameLayout(MachineFunction &MF) const;
 
+  void processFunctionBeforeCalleeSavedScan(MachineFunction &MF) const;
   void emitPrologue(MachineFunction &MF) const;
   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
 






More information about the llvm-commits mailing list