20 #ifndef MLIR_TOOLS_MLIRQUERY_MATCHER_MATCHERSINTERNAL_H
21 #define MLIR_TOOLS_MLIRQUERY_MATCHER_MATCHERSINTERNAL_H
24 #include "llvm/ADT/IntrusiveRefCntPtr.h"
30 :
public llvm::ThreadSafeRefCountedBase<MatcherInterface> {
39 template <
typename MatcherFn>
55 : implementation(implementation) {}
57 template <
typename MatcherFn>
58 static std::unique_ptr<DynMatcher>
60 auto impl = std::make_unique<MatcherFnImpl<MatcherFn>>(matcherFn);
61 return std::make_unique<DynMatcher>(
impl.release());
73 llvm::IntrusiveRefCntPtr<MatcherInterface> implementation;
74 std::string functionName;
Operation is the basic unit of execution within MLIR.
DynMatcher(MatcherInterface *implementation)
bool match(Operation *op) const
static std::unique_ptr< DynMatcher > constructDynMatcherFromMatcherFn(MatcherFn &matcherFn)
StringRef getFunctionName() const
bool hasFunctionName() const
void setFunctionName(StringRef name)
MatcherFnImpl(MatcherFn &matcherFn)
bool match(Operation *op) override
virtual ~MatcherInterface()=default
virtual bool match(Operation *op)=0