mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 08:17:40 +00:00
PatternMatch: Introduce a matcher for instructions with the "exact" bit. Use it to simplify a few matchers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147403 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -441,6 +441,26 @@ m_IDiv(const LHS &L, const RHS &R) {
|
||||
return BinOp2_match<LHS, RHS, Instruction::SDiv, Instruction::UDiv>(L, 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
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user