MLIR  19.0.0git
Public Member Functions | Protected Member Functions | List of all members
mlir::ExternalPass Class Reference

This pass class wraps external passes defined in other languages using the MLIR C-interface. More...

+ Inheritance diagram for mlir::ExternalPass:

Public Member Functions

 ExternalPass (TypeID passID, StringRef name, StringRef argument, StringRef description, std::optional< StringRef > opName, ArrayRef< MlirDialectHandle > dependentDialects, MlirExternalPassCallbacks callbacks, void *userData)
 
 ~ExternalPass () override
 
StringRef getName () const override
 Returns the derived pass name. More...
 
StringRef getArgument () const override
 Return the command line argument used when registering this pass. More...
 
StringRef getDescription () const override
 Return the command line description used when registering this pass. More...
 
void getDependentDialects (DialectRegistry &registry) const override
 Register dependent dialects for the current pass. More...
 
void signalPassFailure ()
 
- Public Member Functions inherited from mlir::Pass
virtual ~Pass ()=default
 
TypeID getTypeID () const
 Returns the unique identifier that corresponds to this pass. More...
 
const PassInfolookupPassInfo () const
 Returns the pass info for this pass, or null if unknown. More...
 
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. More...
 
virtual LogicalResult initializeOptions (StringRef options)
 Attempt to initialize the options of this pass from the given string. More...
 
void printAsTextualPipeline (raw_ostream &os)
 Prints out the pass in the textual representation of pipelines. More...
 
ArrayRef< Statistic * > getStatistics () const
 Returns the main statistics for this pass instance. More...
 
MutableArrayRef< Statistic * > getStatistics ()
 
const PassgetThreadingSibling () const
 Returns the thread sibling of this pass. More...
 
const PassgetThreadingSiblingOrThis () const
 Returns the thread sibling of this pass, or the pass itself it has no sibling. More...
 

Protected Member Functions

LogicalResult initialize (MLIRContext *ctx) override
 Initialize any complex state necessary for running this pass. More...
 
bool canScheduleOn (RegisteredOperationName opName) const override
 Indicate if the current pass can be scheduled on the given operation type. More...
 
void runOnOperation () override
 The polymorphic API that runs the pass over the currently held operation. More...
 
std::unique_ptr< PassclonePass () const override
 Create a copy of this pass, ignoring statistics and options. More...
 
- 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. More...
 
MLIRContextgetContext ()
 Return the MLIR context for the current operation being transformed. More...
 
LogicalResult runPipeline (OpPassManager &pipeline, Operation *op)
 Schedule an arbitrary pass pipeline on the provided operation. More...
 
std::unique_ptr< Passclone () const
 A clone method to create a copy of this pass. More...
 
OperationgetOperation ()
 Return the current operation being transformed. More...
 
void signalPassFailure ()
 Signal that some invariant was broken when running. More...
 
template<typename AnalysisT >
AnalysisT & getAnalysis ()
 Query an analysis for the current ir unit. More...
 
template<typename AnalysisT , typename OpT >
AnalysisT & getAnalysis ()
 Query an analysis for the current ir unit of a specific derived operation type. More...
 
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. More...
 
void markAllAnalysesPreserved ()
 Mark all analyses as preserved. More...
 
template<typename... AnalysesT>
void markAnalysesPreserved ()
 Mark the provided analyses as preserved. More...
 
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. More...
 
template<typename AnalysisT >
std::optional< std::reference_wrapper< AnalysisT > > getCachedParentAnalysis ()
 Returns the analysis for the parent operation if it exists. More...
 
template<typename AnalysisT >
std::optional< std::reference_wrapper< AnalysisT > > getCachedChildAnalysis (Operation *child)
 Returns the analysis for the given child operation if it exists. More...
 
template<typename AnalysisT >
AnalysisT & getChildAnalysis (Operation *child)
 Returns the analysis for the given child operation, or creates it if it doesn't exist. More...
 
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. More...
 
AnalysisManager getAnalysisManager ()
 Returns the current analysis manager. More...
 
void copyOptionValuesFrom (const Pass *other)
 Copy the option values from 'other', which is another instance of this pass. More...
 

Detailed Description

