add a helper for matching "1".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83760 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-10-11 07:51:25 +00:00
parent 78c552ef30
commit f7a60d28a1

View File

@ -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 {