20std::vector<MatchFinder::MatchResult>
22 std::vector<MatchResult> results;
29 results.push_back(std::move(match));
30 }
else if (
matcher.match(subOp, tempStorage)) {
31 results.emplace_back(subOp, std::vector<Operation *>(tempStorage.begin(),
43 qs.
getBufferId(), fileLoc.getLine(), fileLoc.getColumn());
44 llvm::SMDiagnostic
diag =
46 diag.print(
"", os,
true,
false,
true);
51 Operation *op,
const std::string &binding)
const {
54 qs.
getBufferId(), fileLoc.getLine(), fileLoc.getColumn());
56 "\"" + binding +
"\" binds here");
60std::vector<Operation *>
62 std::vector<Operation *> newVector;
63 for (
auto &
result : matches) {
64 newVector.insert(newVector.end(),
result.matchedOps.begin(),
static std::string diag(const llvm::Value &value)
An instance of this location represents a tuple of file, line number, and column number.
T findInstanceOf()
Return an instance of the given location type if one is nested under the current location.
Operation is the basic unit of execution within MLIR.
Location getLoc()
The source location the operation was defined or derived from.
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),...
llvm::SourceMgr & getSourceManager() const
void printMatch(llvm::raw_ostream &os, QuerySession &qs, Operation *op) const
Prints the matched operation.
std::vector< MatchResult > collectMatches(Operation *root, DynMatcher matcher) const
Traverses the IR and returns a vector of MatchResult for each match of the matcher.
std::vector< Operation * > flattenMatchedOps(std::vector< MatchResult > &matches) const
Flattens a vector of MatchResult into a vector of operations.
Computes the backward-slice of all transitive defs reachable from rootOp, if innerMatcher matches.
A subclass which preserves the matching information.
std::vector< Operation * > matchedOps
Contains the matching environment.