aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Support
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-16 04:33:10 +0000
committerChris Lattner <sabre@nondot.org>2008-11-16 04:33:10 +0000
commit67abc10616618b7b7f3ebd873d4903893bf90544 (patch)
tree960f33381792494e949a658693a22f5a5efe673a /include/llvm/Support
parenta6a474dca9b7afd13410833664f76bd6ec4aac04 (diff)
downloadexternal_llvm-67abc10616618b7b7f3ebd873d4903893bf90544.tar.gz
external_llvm-67abc10616618b7b7f3ebd873d4903893bf90544.tar.bz2
external_llvm-67abc10616618b7b7f3ebd873d4903893bf90544.zip
add a new template for matching a select between two constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59391 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support')
-rw-r--r--include/llvm/Support/PatternMatch.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h
index 2408103cb9..f5356a6edd 100644
--- a/include/llvm/Support/PatternMatch.h
+++ b/include/llvm/Support/PatternMatch.h
@@ -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
//