Add some more matcher classes for shifts.
authorChris Lattner <sabre@nondot.org>
Thu, 15 Jun 2006 19:25:28 +0000 (19:25 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 15 Jun 2006 19:25:28 +0000 (19:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28804 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/PatternMatch.h

index d15ae9c498663f1320be340cc12c7a08e7677cd0..7bf85e1a128a9cb2223d2496cb4b42c67c0a4992 100644 (file)
@@ -68,7 +68,7 @@ inline bind_ty<Value> m_Value(Value *&V) { return V; }
 inline bind_ty<ConstantInt> m_ConstantInt(ConstantInt *&CI) { return CI; }
 
 //===----------------------------------------------------------------------===//
-// Matchers for specific binary operators
+// Matchers for specific binary operators.
 //
 
 template<typename LHS_t, typename RHS_t, 
@@ -157,13 +157,13 @@ inline BinaryOp_match<LHS, RHS, Instruction::Shr,
 // Matchers for binary classes
 //
 
-template<typename LHS_t, typename RHS_t, typename Class>
+template<typename LHS_t, typename RHS_t, typename Class, typename OpcType>
 struct BinaryOpClass_match {
-  Instruction::BinaryOps &Opcode;
+  OpcType &Opcode;
   LHS_t L;
   RHS_t R;
 
-  BinaryOpClass_match(Instruction::BinaryOps &Op, const LHS_t &LHS,
+  BinaryOpClass_match(OpcType &Op, const LHS_t &LHS,
                       const RHS_t &RHS)
     : Opcode(Op), L(LHS), R(RHS) {}
 
@@ -184,11 +184,26 @@ struct BinaryOpClass_match {
 };
 
 template<typename LHS, typename RHS>
-inline BinaryOpClass_match<LHS, RHS, SetCondInst>
+inline BinaryOpClass_match<LHS, RHS, SetCondInst, Instruction::BinaryOps>
 m_SetCond(Instruction::BinaryOps &Op, const LHS &L, const RHS &R) {
-  return BinaryOpClass_match<LHS, RHS, SetCondInst>(Op, L, R);
+  return BinaryOpClass_match<LHS, RHS, 
+                             SetCondInst, Instruction::BinaryOps>(Op, L, R);
 }
 
+template<typename LHS, typename RHS>
+inline BinaryOpClass_match<LHS, RHS, ShiftInst, Instruction::OtherOps>
+m_Shift(Instruction::OtherOps &Op, const LHS &L, const RHS &R) {
+  return BinaryOpClass_match<LHS, RHS, 
+                             ShiftInst, Instruction::OtherOps>(Op, L, R);
+}
+
+template<typename LHS, typename RHS>
+inline BinaryOpClass_match<LHS, RHS, ShiftInst, Instruction::OtherOps>
+m_Shift(const LHS &L, const RHS &R) {
+  Instruction::OtherOps Op; 
+  return BinaryOpClass_match<LHS, RHS, 
+                             ShiftInst, Instruction::OtherOps>(Op, L, R);
+}
 
 //===----------------------------------------------------------------------===//
 // Matchers for unary operators