9 #ifndef MLIR_DIALECT_AFFINE_ANALYSIS_NESTEDMATCHER_H
10 #define MLIR_DIALECT_AFFINE_ANALYSIS_NESTEDMATCHER_H
14 #include "llvm/Support/Allocator.h"
54 explicit operator bool() {
return matchedOperation !=
nullptr; }
64 static llvm::BumpPtrAllocator *&allocator();
109 op->
walk([&](
Operation *child) { matchOne(child, matches); });
128 static llvm::BumpPtrAllocator *&allocator();
162 assert(NestedMatch::allocator() ==
nullptr &&
163 "Only a single NestedPatternContext is supported");
164 assert(NestedPattern::allocator() ==
nullptr &&
165 "Only a single NestedPatternContext is supported");
170 NestedMatch::allocator() =
nullptr;
171 NestedPattern::allocator() =
nullptr;
Operation is the basic unit of execution within MLIR.
std::enable_if_t< llvm::function_traits< std::decay_t< FnT > >::num_args==1, RetT > walk(FnT &&callback)
Walk the operation by calling the callback for each nested operation (including this one),...
An NestedPattern captures nested patterns in the IR.
Operation * getMatchedOperation() const
NestedMatch(const NestedMatch &)=default
NestedMatch & operator=(const NestedMatch &)=default
ArrayRef< NestedMatch > getMatchedChildren()
static NestedMatch build(Operation *operation, ArrayRef< NestedMatch > nestedMatches)
RAII structure to transparently manage the bump allocator for NestedPattern and NestedMatch classes.
llvm::BumpPtrAllocator allocator
void match(Operation *op, SmallVectorImpl< NestedMatch > *matches)
Returns all the top-level matches in op.
unsigned getDepth() const
Returns the depth of the pattern.
NestedPattern & operator=(const NestedPattern &other)
NestedPattern(ArrayRef< NestedPattern > nested, FilterFunctionType filter=defaultFilterFunction)
NestedPattern If(const NestedPattern &child)
bool isParallelLoop(Operation &op)
NestedPattern For(const NestedPattern &child)
bool isLoadOrStore(Operation &op)
bool isReductionLoop(Operation &op)
NestedPattern Op(FilterFunctionType filter=defaultFilterFunction)
std::function< bool(Operation &)> FilterFunctionType
A NestedPattern is a nested operation walker that:
bool defaultFilterFunction(Operation &)
Include the generated interface declarations.