MLIR 22.0.0git
mlir::detail::OpToOpPassAdaptor Class Reference

An adaptor pass used to run operation passes over nested operations. More...

#include "Pass/PassDetail.h"

Inheritance diagram for mlir::detail::OpToOpPassAdaptor:

Public Member Functions

 OpToOpPassAdaptor (OpPassManager &&mgr)
 OpToOpPassAdaptor (const OpToOpPassAdaptor &rhs)=default
void runOnOperation (bool verifyPasses)
 Run the held pipeline over all operations.
void runOnOperation () override
 The polymorphic API that runs the pass over the currently held operation.
LogicalResult tryMergeInto (MLIRContext *ctx, OpToOpPassAdaptor &rhs)
 Try to merge the current pass adaptor into 'rhs'.
MutableArrayRef< OpPassManagergetPassManagers ()
 Returns the pass managers held by this adaptor.
void getDependentDialects (DialectRegistry &dialects) const override
 Populate the set of dependent dialects for the passes in the current adaptor.
MutableArrayRef< SmallVector< OpPassManager, 1 > > getParallelPassManagers ()
 Return the async pass managers held by this parallel adaptor.
std::string getAdaptorName ()
 Returns the adaptor pass name.
Public Member Functions inherited from mlir::PassWrapper< OpToOpPassAdaptor, OperationPass<> >
 ~PassWrapper () override=default
Public Member Functions inherited from mlir::OperationPass< OpT >
 ~OperationPass () override=default
Public Member Functions inherited from mlir::Pass
virtual ~Pass ()=default
TypeID getTypeID () const
 Returns the unique identifier that corresponds to this pass.
const PassInfolookupPassInfo () const
 Returns the pass info for this pass, or null if unknown.
virtual StringRef getArgument () const
 Return the command line argument used when registering this pass.
virtual StringRef getDescription () const
 Return the command line description used when registering this pass.
std::optional< StringRef > getOpName () const
 Returns the name of the operation that this pass operates on, or std::nullopt if this is a generic OperationPass.
virtual LogicalResult initializeOptions (StringRef options, function_ref< LogicalResult(const Twine &)> errorHandler)
 Attempt to initialize the options of this pass from the given string.
void printAsTextualPipeline (raw_ostream &os, bool pretty=false)
 Prints out the pass in the textual representation of pipelines.
ArrayRef< Statistic * > getStatistics () const
 Returns the main statistics for this pass instance.
MutableArrayRef< Statistic * > getStatistics ()
const PassgetThreadingSibling () const
 Returns the thread sibling of this pass.
const PassgetThreadingSiblingOrThis () const
 Returns the thread sibling of this pass, or the pass itself it has no sibling.

Friends

class mlir::PassManager

Additional Inherited Members

Static Public Member Functions inherited from mlir::PassWrapper< OpToOpPassAdaptor, OperationPass<> >
static bool classof (const Pass *pass)
 Support isa/dyn_cast functionality for the derived pass class.
Protected Member Functions inherited from mlir::PassWrapper< OpToOpPassAdaptor, OperationPass<> >
 PassWrapper ()
PassWrapperoperator= (const PassWrapper &)=delete
StringRef getName () const override
 Returns the derived pass name.
std::unique_ptr< PassclonePass () const override
 A clone method to create a copy of this pass.
Protected Member Functions inherited from mlir::OperationPass< OpT >
 OperationPass (TypeID passID)
 OperationPass (const OperationPass &)=default
OperationPassoperator= (const OperationPass &)=delete
 OperationPass (OperationPass &&)=delete
OperationPassoperator= (OperationPass &&)=delete
bool canScheduleOn (RegisteredOperationName opName) const final
 Indicate if the current pass can be scheduled on the given operation type.
OpT getOperation ()
 Return the current operation being transformed.
template<typename AnalysisT>
AnalysisT & getAnalysis ()
 Query an analysis for the current operation of the specific derived operation type.
Protected Member Functions inherited from mlir::Pass
 Pass (TypeID passID, std::optional< StringRef > opName=std::nullopt)
 Pass (const Pass &other)
Passoperator= (const Pass &)=delete
 Pass (Pass &&)=delete
Passoperator= (Pass &&)=delete
detail::PassExecutionStategetPassState ()
 Returns the current pass state.
MLIRContextgetContext ()
 Return the MLIR context for the current operation being transformed.
virtual LogicalResult initialize (MLIRContext *context)
 Initialize any complex state necessary for running this pass.
LogicalResult runPipeline (OpPassManager &pipeline, Operation *op)
 Schedule an arbitrary pass pipeline on the provided operation.
std::unique_ptr< Passclone () const
 A clone method to create a copy of this pass.
OperationgetOperation ()
 Return the current operation being transformed.
void signalPassFailure ()
 Signal that some invariant was broken when running.
template<typename AnalysisT>
AnalysisT & getAnalysis ()
 Query an analysis for the current ir unit.
template<typename AnalysisT, typename OpT>
AnalysisT & getAnalysis ()
 Query an analysis for the current ir unit of a specific derived operation type.
template<typename AnalysisT>
std::optional< std::reference_wrapper< AnalysisT > > getCachedAnalysis ()
 Query a cached instance of an analysis for the current ir unit if one exists.
