summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-06-15 19:25:28 +0000
committerChris Lattner <sabre@nondot.org>2006-06-15 19:25:28 +0000
commit9d343d27996b0b8e1ca83de82edaf433d212d124 (patch)
treefecb004f0ac43dba4658718066199d35cd07fad2
parentc482a9e31a1bcb4f948da340a8e53e247f1dad0b (diff)
downloadbcm5719-llvm-9d343d27996b0b8e1ca83de82edaf433d212d124.tar.gz
bcm5719-llvm-9d343d27996b0b8e1ca83de82edaf433d212d124.zip
Add some more matcher classes for shifts.
llvm-svn: 28804
-rw-r--r--llvm/include/llvm/Support/PatternMatch.h27
1 files changed, 21 insertions, 6 deletions
diff --git a/llvm/include/llvm/Support/PatternMatch.h b/llvm/include/llvm/Support/PatternMatch.h
index d15ae9c4986..7bf85e1a128 100644
--- a/llvm/include/llvm/Support/PatternMatch.h
+++ b/llvm/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
OpenPOWER on IntegriCloud