MLIR
20.0.0git
|
This class represents a pass manager that runs passes on either a specific operation type, or any isolated operation. More...
#include "mlir/Pass/PassManager.h"
Public Types | |
enum class | Nesting { Implicit , Explicit } |
This enum represents the nesting behavior of the pass manager. More... | |
using | pass_iterator = llvm::pointee_iterator< MutableArrayRef< std::unique_ptr< Pass > >::iterator > |
Iterator over the passes in this pass manager. More... | |
using | const_pass_iterator = llvm::pointee_iterator< ArrayRef< std::unique_ptr< Pass > >::const_iterator > |
Public Member Functions | |
OpPassManager (Nesting nesting=Nesting::Explicit) | |
Construct a new op-agnostic ("any") pass manager with the given operation type and nesting behavior. More... | |
OpPassManager (StringRef name, Nesting nesting=Nesting::Explicit) | |
Construct a new pass manager with the given anchor operation type and nesting behavior. More... | |
OpPassManager (OperationName name, Nesting nesting=Nesting::Explicit) | |
OpPassManager (OpPassManager &&rhs) | |
OpPassManager (const OpPassManager &rhs) | |
~OpPassManager () | |
OpPassManager & | operator= (const OpPassManager &rhs) |
OpPassManager & | operator= (OpPassManager &&rhs) |
pass_iterator | begin () |
pass_iterator | end () |
iterator_range< pass_iterator > | getPasses () |
const_pass_iterator | begin () const |
const_pass_iterator | end () const |
iterator_range< const_pass_iterator > | getPasses () const |
bool | empty () const |
Returns true if the pass manager has no passes. More... | |
OpPassManager & | nest (OperationName nestedName) |
Nest a new operation pass manager for the given operation kind under this pass manager. More... | |
OpPassManager & | nest (StringRef nestedName) |
template<typename OpT > | |
OpPassManager & | nest () |
OpPassManager & | nestAny () |
Nest a new op-agnostic ("any") pass manager under this pass manager. More... | |
void | addPass (std::unique_ptr< Pass > pass) |
Add the given pass to this pass manager. More... | |
void | clear () |
Clear the pipeline, but not the other options set on this OpPassManager. More... | |
template<typename OpT > | |
void | addNestedPass (std::unique_ptr< Pass > pass) |
Add the given pass to a nested pass manager for the given operation kind OpT . More... | |
size_t | size () const |
Returns the number of passes held by this manager. More... | |
std::optional< OperationName > | getOpName (MLIRContext &context) const |
Return the operation name that this pass manager operates on, or std::nullopt if this is an op-agnostic pass manager. More... | |
std::optional< StringRef > | getOpName () const |
Return the operation name that this pass manager operates on, or std::nullopt if this is an op-agnostic pass manager. More... | |
StringRef | getOpAnchorName () const |
Return the name used to anchor this pass manager. More... | |
detail::OpPassManagerImpl & | getImpl () |
Returns the internal implementation instance. More... | |
void | printAsTextualPipeline (raw_ostream &os) const |
Prints out the passes of the pass manager as the textual representation of pipelines. More... | |
void | dump () |
Raw dump of the pass manager to llvm::errs(). More... | |
void | mergeStatisticsInto (OpPassManager &other) |
Merge the pass statistics of this class into 'other'. More... | |
void | getDependentDialects (DialectRegistry &dialects) const |
Register dependent dialects for the current pass manager. More... | |
void | setNesting (Nesting nesting) |
Enable or disable the implicit nesting on this particular PassManager. More... | |
Nesting | getNesting () |
Return the current nesting mode. More... | |
Static Public Member Functions | |
static StringRef | getAnyOpAnchorName () |
Return the string name used to anchor op-agnostic pass managers that operate generically on any viable operation. More... | |
Friends | |
class | PassManager |
Allow access to the constructor. More... | |
class | Pass |
This class represents a pass manager that runs passes on either a specific operation type, or any isolated operation.
This pass manager can not be run on an operation directly, but must be run either as part of a top-level PassManager
(e.g. when constructed via nest
calls), or dynamically within a pass by using the Pass::runPipeline
API.
Definition at line 47 of file PassManager.h.
using mlir::OpPassManager::const_pass_iterator = llvm::pointee_iterator<ArrayRef<std::unique_ptr<Pass> >::const_iterator> |
Definition at line 82 of file PassManager.h.
using mlir::OpPassManager::pass_iterator = llvm::pointee_iterator<MutableArrayRef<std::unique_ptr<Pass> >::iterator> |
Iterator over the passes in this pass manager.
Definition at line 76 of file PassManager.h.
|
strong |
This enum represents the nesting behavior of the pass manager.
Definition at line 50 of file PassManager.h.
OpPassManager::OpPassManager | ( | Nesting | nesting = Nesting::Explicit | ) |
OpPassManager::OpPassManager | ( | StringRef | name, |
Nesting | nesting = Nesting::Explicit |
||
) |
OpPassManager::OpPassManager | ( | OperationName | name, |
Nesting | nesting = Nesting::Explicit |
||
) |
OpPassManager::OpPassManager | ( | OpPassManager && | rhs | ) |
OpPassManager::OpPassManager | ( | const OpPassManager & | rhs | ) |
|
default |
|
inline |
Add the given pass to a nested pass manager for the given operation kind OpT
.
Definition at line 116 of file PassManager.h.
Referenced by mlir::tosa::addTosaToLinalgPasses(), mlir::tosa::addTosaToSCFPasses(), mlir::sparse_tensor::buildSparsifier(), and mlir::sparse_tensor::SparsificationAndBufferizationPass::runOnOperation().
void OpPassManager::addPass | ( | std::unique_ptr< Pass > | pass | ) |
Add the given pass to this pass manager.
If this pass has a concrete operation type, it must be the same type as this pass manager.
Definition at line 363 of file Pass.cpp.
Referenced by mlir::tosa::addTosaToLinalgPasses(), mlir::bufferization::buildBufferDeallocationPipeline(), buildDefaultRegistryFn(), mlir::sparse_tensor::buildSparsifier(), defaultInlinerOptPipeline(), and mlir::sparse_tensor::SparsificationAndBufferizationPass::runOnOperation().
OpPassManager::pass_iterator OpPassManager::begin | ( | ) |
Definition at line 337 of file Pass.cpp.
Referenced by empty(), and getPasses().
OpPassManager::const_pass_iterator OpPassManager::begin | ( | ) | const |
void OpPassManager::clear | ( | ) |
Clear the pipeline, but not the other options set on this OpPassManager.
void OpPassManager::dump | ( | ) |
Raw dump of the pass manager to llvm::errs().
Definition at line 409 of file Pass.cpp.
References printAsTextualPipeline().
|
inline |
Returns true if the pass manager has no passes.
Definition at line 91 of file PassManager.h.
OpPassManager::pass_iterator OpPassManager::end | ( | ) |
Definition at line 340 of file Pass.cpp.
Referenced by empty(), and getPasses().
OpPassManager::const_pass_iterator OpPassManager::end | ( | ) | const |
|
inlinestatic |
Return the string name used to anchor op-agnostic pass managers that operate generically on any viable operation.
Definition at line 138 of file PassManager.h.
Referenced by mlir::detail::OpPassManagerImpl::getOpAnchorName(), and performActions().
void OpPassManager::getDependentDialects | ( | DialectRegistry & | dialects | ) | const |
Register dependent dialects for the current pass manager.
This is forwarding to every pass in this PassManager, see the documentation for the same method on the Pass class.
Definition at line 421 of file Pass.cpp.
References registerDialectsForPipeline().
Referenced by mlir::detail::OpToOpPassAdaptor::getDependentDialects(), and mlir::PassManager::run().
OpPassManagerImpl & OpPassManager::getImpl | ( | ) |
Returns the internal implementation instance.
Definition at line 373 of file Pass.cpp.
Referenced by findPassManagerFor(), mlir::PassManager::run(), and mlir::detail::OpToOpPassAdaptor::tryMergeInto().
OpPassManager::Nesting OpPassManager::getNesting | ( | ) |
Return the current nesting mode.
Definition at line 427 of file Pass.cpp.
Referenced by buildDefaultRegistryFn().
StringRef OpPassManager::getOpAnchorName | ( | ) | const |
Return the name used to anchor this pass manager.
This is either the name of an operation, or the result of getAnyOpAnchorName()
in the case of an op-agnostic pass manager.
Definition at line 386 of file Pass.cpp.
Referenced by buildDefaultRegistryFn(), findPassManagerWithAnchor(), mlir::detail::OpToOpPassAdaptor::getAdaptorName(), printAsTextualPipeline(), mlir::PassManager::run(), and mlir::detail::OpToOpPassAdaptor::tryMergeInto().
std::optional< StringRef > OpPassManager::getOpName | ( | ) | const |
Return the operation name that this pass manager operates on, or std::nullopt if this is an op-agnostic pass manager.
Return the operation name that this pass manager operates on.
Definition at line 376 of file Pass.cpp.
Referenced by mlir::PassManager::run().
std::optional< OperationName > OpPassManager::getOpName | ( | MLIRContext & | context | ) | const |
Return the operation name that this pass manager operates on, or std::nullopt if this is an op-agnostic pass manager.
Return the operation name that this pass manager operates on.
Definition at line 382 of file Pass.cpp.
Referenced by buildDefaultRegistryFn(), and mlir::detail::OpToOpPassAdaptor::tryMergeInto().
|
inline |
Definition at line 80 of file PassManager.h.
References begin(), and end().
Referenced by mergeStatisticsInto(), performActions(), prepareStatistics(), printResultsAsList(), printResultsAsPipeline(), and registerDialectsForPipeline().
|
inline |
Definition at line 86 of file PassManager.h.
void OpPassManager::mergeStatisticsInto | ( | OpPassManager & | other | ) |
Merge the pass statistics of this class into 'other'.
Definition at line 194 of file PassStatistics.cpp.
References getPasses().
|
inline |
Definition at line 98 of file PassManager.h.
OpPassManager & OpPassManager::nest | ( | OperationName | nestedName | ) |
OpPassManager & OpPassManager::nest | ( | StringRef | nestedName | ) |
OpPassManager & OpPassManager::nestAny | ( | ) |
OpPassManager & OpPassManager::operator= | ( | const OpPassManager & | rhs | ) |
OpPassManager & OpPassManager::operator= | ( | OpPassManager && | rhs | ) |
void OpPassManager::printAsTextualPipeline | ( | raw_ostream & | os | ) | const |
Prints out the passes of the pass manager as the textual representation of pipelines.
Note: The quality of the string representation depends entirely on the the correctness of per-pass overrides of Pass::printAsTextualPipeline.
Definition at line 401 of file Pass.cpp.
References getOpAnchorName().
Referenced by dump().
void OpPassManager::setNesting | ( | Nesting | nesting | ) |
Enable or disable the implicit nesting on this particular PassManager.
This will also apply to any newly nested PassManager built from this instance.
size_t OpPassManager::size | ( | ) | const |
Definition at line 186 of file PassManager.h.
|
friend |
Allow access to the constructor.
Definition at line 185 of file PassManager.h.
Referenced by mlir::PassManager::on().