MLIR  16.0.0git
Classes | Macros | Typedefs | Functions
Pass.h File Reference
#include "mlir-c/IR.h"
#include "mlir-c/Support.h"
+ Include dependency graph for Pass.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MlirExternalPassCallbacks
 Structure of external MlirPass callbacks. More...
 

Macros

#define DEFINE_C_API_STRUCT(name, storage)
 

Typedefs

typedef struct MlirExternalPassCallbacks MlirExternalPassCallbacks
 

Functions

 DEFINE_C_API_STRUCT (MlirPass, void)
 
 DEFINE_C_API_STRUCT (MlirExternalPass, void)
 
 DEFINE_C_API_STRUCT (MlirPassManager, void)
 
 DEFINE_C_API_STRUCT (MlirOpPassManager, void)
 
MLIR_CAPI_EXPORTED MlirPassManager mlirPassManagerCreate (MlirContext ctx)
 Create a new top-level PassManager. More...
 
MLIR_CAPI_EXPORTED void mlirPassManagerDestroy (MlirPassManager passManager)
 Destroy the provided PassManager. More...
 
static bool mlirPassManagerIsNull (MlirPassManager passManager)
 Checks if a PassManager is null. More...
 
MLIR_CAPI_EXPORTED MlirOpPassManager mlirPassManagerGetAsOpPassManager (MlirPassManager passManager)
 Cast a top-level PassManager to a generic OpPassManager. More...
 
MLIR_CAPI_EXPORTED MlirLogicalResult mlirPassManagerRun (MlirPassManager passManager, MlirModule module)
 Run the provided passManager on the given module. More...
 
MLIR_CAPI_EXPORTED void mlirPassManagerEnableIRPrinting (MlirPassManager passManager)
 Enable mlir-print-ir-after-all. More...
 
MLIR_CAPI_EXPORTED void mlirPassManagerEnableVerifier (MlirPassManager passManager, bool enable)
 Enable / disable verify-each. More...
 
MLIR_CAPI_EXPORTED MlirOpPassManager mlirPassManagerGetNestedUnder (MlirPassManager passManager, MlirStringRef operationName)
 Nest an OpPassManager under the top-level PassManager, the nested passmanager will only run on operations matching the provided name. More...
 
MLIR_CAPI_EXPORTED MlirOpPassManager mlirOpPassManagerGetNestedUnder (MlirOpPassManager passManager, MlirStringRef operationName)
 Nest an OpPassManager under the provided OpPassManager, the nested passmanager will only run on operations matching the provided name. More...
 
MLIR_CAPI_EXPORTED void mlirPassManagerAddOwnedPass (MlirPassManager passManager, MlirPass pass)
 Add a pass and transfer ownership to the provided top-level mlirPassManager. More...
 
MLIR_CAPI_EXPORTED void mlirOpPassManagerAddOwnedPass (MlirOpPassManager passManager, MlirPass pass)
 Add a pass and transfer ownership to the provided mlirOpPassManager. More...
 
