[llvm-commits] [llvm] r59391 - /llvm/trunk/include/llvm/Support/PatternMatch.h

Chris Lattner sabre at nondot.org
Sat Nov 15 20:33:10 PST 2008


Author: lattner
Date: Sat Nov 15 22:33:10 2008
New Revision: 59391

URL: http://llvm.org/viewvc/llvm-project?rev=59391&view=rev
Log:
add a new template for matching a select between two constants.

Modified:
    llvm/trunk/include/llvm/Support/PatternMatch.h

Modified: llvm/trunk/include/llvm/Support/PatternMatch.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PatternMatch.h?rev=59391&r1=59390&r2=59391&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/PatternMatch.h (original)
+++ llvm/trunk/include/llvm/Support/PatternMatch.h Sat Nov 15 22:33:10 2008
@@ -367,6 +367,17 @@
   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
 //





More information about the llvm-commits mailing list