/// 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.
- /// Returns a LogicalResult to indicate failure, in which case the pass
- /// pipeline won't execute.
+ /// This method is invoked after all dependent dialects for the pipeline are
+ /// loaded, and is not allowed to load any further dialects (override the
+ /// `geDependentDialects()` for this purpose instead). Returns a LogicalResult
+ /// to indicate failure, in which case the pass pipeline won't execute.
virtual LogicalResult initialize(MLIRContext *context) { return success(); }
/// Indicate if the current pass can be scheduled on the given operation type.
if (failed(getImpl().finalizePassList(context)))
return failure();
+ // Notify the context that we start running a pipeline for book keeping.
+ context->enterMultiThreadedExecution();
+
// Initialize all of the passes within the pass manager with a new generation.
llvm::hash_code newInitKey = context->getRegistryHash();
if (newInitKey != initializationKey) {
// Construct a top level analysis manager for the pipeline.
ModuleAnalysisManager am(op, instrumentor.get());
- // Notify the context that we start running a pipeline for book keeping.
- context->enterMultiThreadedExecution();
-
// If reproducer generation is enabled, run the pass manager with crash
// handling enabled.
LogicalResult result =