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

Chris Lattner lattner at cs.uiuc.edu
Thu Feb 2 12:16:24 PST 2006



Changes in directory llvm/lib/Target/PowerPC:

PPCInstrInfo.cpp updated: 1.14 -> 1.15
PPCInstrInfo.h updated: 1.10 -> 1.11
---
Log message:

implement isStoreToStackSlot for PPC


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

 PPCInstrInfo.cpp |   19 ++++++++++++++++++-
 PPCInstrInfo.h   |    1 +
 2 files changed, 19 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.14 llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.15
--- llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.14	Thu Feb  2 14:12:32 2006
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.cpp	Thu Feb  2 14:16:12 2006
@@ -95,8 +95,25 @@
     break;
   }
   return 0;
-                                              }
+}
 
+unsigned PPCInstrInfo::isStoreToStackSlot(MachineInstr *MI, 
+                                          int &FrameIndex) const {
+  switch (MI->getOpcode()) {
+  default: break;
+  //case PPC::ST:  ?
+  case PPC::STW:
+  case PPC::STFS:
+  case PPC::STFD:
+    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;
+}
 
 // commuteInstruction - We can commute rlwimi instructions, but only if the
 // rotate amt is zero.  We also have to munge the immediates a bit.


Index: llvm/lib/Target/PowerPC/PPCInstrInfo.h
diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.h:1.10 llvm/lib/Target/PowerPC/PPCInstrInfo.h:1.11
--- llvm/lib/Target/PowerPC/PPCInstrInfo.h:1.10	Thu Feb  2 14:12:32 2006
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.h	Thu Feb  2 14:16:12 2006
@@ -40,6 +40,7 @@
                            unsigned& destReg) const;
 
   unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
+  unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const;
 
   // commuteInstruction - We can commute rlwimi instructions, but only if the
   // rotate amt is zero.  We also have to munge the immediates a bit.






More information about the llvm-commits mailing list