-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);
+inline CmpClass_match<LHS, RHS, ICmpInst, ICmpInst::Predicate>
+m_ICmp(ICmpInst::Predicate &Pred, const LHS &L, const RHS &R) {
+ return CmpClass_match<LHS, RHS,
+ ICmpInst, ICmpInst::Predicate>(Pred, L, R);
+}
+
+template<typename LHS, typename RHS>
+inline CmpClass_match<LHS, RHS, FCmpInst, FCmpInst::Predicate>
+m_FCmp(FCmpInst::Predicate &Pred, const LHS &L, const RHS &R) {
+ return CmpClass_match<LHS, RHS,
+ FCmpInst, FCmpInst::Predicate>(Pred, L, R);
+}
+
+//===----------------------------------------------------------------------===//
+// Matchers for SelectInst classes
+//
+
+template<typename Cond_t, typename LHS_t, typename RHS_t>
+struct SelectClass_match {
+ Cond_t C;
+ LHS_t L;
+ RHS_t R;
+
+ SelectClass_match(const Cond_t &Cond, const LHS_t &LHS,
+ const RHS_t &RHS)
+ : C(Cond), L(LHS), R(RHS) {}
+
+ template<typename OpTy>
+ bool match(OpTy *V) {
+ if (SelectInst *I = dyn_cast<SelectInst>(V))
+ return C.match(I->getOperand(0)) &&
+ L.match(I->getOperand(1)) &&
+ R.match(I->getOperand(2));
+ return false;
+ }
+};
+
+template<typename Cond, typename LHS, typename RHS>
+inline SelectClass_match<Cond, RHS, LHS>
+m_Select(const Cond &C, const LHS &L, const RHS &R) {
+ return SelectClass_match<Cond, LHS, RHS>(C, L, R);