[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32RegisterInfo.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Aug 26 14:49:29 PDT 2005



Changes in directory llvm/lib/Target/PowerPC:

PPC32RegisterInfo.cpp updated: 1.18 -> 1.19
---
Log message:

Minor cleanups:
  * avoid calling getClass() multiple times (it is relatively expensive)
  * Allow -disable-fp-elim to turn of frame pointer elimination.


---
Diffs of the changes:  (+8 -7)

 PPC32RegisterInfo.cpp |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)


Index: llvm/lib/Target/PowerPC/PPC32RegisterInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPC32RegisterInfo.cpp:1.18 llvm/lib/Target/PowerPC/PPC32RegisterInfo.cpp:1.19
--- llvm/lib/Target/PowerPC/PPC32RegisterInfo.cpp:1.18	Fri Aug 19 13:30:39 2005
+++ llvm/lib/Target/PowerPC/PPC32RegisterInfo.cpp	Fri Aug 26 16:49:18 2005
@@ -81,11 +81,12 @@
   static const unsigned Opcode[] = {
     PPC::STB, PPC::STH, PPC::STW, PPC::STFS, PPC::STFD
   };
-  unsigned OC = Opcode[getIdx(getClass(SrcReg))];
+  const TargetRegisterClass *RegClass = getClass(SrcReg);
+  unsigned OC = Opcode[getIdx(RegClass)];
   if (SrcReg == PPC::LR) {
     BuildMI(MBB, MI, PPC::MFLR, 1, PPC::R11);
     addFrameReference(BuildMI(MBB, MI, OC, 3).addReg(PPC::R11),FrameIdx);
-  } else if (PPC32::CRRCRegisterClass == getClass(SrcReg)) {
+  } else if (RegClass == PPC32::CRRCRegisterClass) {
     BuildMI(MBB, MI, PPC::MFCR, 0, PPC::R11);
     addFrameReference(BuildMI(MBB, MI, OC, 3).addReg(PPC::R11),FrameIdx);
   } else {
@@ -96,15 +97,16 @@
 void
 PPC32RegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
                                         MachineBasicBlock::iterator MI,
-                                        unsigned DestReg, int FrameIdx) const{
+                                        unsigned DestReg, int FrameIdx) const {
   static const unsigned Opcode[] = {
     PPC::LBZ, PPC::LHZ, PPC::LWZ, PPC::LFS, PPC::LFD
   };
-  unsigned OC = Opcode[getIdx(getClass(DestReg))];
+  const TargetRegisterClass *RegClass = getClass(SrcReg);
+  unsigned OC = Opcode[getIdx(RegClass)];
   if (DestReg == PPC::LR) {
     addFrameReference(BuildMI(MBB, MI, OC, 2, PPC::R11), FrameIdx);
     BuildMI(MBB, MI, PPC::MTLR, 1).addReg(PPC::R11);
-  } else if (PPC32::CRRCRegisterClass == getClass(DestReg)) {
+  } else if (RegClass == PPC32::CRRCRegisterClass) {
     addFrameReference(BuildMI(MBB, MI, OC, 2, PPC::R11), FrameIdx);
     BuildMI(MBB, MI, PPC::MTCRF, 1, DestReg).addReg(PPC::R11);
   } else {
@@ -139,8 +141,7 @@
 // if frame pointer elimination is disabled.
 //
 static bool hasFP(MachineFunction &MF) {
-  MachineFrameInfo *MFI = MF.getFrameInfo();
-  return MFI->hasVarSizedObjects();
+  return NoFramePointerElim || MF.getFrameInfo()->hasVarSizedObjects();
 }
 
 void PPC32RegisterInfo::






More information about the llvm-commits mailing list