diff options
author | Chris Lattner <sabre@nondot.org> | 2009-10-11 07:51:25 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-10-11 07:51:25 +0000 |
commit | f7a60d28a1160e314d577847b3e7349235293b7c (patch) | |
tree | 1c9c290af5afee2d16291af37d55ed94d4699088 /include/llvm | |
parent | 78c552ef309eb8c47d12aac2c0b3af7849c27ce9 (diff) | |
download | external_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.h | 12 |
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 { |