|
MLIR 22.0.0git
|
#include "mlir-c/Pass.h"#include "mlir/CAPI/IR.h"#include "mlir/CAPI/Pass.h"#include "mlir/CAPI/Support.h"#include "mlir/CAPI/Utils.h"#include "mlir/Pass/PassManager.h"#include "llvm/Support/ErrorHandling.h"#include <optional>Go to the source code of this file.
Classes | |
| class | mlir::ExternalPass |
| This pass class wraps external passes defined in other languages using the MLIR C-interface. More... | |
Namespaces | |
| namespace | mlir |
| Include the generated interface declarations. | |
Functions | |
| MlirPassManager | mlirPassManagerCreate (MlirContext ctx) |
| Create a new top-level PassManager with the default anchor. | |
| MlirPassManager | mlirPassManagerCreateOnOperation (MlirContext ctx, MlirStringRef anchorOp) |
| Create a new top-level PassManager anchored on anchorOp. | |
| void | mlirPassManagerDestroy (MlirPassManager passManager) |
| Destroy the provided PassManager. | |
| MlirOpPassManager | mlirPassManagerGetAsOpPassManager (MlirPassManager passManager) |
| Cast a top-level PassManager to a generic OpPassManager. | |
| MlirLogicalResult | mlirPassManagerRunOnOp (MlirPassManager passManager, MlirOperation op) |
| Run the provided passManager on the given op. | |
| void | mlirPassManagerEnableIRPrinting (MlirPassManager passManager, bool printBeforeAll, bool printAfterAll, bool printModuleScope, bool printAfterOnlyOnChange, bool printAfterOnlyOnFailure, MlirOpPrintingFlags flags, MlirStringRef treePrintingPath) |
| Enable IR printing. | |
| void | mlirPassManagerEnableVerifier (MlirPassManager passManager, bool enable) |
| Enable / disable verify-each. | |
| void | mlirPassManagerEnableTiming (MlirPassManager passManager) |
| Enable pass timing. | |
| void | mlirPassManagerEnableStatistics (MlirPassManager passManager, MlirPassDisplayMode displayMode) |
| Enable pass statistics. | |
| 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. | |
| 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. | |
| void | mlirPassManagerAddOwnedPass (MlirPassManager passManager, MlirPass pass) |
| Add a pass and transfer ownership to the provided top-level mlirPassManager. | |
| void | mlirOpPassManagerAddOwnedPass (MlirOpPassManager passManager, MlirPass pass) |
| Add a pass and transfer ownership to the provided mlirOpPassManager. | |
| MlirLogicalResult | mlirOpPassManagerAddPipeline (MlirOpPassManager passManager, MlirStringRef pipelineElements, MlirStringCallback callback, void *userData) |
| Parse a sequence of textual MLIR pass pipeline elements and add them to the provided OpPassManager. | |
| void | mlirPrintPassPipeline (MlirOpPassManager passManager, MlirStringCallback callback, void *userData) |
| MlirLogicalResult | mlirParsePassPipeline (MlirOpPassManager passManager, MlirStringRef pipeline, MlirStringCallback callback, void *userData) |
| MlirPass | mlirCreateExternalPass (MlirTypeID passID, MlirStringRef name, MlirStringRef argument, MlirStringRef description, MlirStringRef opName, intptr_t nDependentDialects, MlirDialectHandle *dependentDialects, MlirExternalPassCallbacks callbacks, void *userData) |
| void | mlirExternalPassSignalFailure (MlirExternalPass pass) |
| Print a textual MLIR pass pipeline by sending chunks of the string representation and forwarding userData to callback`. | |
| MlirPass mlirCreateExternalPass | ( | MlirTypeID | passID, |
| MlirStringRef | name, | ||
| MlirStringRef | argument, | ||
| MlirStringRef | description, | ||
| MlirStringRef | opName, | ||
| intptr_t | nDependentDialects, | ||
| MlirDialectHandle * | dependentDialects, | ||
| MlirExternalPassCallbacks | callbacks, | ||
| void * | userData ) |
Definition at line 219 of file Pass.cpp.
References MlirStringRef::length, unwrap(), and wrap().
| void mlirExternalPassSignalFailure | ( | MlirExternalPass | pass | ) |
Print a textual MLIR pass pipeline by sending chunks of the string representation and forwarding userData to callback`.
Note that the / callback may be called several times with consecutive chunks of the string. MLIR_CAPI_EXPORTED void mlirPrintPassPipeline(MlirOpPassManager passManager, MlirStringCallback callback, void *userData);
/ Parse a textual MLIR pass pipeline and assign it to the provided / OpPassManager. If parsing fails an error message is reported using the / provided callback. MLIR_CAPI_EXPORTED MlirLogicalResult mlirParsePassPipeline(MlirOpPassManager passManager, MlirStringRef pipeline, MlirStringCallback callback, void *userData);
===-------------------------------------------------------------------—===// External Pass API.
This API allows to define passes outside of MLIR, not necessarily in C++, and register them with the MLIR pass management infrastructure.
===-------------------------------------------------------------------—===//
/ Structure of external MlirPass callbacks. / All callbacks are required to be set unless otherwise specified. struct MlirExternalPassCallbacks { / This callback is called from the pass is created. / This is analogous to a C++ pass constructor. void (*construct)(void *userData);
/ This callback is called when the pass is destroyed / This is analogous to a C++ pass destructor. void (*destruct)(void *userData);
/ This callback is optional. / The callback is called before the pass is run, allowing a chance to / initialize any complex state necessary for running the pass. / See Pass::initialize(MLIRContext *). MlirLogicalResult (*initialize)(MlirContext ctx, void *userData);
/ This callback is called when the pass is cloned. / See Pass::clonePass(). void *(*clone)(void *userData);
/ This callback is called when the pass is run. / See Pass::runOnOperation(). void (*run)(MlirOperation op, MlirExternalPass pass, void *userData); }; typedef struct MlirExternalPassCallbacks MlirExternalPassCallbacks;
/ 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. MLIR_CAPI_EXPORTED MlirPass mlirCreateExternalPass( MlirTypeID passID, MlirStringRef name, MlirStringRef argument, MlirStringRef description, MlirStringRef opName, intptr_t nDependentDialects, MlirDialectHandle *dependentDialects, MlirExternalPassCallbacks callbacks, void *userData);
/ 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 234 of file Pass.cpp.
References unwrap().
| void mlirOpPassManagerAddOwnedPass | ( | MlirOpPassManager | passManager, |
| MlirPass | pass ) |
| MlirLogicalResult mlirOpPassManagerAddPipeline | ( | MlirOpPassManager | passManager, |
| MlirStringRef | pipelineElements, | ||
| MlirStringCallback | callback, | ||
| void * | userData ) |
Parse a sequence of textual MLIR pass pipeline elements and add them to the provided OpPassManager.
If parsing fails an error message is reported using the provided callback.
Definition at line 116 of file Pass.cpp.
References mlir::parsePassPipeline(), unwrap(), and wrap().
| MlirOpPassManager mlirOpPassManagerGetNestedUnder | ( | MlirOpPassManager | passManager, |
| MlirStringRef | operationName ) |
| MlirLogicalResult mlirParsePassPipeline | ( | MlirOpPassManager | passManager, |
| MlirStringRef | pipeline, | ||
| MlirStringCallback | callback, | ||
| void * | userData ) |
Definition at line 131 of file Pass.cpp.
References mlir::parsePassPipeline(), unwrap(), and wrap().
| void mlirPassManagerAddOwnedPass | ( | MlirPassManager | passManager, |
| MlirPass | pass ) |
| MlirPassManager mlirPassManagerCreate | ( | MlirContext | ctx | ) |
| MlirPassManager mlirPassManagerCreateOnOperation | ( | MlirContext | ctx, |
| MlirStringRef | anchorOp ) |
| void mlirPassManagerDestroy | ( | MlirPassManager | passManager | ) |
| void mlirPassManagerEnableStatistics | ( | MlirPassManager | passManager, |
| MlirPassDisplayMode | displayMode ) |
Enable pass statistics.
Definition at line 83 of file Pass.cpp.
References mlir::List, MLIR_PASS_DISPLAY_MODE_LIST, MLIR_PASS_DISPLAY_MODE_PIPELINE, mlir::Pipeline, and unwrap().
| void mlirPassManagerEnableTiming | ( | MlirPassManager | passManager | ) |
| MlirOpPassManager mlirPassManagerGetAsOpPassManager | ( | MlirPassManager | passManager | ) |
| 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.
| MlirLogicalResult mlirPassManagerRunOnOp | ( | MlirPassManager | passManager, |
| MlirOperation | op ) |