[llvm-commits] CVS: llvm/include/llvm/Support/PatternMatch.h

Chris Lattner lattner at cs.uiuc.edu
Thu Jun 15 12:25:40 PDT 2006



Changes in directory llvm/include/llvm/Support:

PatternMatch.h updated: 1.7 -> 1.8
---
Log message:

Add some more matcher classes for shifts.


---
Diffs of the changes:  (+21 -6)

 PatternMatch.h |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)


Index: llvm/include/llvm/Support/PatternMatch.h
diff -u llvm/include/llvm/Support/PatternMatch.h:1.7 llvm/include/llvm/Support/PatternMatch.h:1.8
--- llvm/include/llvm/Support/PatternMatch.h:1.7	Mon Feb 13 17:06:39 2006
+++ llvm/include/llvm/Support/PatternMatch.h	Thu Jun 15 14:25:28 2006
@@ -68,7 +68,7 @@
 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 @@
 // 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 @@
 };
 
 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






More information about the llvm-commits mailing list