void markAllAnalysesPreserved ()
 Mark all analyses as preserved.
template<typename... AnalysesT>
void markAnalysesPreserved ()
 Mark the provided analyses as preserved.
void markAnalysesPreserved (TypeID id)
template<typename AnalysisT>
std::optional< std::reference_wrapper< AnalysisT > > getCachedParentAnalysis (Operation *parent)
 Returns the analysis for the given parent operation if it exists.
template<typename AnalysisT>
std::optional< std::reference_wrapper< AnalysisT > > getCachedParentAnalysis ()
 Returns the analysis for the parent operation if it exists.
template<typename AnalysisT>
std::optional< std::reference_wrapper< AnalysisT > > getCachedChildAnalysis (Operation *child)
 Returns the analysis for the given child operation if it exists.
template<typename AnalysisT>
AnalysisT & getChildAnalysis (Operation *child)
 Returns the analysis for the given child operation, or creates it if it doesn't exist.
template<typename AnalysisT, typename OpTy>
AnalysisT & getChildAnalysis (OpTy child)
 Returns the analysis for the given child operation of specific derived operation type, or creates it if it doesn't exist.
AnalysisManager getAnalysisManager ()
 Returns the current analysis manager.
void copyOptionValuesFrom (const Pass *other)
 Copy the option values from 'other', which is another instance of this pass.
Static Protected Member Functions inherited from mlir::OperationPass< OpT >
static bool classof (const Pass *pass)
 Support isa/dyn_cast functionality.

Detailed Description

An adaptor pass used to run operation passes over nested operations.

Definition at line 25 of file PassDetail.h.

Constructor & Destructor Documentation

◆ OpToOpPassAdaptor() [1/2]

OpToOpPassAdaptor::OpToOpPassAdaptor ( OpPassManager && mgr)

Definition at line 739 of file Pass.cpp.

References mlir::Pass::OpPassManager.

Referenced by OpToOpPassAdaptor(), and tryMergeInto().

◆ OpToOpPassAdaptor() [2/2]

mlir::detail::OpToOpPassAdaptor::OpToOpPassAdaptor ( const OpToOpPassAdaptor & rhs)
default

References OpToOpPassAdaptor(), and rhs.

Member Function Documentation

◆ getAdaptorName()

std::string OpToOpPassAdaptor::getAdaptorName ( )

Returns the adaptor pass name.

Definition at line 825 of file Pass.cpp.

References mlir::OpPassManager::getOpAnchorName(), getPassManagers(), and mlir::Pass::OpPassManager.

◆ getDependentDialects()

void OpToOpPassAdaptor::getDependentDialects ( DialectRegistry & dialects) const
overridevirtual

Populate the set of dependent dialects for the passes in the current adaptor.

Reimplemented from mlir::Pass.

Definition at line 743 of file Pass.cpp.

References mlir::OpPassManager::getDependentDialects().

◆ getParallelPassManagers()

MutableArrayRef< SmallVector< OpPassManager, 1 > > mlir::detail::OpToOpPassAdaptor::getParallelPassManagers ( )
inline

Return the async pass managers held by this parallel adaptor.

Definition at line 54 of file PassDetail.h.

Referenced by prepareStatistics().

◆ getPassManagers()

MutableArrayRef< OpPassManager > mlir::detail::OpToOpPassAdaptor::getPassManagers ( )
inline

Returns the pass managers held by this adaptor.

Definition at line 47 of file PassDetail.h.

Referenced by getAdaptorName(), and prepareStatistics().

◆ runOnOperation() [1/2]

void OpToOpPassAdaptor::runOnOperation ( )
overridevirtual

The polymorphic API that runs the pass over the currently held operation.

Implements mlir::Pass.

Definition at line 835 of file Pass.cpp.

◆ runOnOperation() [2/2]

void OpToOpPassAdaptor::runOnOperation ( bool verifyPasses)

Run the held pipeline over all operations.

Run the held pipeline over all nested operations.

Definition at line 841 of file Pass.cpp.

References getContext().

◆ tryMergeInto()

LogicalResult OpToOpPassAdaptor::tryMergeInto ( MLIRContext * ctx,
OpToOpPassAdaptor & rhs )

Try to merge the current pass adaptor into 'rhs'.

This will try to append the pass managers of this adaptor into those within rhs, or return failure if merging isn't possible. The main situation in which merging is not possible is if one of the adaptors has an any pipeline that is not compatible with a pass manager in the other adaptor. For example, if this adaptor has a func.func pipeline and rhs has an any pipeline that operates on FunctionOpInterface. In this situation the pipelines have a conflict (they both want to run on the same operations), so we can't merge.

Definition at line 748 of file Pass.cpp.

References mlir::detail::OpPassManagerImpl::canScheduleOn(), findPassManagerWithAnchor(), mlir::OpPassManager::getImpl(), mlir::OpPassManager::getOpAnchorName(), mlir::OpPassManager::getOpName(), lhs, mlir::detail::OpPassManagerImpl::mergeInto(), mlir::Pass::OpPassManager, OpToOpPassAdaptor(), rhs, and success().

◆ mlir::PassManager

friend class mlir::PassManager
friend

Definition at line 92 of file PassDetail.h.


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