add a new template for matching a select between two constants.
authorChris Lattner <sabre@nondot.org>
Sun, 16 Nov 2008 04:33:10 +0000 (04:33 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 16 Nov 2008 04:33:10 +0000 (04:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59391 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/PatternMatch.h

index 2408103cb942c6dcf4d3d2d0dc8e4076f19f6980..f5356a6edd2540eae6312eb9b29780be54c63923 100644 (file)
@@ -367,6 +367,17 @@ m_Select(const Cond &C, const LHS &L, const RHS &R) {
   return SelectClass_match<Cond, LHS, RHS>(C, L, R);
 }
 
+/// m_SelectCst - This matches a select of two constants, e.g.:
+///    m_SelectCst(m_Value(V), -1, 0)
+template<typename Cond>
+inline SelectClass_match<Cond, constantint_ty, constantint_ty>
+m_SelectCst(const Cond &C, int64_t L, int64_t R) {
+  return SelectClass_match<Cond, constantint_ty, 
+                           constantint_ty>(C, m_ConstantInt(L),
+                                           m_ConstantInt(R));
+}
+
+
 //===----------------------------------------------------------------------===//
 // Matchers for CastInst classes
 //