diff options
author | Chris Lattner <sabre@nondot.org> | 2006-06-15 19:25:28 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-06-15 19:25:28 +0000 |
commit | 1f2d22ab94db71b2f9070a54394956bf64ee83bb (patch) | |
tree | 9d6210399990bd6072c3448bb2cda18c7215c3ad /include/llvm/Support/PatternMatch.h | |
parent | afe91a5f26e205a14dac862d3e9f7c017cc08569 (diff) | |
download | llvm-1f2d22ab94db71b2f9070a54394956bf64ee83bb.tar.gz llvm-1f2d22ab94db71b2f9070a54394956bf64ee83bb.tar.bz2 llvm-1f2d22ab94db71b2f9070a54394956bf64ee83bb.tar.xz |
Add some more matcher classes for shifts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28804 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/PatternMatch.h')
-rw-r--r-- | include/llvm/Support/PatternMatch.h | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h index d15ae9c498..7bf85e1a12 100644 --- a/include/llvm/Support/PatternMatch.h +++ b/include/llvm/Support/PatternMatch.h @@ -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 |