MLIR
21.0.0git
|
A class that provides utilities to find operations in the IR. More...
#include "mlir/Query/Matcher/MatchFinder.h"
Classes | |
struct | MatchResult |
A subclass which preserves the matching information. More... | |
Public Member Functions | |
std::vector< MatchResult > | collectMatches (Operation *root, DynMatcher matcher) const |
Traverses the IR and returns a vector of MatchResult for each match of the matcher . More... | |
void | printMatch (llvm::raw_ostream &os, QuerySession &qs, Operation *op) const |
Prints the matched operation. More... | |
void | printMatch (llvm::raw_ostream &os, QuerySession &qs, Operation *op, const std::string &binding) const |
Labels the matched operation with the given binding (e.g., "root" ) and prints it. More... | |
std::vector< Operation * > | flattenMatchedOps (std::vector< MatchResult > &matches) const |
Flattens a vector of MatchResult into a vector of operations. More... | |
A class that provides utilities to find operations in the IR.
Definition at line 25 of file MatchFinder.h.
std::vector< MatchFinder::MatchResult > mlir::query::matcher::MatchFinder::collectMatches | ( | Operation * | root, |
DynMatcher | matcher | ||
) | const |
Traverses the IR and returns a vector of MatchResult
for each match of the matcher
.
Definition at line 21 of file MatchFinder.cpp.
References mlir::query::matcher::DynMatcher::match(), and mlir::Operation::walk().
Referenced by mlir::query::MatchQuery::run().
std::vector< Operation * > mlir::query::matcher::MatchFinder::flattenMatchedOps | ( | std::vector< MatchResult > & | matches | ) | const |
Flattens a vector of MatchResult
into a vector of operations.
Definition at line 59 of file MatchFinder.cpp.
Referenced by mlir::query::MatchQuery::run().
void mlir::query::matcher::MatchFinder::printMatch | ( | llvm::raw_ostream & | os, |
QuerySession & | qs, | ||
Operation * | op | ||
) | const |
Prints the matched operation.
Definition at line 39 of file MatchFinder.cpp.
References diag(), mlir::query::QuerySession::getBufferId(), mlir::Operation::getLoc(), and mlir::query::QuerySession::getSourceManager().
Referenced by mlir::query::MatchQuery::run().
void mlir::query::matcher::MatchFinder::printMatch | ( | llvm::raw_ostream & | os, |
QuerySession & | qs, | ||
Operation * | op, | ||
const std::string & | binding | ||
) | const |
Labels the matched operation with the given binding (e.g., "root"
) and prints it.
Definition at line 49 of file MatchFinder.cpp.
References mlir::query::QuerySession::getBufferId(), mlir::Operation::getLoc(), and mlir::query::QuerySession::getSourceManager().