MLIR_CAPI_EXPORTED void mlirPrintPassPipeline (MlirOpPassManager passManager, MlirStringCallback callback, void *userData)
 Print a textual MLIR pass pipeline by sending chunks of the string representation and forwarding userData tocallback`. More...
 
MLIR_CAPI_EXPORTED MlirLogicalResult mlirParsePassPipeline (MlirOpPassManager passManager, MlirStringRef pipeline)
 Parse a textual MLIR pass pipeline and add it to the provided OpPassManager. More...
 
MLIR_CAPI_EXPORTED MlirPass mlirCreateExternalPass (MlirTypeID passID, MlirStringRef name, MlirStringRef argument, MlirStringRef description, MlirStringRef opName, intptr_t nDependentDialects, MlirDialectHandle *dependentDialects, MlirExternalPassCallbacks callbacks, void *userData)
 Creates an external MlirPass that calls the supplied callbacks using the supplied userData. More...
 
MLIR_CAPI_EXPORTED void mlirExternalPassSignalFailure (MlirExternalPass pass)
 This signals that the pass has failed. More...
 

Macro Definition Documentation

◆ DEFINE_C_API_STRUCT

#define DEFINE_C_API_STRUCT (   name,
  storage 
)
Value:
struct name { \
storage *ptr; \
}; \
typedef struct name name

Definition at line 37 of file Pass.h.

Typedef Documentation

◆ MlirExternalPassCallbacks

Definition at line 153 of file Pass.h.

Function Documentation

◆ DEFINE_C_API_STRUCT() [1/4]

DEFINE_C_API_STRUCT ( MlirPass  ,
void   
)

◆ DEFINE_C_API_STRUCT() [2/4]

DEFINE_C_API_STRUCT ( MlirExternalPass  ,
void   
)

◆ DEFINE_C_API_STRUCT() [3/4]

DEFINE_C_API_STRUCT ( MlirPassManager  ,
void   
)

◆ DEFINE_C_API_STRUCT() [4/4]

DEFINE_C_API_STRUCT ( MlirOpPassManager  ,
void   
)

◆ mlirCreateExternalPass()

MLIR_CAPI_EXPORTED MlirPass mlirCreateExternalPass ( MlirTypeID  passID,
MlirStringRef  name,
MlirStringRef  argument,
MlirStringRef  description,
MlirStringRef  opName,
intptr_t  nDependentDialects,
MlirDialectHandle dependentDialects,
MlirExternalPassCallbacks  callbacks,
void userData 
)

Creates an external MlirPass that calls the supplied callbacks using the supplied userData.

If opName is empty, the pass is a generic operation pass. Otherwise it is an operation pass specific to the specified pass name.

Definition at line 154 of file Pass.cpp.

References MlirStringRef::length, None, unwrap(), and wrap().

◆ mlirExternalPassSignalFailure()

MLIR_CAPI_EXPORTED void mlirExternalPassSignalFailure ( MlirExternalPass  pass)

This signals that the pass has failed.

This is only valid to call during the run callback of MlirExternalPassCallbacks. See Pass::signalPassFailure().

Definition at line 168 of file Pass.cpp.

References unwrap().

◆ mlirOpPassManagerAddOwnedPass()

MLIR_CAPI_EXPORTED void mlirOpPassManagerAddOwnedPass ( MlirOpPassManager  passManager,
MlirPass  pass 
)

Add a pass and transfer ownership to the provided mlirOpPassManager.

If the pass is not a generic operation pass or matching the type of the provided PassManager, a new OpPassManager is implicitly nested under the provided PassManager.

Definition at line 63 of file Pass.cpp.

References unwrap().

Referenced by mlirPassManagerIsNull().

◆ mlirOpPassManagerGetNestedUnder()

MLIR_CAPI_EXPORTED MlirOpPassManager mlirOpPassManagerGetNestedUnder ( MlirOpPassManager  passManager,
MlirStringRef  operationName 
)

Nest an OpPassManager under the provided OpPassManager, the nested passmanager will only run on operations matching the provided name.

The returned OpPassManager will be destroyed when the parent is destroyed.

Definition at line 54 of file Pass.cpp.

References unwrap(), and wrap().

Referenced by mlirPassManagerIsNull().

◆ mlirParsePassPipeline()

MLIR_CAPI_EXPORTED MlirLogicalResult mlirParsePassPipeline ( MlirOpPassManager  passManager,
MlirStringRef  pipeline 
)

Parse a textual MLIR pass pipeline and add it to the provided OpPassManager.

Definition at line 74 of file Pass.cpp.

References DEFINE_C_API_PTR_METHODS, mlir::parsePassPipeline(), unwrap(), and wrap().

Referenced by mlirPassManagerIsNull().

◆ mlirPassManagerAddOwnedPass()

MLIR_CAPI_EXPORTED void mlirPassManagerAddOwnedPass ( MlirPassManager  passManager,
MlirPass  pass 
)

Add a pass and transfer ownership to the provided top-level mlirPassManager.

If the pass is not a generic operation pass or a ModulePass, a new OpPassManager is implicitly nested under the provided PassManager.

Definition at line 59 of file Pass.cpp.

References unwrap().

Referenced by mlirPassManagerIsNull().

◆ mlirPassManagerCreate()

MLIR_CAPI_EXPORTED MlirPassManager mlirPassManagerCreate ( MlirContext  ctx)

Create a new top-level PassManager.

Definition at line 23 of file Pass.cpp.

References unwrap(), and wrap().

◆ mlirPassManagerDestroy()

MLIR_CAPI_EXPORTED void mlirPassManagerDestroy ( MlirPassManager  passManager)

Destroy the provided PassManager.

Definition at line 27 of file Pass.cpp.

References unwrap().

◆ mlirPassManagerEnableIRPrinting()

MLIR_CAPI_EXPORTED void mlirPassManagerEnableIRPrinting ( MlirPassManager  passManager)

Enable mlir-print-ir-after-all.

Definition at line 41 of file Pass.cpp.

References unwrap().

Referenced by mlirPassManagerIsNull().

◆ mlirPassManagerEnableVerifier()

MLIR_CAPI_EXPORTED void mlirPassManagerEnableVerifier ( MlirPassManager  passManager,
bool  enable 
)

Enable / disable verify-each.

Definition at line 45 of file Pass.cpp.

References unwrap().

Referenced by mlirPassManagerIsNull().

◆ mlirPassManagerGetAsOpPassManager()

MLIR_CAPI_EXPORTED MlirOpPassManager mlirPassManagerGetAsOpPassManager ( MlirPassManager  passManager)

Cast a top-level PassManager to a generic OpPassManager.

Definition at line 32 of file Pass.cpp.

References unwrap(), and wrap().

Referenced by mlirPassManagerIsNull().

◆ mlirPassManagerGetNestedUnder()

MLIR_CAPI_EXPORTED MlirOpPassManager mlirPassManagerGetNestedUnder ( MlirPassManager  passManager,
MlirStringRef  operationName 
)

Nest an OpPassManager under the top-level PassManager, the nested passmanager will only run on operations matching the provided name.

The returned OpPassManager will be destroyed when the parent is destroyed. To further nest more OpPassManager under the newly returned one, see mlirOpPassManagerNest below.

Definition at line 49 of file Pass.cpp.

References unwrap(), and wrap().

Referenced by mlirPassManagerIsNull().

◆ mlirPassManagerIsNull()

static bool mlirPassManagerIsNull ( MlirPassManager  passManager)
inlinestatic

◆ mlirPassManagerRun()

MLIR_CAPI_EXPORTED MlirLogicalResult mlirPassManagerRun ( MlirPassManager  passManager,
MlirModule  module 
)

Run the provided passManager on the given module.

Definition at line 36 of file Pass.cpp.

References unwrap(), and wrap().

Referenced by mlirPassManagerIsNull().

◆ mlirPrintPassPipeline()

MLIR_CAPI_EXPORTED void mlirPrintPassPipeline ( MlirOpPassManager  passManager,
MlirStringCallback  callback,
void userData 
)

Print a textual MLIR pass pipeline by sending chunks of the string representation and forwarding userData tocallback`.

Note that the callback may be called several times with consecutive chunks of the string.

Definition at line 68 of file Pass.cpp.

References unwrap().

Referenced by mlirPassManagerIsNull().