Implement hook for ppc
authorChris Lattner <sabre@nondot.org>
Sat, 17 Sep 2005 01:03:26 +0000 (01:03 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 17 Sep 2005 01:03:26 +0000 (01:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23374 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCRegisterInfo.cpp
lib/Target/PowerPC/PPCRegisterInfo.h

index 6d564b9ba415fd35d919a547d7f2a825ba96da7c..9093381caef76ad302c27817761b6c0d8689b630 100644 (file)
@@ -134,6 +134,22 @@ void PPC32RegisterInfo::copyRegToReg(MachineBasicBlock &MBB,
   }
 }
 
+unsigned PPC32RegisterInfo::isLoadFromStackSlot(MachineInstr *MI, 
+                                                int &FrameIndex) const {
+  switch (MI->getOpcode()) {
+  default: break;
+  case PPC::LWZ:
+  case PPC::LFD:
+    if (MI->getOperand(1).isImmediate() && !MI->getOperand(1).getImmedValue() &&
+        MI->getOperand(2).isFrameIndex()) {
+      FrameIndex = MI->getOperand(2).getFrameIndex();
+      return MI->getOperand(0).getReg();
+    }
+    break;
+  }
+  return 0;
+}
+
 /// foldMemoryOperand - PowerPC (like most RISC's) can only fold spills into
 /// copy instructions, turning them into load/store instructions.
 MachineInstr *PPC32RegisterInfo::foldMemoryOperand(MachineInstr *MI,
index d2745455040e7e49b2079b6e6d5df1e825546fb8..603d1b3dbd712b97e12f3479b9245c0cbb51cebf 100644 (file)
@@ -40,6 +40,8 @@ public:
                     unsigned DestReg, unsigned SrcReg,
                     const TargetRegisterClass *RC) const;
 
+  unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
+    
   /// foldMemoryOperand - PowerPC (like most RISC's) can only fold spills into
   /// copy instructions, turning them into load/store instructions.
   virtual MachineInstr* foldMemoryOperand(MachineInstr* MI, unsigned OpNum,