isStoreToStackSlot
authorAndrew Lenharth <andrewl@lenharth.org>
Fri, 3 Feb 2006 03:07:37 +0000 (03:07 +0000)
committerAndrew Lenharth <andrewl@lenharth.org>
Fri, 3 Feb 2006 03:07:37 +0000 (03:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25925 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Alpha/AlphaInstrInfo.cpp
lib/Target/Alpha/AlphaInstrInfo.h
lib/Target/Alpha/AlphaInstrInfo.td

index c64fe3bee940bdf09fe81ef8f57a8424a51e9e1a..7089f52e4879189a7e3c1e734267d32d243a7ebb 100644 (file)
@@ -61,3 +61,21 @@ AlphaInstrInfo::isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const {
   return 0;
 }
 
+unsigned 
+AlphaInstrInfo::isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const {
+  switch (MI->getOpcode()) {
+  case Alpha::STL:
+  case Alpha::STQ:
+  case Alpha::STB:
+  case Alpha::STW:
+  case Alpha::STS:
+  case Alpha::STT:
+    if (MI->getOperand(1).isFrameIndex()) {
+      FrameIndex = MI->getOperand(1).getFrameIndex();
+      return MI->getOperand(0).getReg();
+    }
+    break;
+  }
+  return 0;
+}
+
index 5211e6fcf5723ce27dbfeb04856ceaec0eeb772b..7eed9effbf1ec87eb538ffc87e6106b8d5ec0cfd 100644 (file)
@@ -37,6 +37,7 @@ public:
                            unsigned &SrcReg, unsigned &DstReg) const;
   
   virtual unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
+  virtual unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const;
 };
 
 }
index 1d86462cd57709e0f40422840645f45e040b4be1..26891bc1713e582e2ee402eee9fa111d091dbe15 100644 (file)
@@ -177,9 +177,7 @@ def CMOVLBSi : OForm4L< 0x11, 0x14, "cmovlbs $RCOND,$RTRUE,$RDEST",
                 [(set GPRC:$RDEST, (select (xor GPRC:$RCOND, 1), GPRC:$RFALSE, immUExt8:$RTRUE))]>;
 
 
-//FIXME: fold setcc with select for all cases.  clearly I need patterns for inverted conditions
-//       and constants (which require inverted conditions as legalize puts the constant in the
-//       wrong field for the instruction definition
+//General pattern for cmov
 def : Pat<(select GPRC:$which, GPRC:$src1, GPRC:$src2),
       (CMOVNE GPRC:$src2, GPRC:$src1, GPRC:$which)>;
 def : Pat<(select GPRC:$which, GPRC:$src1, immUExt8:$src2),