This pass class wraps external passes defined in other languages using the MLIR C-interface.

Definition at line 112 of file Pass.cpp.

Constructor & Destructor Documentation

◆ ExternalPass()

mlir::ExternalPass::ExternalPass ( TypeID  passID,
StringRef  name,
StringRef  argument,
StringRef  description,
std::optional< StringRef >  opName,
ArrayRef< MlirDialectHandle dependentDialects,
MlirExternalPassCallbacks  callbacks,
void *  userData 
)
inline

Definition at line 114 of file Pass.cpp.

References MlirExternalPassCallbacks::construct.

◆ ~ExternalPass()

mlir::ExternalPass::~ExternalPass ( )
inlineoverride

Definition at line 124 of file Pass.cpp.

References MlirExternalPassCallbacks::destruct.

Member Function Documentation

◆ canScheduleOn()

bool mlir::ExternalPass::canScheduleOn ( RegisteredOperationName  opName) const
inlineoverrideprotectedvirtual

Indicate if the current pass can be scheduled on the given operation type.

This is useful for generic operation passes to add restrictions on the operations they operate on.

Implements mlir::Pass.

Definition at line 145 of file Pass.cpp.

References mlir::Pass::getOpName(), and mlir::OperationName::getStringRef().

◆ clonePass()

std::unique_ptr<Pass> mlir::ExternalPass::clonePass ( ) const
inlineoverrideprotectedvirtual

Create a copy of this pass, ignoring statistics and options.

Implements mlir::Pass.

Definition at line 155 of file Pass.cpp.

References MlirExternalPassCallbacks::clone, and mlir::Pass::getOpName().

◆ getArgument()

StringRef mlir::ExternalPass::getArgument ( ) const
inlineoverridevirtual

Return the command line argument used when registering this pass.

Return an empty string if one does not exist.

Reimplemented from mlir::Pass.

Definition at line 127 of file Pass.cpp.

◆ getDependentDialects()

void mlir::ExternalPass::getDependentDialects ( DialectRegistry registry) const
inlineoverridevirtual

Register dependent dialects for the current pass.

A pass is expected to register the dialects it will create entities for (Operations, Types, Attributes), other than dialect that exists in the input. For example, a pass that converts from Linalg to Affine would register the Affine dialect but does not need to register Linalg.

Reimplemented from mlir::Pass.

Definition at line 130 of file Pass.cpp.

References mlirDialectHandleInsertDialect(), and wrap().

◆ getDescription()

StringRef mlir::ExternalPass::getDescription ( ) const
inlineoverridevirtual

Return the command line description used when registering this pass.

Return an empty string if one does not exist.

Reimplemented from mlir::Pass.

Definition at line 128 of file Pass.cpp.

◆ getName()

StringRef mlir::ExternalPass::getName ( ) const
inlineoverridevirtual

Returns the derived pass name.

Implements mlir::Pass.

Definition at line 126 of file Pass.cpp.

◆ initialize()

LogicalResult mlir::ExternalPass::initialize ( MLIRContext context)
inlineoverrideprotectedvirtual

Initialize any complex state necessary for running this pass.

This hook should not rely on any state accessible during the execution of a pass. For example, getContext/getOperation/getAnalysis/etc. should not be invoked within this hook. This method is invoked after all dependent dialects for the pipeline are loaded, and is not allowed to load any further dialects (override the getDependentDialects() for this purpose instead). Returns a LogicalResult to indicate failure, in which case the pass pipeline won't execute.

Reimplemented from mlir::Pass.

Definition at line 139 of file Pass.cpp.

References MlirExternalPassCallbacks::initialize, mlir::success(), unwrap(), and wrap().

◆ runOnOperation()

void mlir::ExternalPass::runOnOperation ( )
inlineoverrideprotectedvirtual

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

Implements mlir::Pass.

Definition at line 151 of file Pass.cpp.

References mlir::Pass::getOperation(), MlirExternalPassCallbacks::run, and wrap().

◆ signalPassFailure()

void mlir::ExternalPass::signalPassFailure ( )
inline

Definition at line 136 of file Pass.cpp.

References mlir::Pass::signalPassFailure().


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