aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-10-11 07:51:25 +0000
committerChris Lattner <sabre@nondot.org>2009-10-11 07:51:25 +0000
commitf7a60d28a1160e314d577847b3e7349235293b7c (patch)
tree1c9c290af5afee2d16291af37d55ed94d4699088 /include/llvm
parent78c552ef309eb8c47d12aac2c0b3af7849c27ce9 (diff)
downloadexternal_llvm-f7a60d28a1160e314d577847b3e7349235293b7c.zip
external_llvm-f7a60d28a1160e314d577847b3e7349235293b7c.tar.gz
external_llvm-f7a60d28a1160e314d577847b3e7349235293b7c.tar.bz2
add a helper for matching "1".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83760 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Support/PatternMatch.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h
index eb393ac..c0b6a6b 100644
--- a/include/llvm/Support/PatternMatch.h
+++ b/include/llvm/Support/PatternMatch.h
@@ -87,6 +87,18 @@ struct zero_ty {
/// m_Zero() - Match an arbitrary zero/null constant.
inline zero_ty m_Zero() { return zero_ty(); }
+struct one_ty {
+ template<typename ITy>
+ bool match(ITy *V) {
+ if (const ConstantInt *C = dyn_cast<ConstantInt>(V))
+ return C->isOne();
+ return false;
+ }
+};
+
+/// m_One() - Match a an integer 1.
+inline one_ty m_One() { return one_ty(); }
+
template<typename Class>
struct bind_ty {