diff options
Diffstat (limited to 'include/llvm/Support/PatternMatch.h')
-rw-r--r-- | include/llvm/Support/PatternMatch.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h index 2dfbb182f9..d68c265e9d 100644 --- a/include/llvm/Support/PatternMatch.h +++ b/include/llvm/Support/PatternMatch.h @@ -442,6 +442,26 @@ m_IDiv(const LHS &L, const RHS &R) { } //===----------------------------------------------------------------------===// +// Class that matches exact binary ops. +// +template<typename SubPattern_t> +struct Exact_match { + SubPattern_t SubPattern; + + Exact_match(const SubPattern_t &SP) : SubPattern(SP) {} + + template<typename OpTy> + bool match(OpTy *V) { + if (PossiblyExactOperator *PEO = dyn_cast<PossiblyExactOperator>(V)) + return PEO->isExact() && SubPattern.match(V); + return false; + } +}; + +template<typename T> +inline Exact_match<T> m_Exact(const T &SubPattern) { return SubPattern; } + +//===----------------------------------------------------------------------===// // Matchers for CmpInst classes // |