From f7a60d28a1160e314d577847b3e7349235293b7c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 11 Oct 2009 07:51:25 +0000 Subject: [PATCH] add a helper for matching "1". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83760 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/PatternMatch.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h index eb393ac4c3e..c0b6a6b98c0 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 + bool match(ITy *V) { + if (const ConstantInt *C = dyn_cast(V)) + return C->isOne(); + return false; + } +}; + +/// m_One() - Match a an integer 1. +inline one_ty m_One() { return one_ty(); } + template struct bind_ty {