If you’re using the MlirOptMain(int argc, char **argv, ...)
entry point you won’t be affected, otherwise I refactored the long list of options for these APIs:
/// Perform the core processing behind `mlir-opt`.
/// This API is deprecated, use the MlirOptMainConfig version above instead.
LogicalResult MlirOptMain(llvm::raw_ostream &outputStream,
std::unique_ptr<llvm::MemoryBuffer> buffer,
const PassPipelineCLParser &passPipeline,
DialectRegistry ®istry, bool splitInputFile,
bool verifyDiagnostics, bool verifyPasses,
bool allowUnregisteredDialects,
bool preloadDialectsInContext = false,
bool emitBytecode = false, bool explicitModule = true,
bool dumpPassPipeline = false);
/// Perform the core processing behind `mlir-opt`.
/// This API is deprecated, use the MlirOptMainConfig version above instead.
LogicalResult MlirOptMain(
llvm::raw_ostream &outputStream, std::unique_ptr<llvm::MemoryBuffer> buffer,
PassPipelineFn passManagerSetupFn, DialectRegistry ®istry,
bool splitInputFile, bool verifyDiagnostics, bool verifyPasses,
bool allowUnregisteredDialects, bool preloadDialectsInContext = false,
bool emitBytecode = false, bool explicitModule = true);
into a helper configuration MlirOptMainConfig
. Please migrate to use this instead of the APIs above
You can take example on the implementation of MlirOptMain(int argc, char **argv, ...)
to see how to use it. It also exposes a fluent API if needed:
// Setup the configuration for the main function.
MlirOptMainConfig config;
config.setPassPipelineParser(passPipeline)
.splitInputFile(splitInputFile)
.verifyDiagnostics(verifyDiagnostics)
.verifyPasses(verifyPasses)
.allowUnregisteredDialects(allowUnregisteredDialects)
.preloadDialectsInContext(preloadDialectsInContext)
.emitBytecode(emitBytecode)
.useExplicitModule(explicitModule)
.dumpPassPipeline(dumpPassPipeline);
Also preloadDialectInContext
has been deprecated for >1y and will be removed (I’ll write another PSA for this as well).