My Project
Classes | Public Member Functions | List of all members
mlir::PassManager Class Reference

The main pass manager and pipeline builder. More...

#include <PassManager.h>

Inheritance diagram for mlir::PassManager:
Inheritance graph
[legend]
Collaboration diagram for mlir::PassManager:
Collaboration graph
[legend]

Classes

class  IRPrinterConfig
 A configuration struct provided to the IR printer instrumentation. More...
 

Public Member Functions

 PassManager (MLIRContext *ctx, bool verifyPasses=true)
 
 ~PassManager ()
 
LLVM_NODISCARD LogicalResult run (ModuleOp module)
 Run the passes within this manager on the provided module. More...
 
void disableMultithreading (bool disable=true)
 Disable support for multi-threading within the pass manager. More...
 
void enableCrashReproducerGeneration (StringRef outputFile)
 
void addInstrumentation (std::unique_ptr< PassInstrumentation > pi)
 Add the provided instrumentation to the pass manager. More...
 
void enableIRPrinting (std::unique_ptr< IRPrinterConfig > config)
 
void enableIRPrinting (std::function< bool(Pass *, Operation *)> shouldPrintBeforePass, std::function< bool(Pass *, Operation *)> shouldPrintAfterPass, bool printModuleScope, bool printAfterOnlyOnChange, raw_ostream &out)
 Add an instrumentation to print the IR before and after pass execution. More...
 
void enableTiming (PassDisplayMode displayMode=PassDisplayMode::Pipeline)
 
void enableStatistics (PassDisplayMode displayMode=PassDisplayMode::Pipeline)
 Dump the statistics for each pass after running. More...
 
- Public Member Functions inherited from mlir::OpPassManager
 OpPassManager (OpPassManager &&rhs)
 
 OpPassManager (const OpPassManager &rhs)
 
 ~OpPassManager ()
 
OpPassManageroperator= (const OpPassManager &rhs)
 
pass_iterator begin ()
 
pass_iterator end ()
 
iterator_range< pass_iteratorgetPasses ()
 
LogicalResult run (Operation *op, AnalysisManager am)
 Run the held passes over the given operation. More...
 
OpPassManagernest (const OperationName &nestedName)
 
OpPassManagernest (StringRef nestedName)
 
template<typename OpT >
OpPassManagernest ()
 
void addPass (std::unique_ptr< Pass > pass)
 
template<typename OpT >
void addNestedPass (std::unique_ptr< Pass > pass)
 
size_t size () const
 Returns the number of passes held by this manager. More...
 
MLIRContextgetContext () const
 Return an instance of the context. More...
 
const OperationNamegetOpName () const
 Return the operation name that this pass manager operates on. More...
 
detail::OpPassManagerImplgetImpl ()
 Returns the internal implementation instance. More...
 
void printAsTextualPipeline (raw_ostream &os)
 
void mergeStatisticsInto (OpPassManager &other)
 Merge the pass statistics of this class into 'other'. More...
 

Additional Inherited Members

- Public Types inherited from mlir::OpPassManager
using pass_iterator = llvm::pointee_iterator< std::vector< std::unique_ptr< Pass > >::iterator >
 Iterator over the passes in this pass manager. More...
 

Detailed Description

The main pass manager and pipeline builder.

Constructor & Destructor Documentation

◆ PassManager()

PassManager::PassManager ( MLIRContext ctx,
bool  verifyPasses = true 
)

◆ ~PassManager()

PassManager::~PassManager ( )

Member Function Documentation

◆ addInstrumentation()

void PassManager::addInstrumentation ( std::unique_ptr< PassInstrumentation pi)

Add the provided instrumentation to the pass manager.

◆ disableMultithreading()

void PassManager::disableMultithreading ( bool  disable = true)

Disable support for multi-threading within the pass manager.

◆ enableCrashReproducerGeneration()

void PassManager::enableCrashReproducerGeneration ( StringRef  outputFile)

Enable support for the pass manager to generate a reproducer on the event of a crash or a pass failure. outputFile is a .mlir filename used to write the generated reproducer.

◆ enableIRPrinting() [1/2]

void PassManager::enableIRPrinting ( std::unique_ptr< IRPrinterConfig config)

Add an instrumentation to print the IR before and after pass execution, using the provided configuration.

◆ enableIRPrinting() [2/2]

void PassManager::enableIRPrinting ( std::function< bool(Pass *, Operation *)>  shouldPrintBeforePass,
std::function< bool(Pass *, Operation *)>  shouldPrintAfterPass,
bool  printModuleScope,
bool  printAfterOnlyOnChange,
raw_ostream &  out 
)

Add an instrumentation to print the IR before and after pass execution.

Add an instrumentation to print the IR before and after pass execution, using the provided fields to generate a default configuration:

  • 'shouldPrintBeforePass' and 'shouldPrintAfterPass' correspond to filter functions that take a 'Pass *' and Operation *. These function should return true if the IR should be printed or not.
  • 'printModuleScope' signals if the module IR should be printed, even for non module passes.
  • 'printAfterOnlyOnChange' signals that when printing the IR after a pass, in the case of a non-failure, we should first check if any potential mutations were made.
  • 'out' corresponds to the stream to output the printed IR to.

◆ enableStatistics()

void PassManager::enableStatistics ( PassDisplayMode  displayMode = PassDisplayMode::Pipeline)

Dump the statistics for each pass after running.

Prompts the pass manager to print the statistics collected for each of the held passes after each call to 'run'.

◆ enableTiming()

void PassManager::enableTiming ( PassDisplayMode  displayMode = PassDisplayMode::Pipeline)

Add an instrumentation to time the execution of passes and the computation of analyses. Note: Timing should be enabled after all other instrumentations to avoid any potential "ghost" timing from other instrumentations being unintentionally included in the timing results.

Add an instrumentation to time the execution of passes and the computation of analyses.

◆ run()

LogicalResult PassManager::run ( ModuleOp  module)

Run the passes within this manager on the provided module.


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