MLIR  21.0.0git
Classes | Public Member Functions | List of all members
mlir::query::matcher::MatchFinder Class Reference

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< MatchResultcollectMatches (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...
 

Detailed Description

A class that provides utilities to find operations in the IR.

Definition at line 25 of file MatchFinder.h.

Member Function Documentation

◆ collectMatches()

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().

◆ flattenMatchedOps()

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().

◆ printMatch() [1/2]

void mlir::query::matcher::MatchFinder::printMatch ( llvm::raw_ostream &  os,
QuerySession qs,
Operation op 
) const

◆ printMatch() [2/2]

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().


The documentation for this class was generated from the following files: