14 #ifndef MLIR_DIALECT_TRANSFORM_TRANSFORMS_TRANSFORMINTERPRETERPASSBASE_H
15 #define MLIR_DIALECT_TRANSFORM_TRANSFORMS_TRANSFORMINTERPRETERPASSBASE_H
35 MLIRContext *context, StringRef transformFileName,
36 ArrayRef<std::string> transformLibraryPaths,
37 std::shared_ptr<OwningOpRef<ModuleOp>> &module,
38 std::shared_ptr<OwningOpRef<ModuleOp>> &libraryModule,
39 function_ref<std::optional<LogicalResult>(OpBuilder &, Location)>
40 moduleBuilder =
nullptr);
45 Operation *target, StringRef passName,
46 const std::shared_ptr<OwningOpRef<ModuleOp>> &sharedTransformModule,
47 const std::shared_ptr<OwningOpRef<ModuleOp>> &libraryModule,
48 const RaggedArray<MappedValue> &extraMappings,
49 const TransformOptions &
options,
50 const Pass::Option<std::string> &transformFileName,
51 const Pass::ListOption<std::string> &transformLibraryPaths,
52 const Pass::Option<std::string> &debugPayloadRootTag,
53 const Pass::Option<std::string> &debugTransformRootTag,
54 StringRef binaryName);
95 template <
typename Concrete,
template <
typename>
typename GeneratedBase>
103 sharedTransformModule = pass.sharedTransformModule;
104 transformLibraryModule = pass.transformLibraryModule;
112 #define REQUIRE_PASS_OPTION(NAME) \
115 std::remove_reference_t<decltype(std::declval<Concrete &>().NAME)>, \
116 Pass::Option<std::string>>, \
117 "required " #NAME " string pass option is missing")
123 #undef REQUIRE_PASS_OPTION
125 #define REQUIRE_PASS_LIST_OPTION(NAME) \
128 std::remove_reference_t<decltype(std::declval<Concrete &>().NAME)>, \
129 Pass::ListOption<std::string>>, \
130 "required " #NAME " string pass option is missing")
134 #undef REQUIRE_PASS_LIST_OPTION
136 StringRef transformFileName =
137 static_cast<Concrete *
>(
this)->transformFileName;
139 static_cast<Concrete *
>(
this)->transformLibraryPaths;
141 context, transformFileName, transformLibraryPaths,
142 sharedTransformModule, transformLibraryModule,
168 auto *pass =
static_cast<Concrete *
>(
this);
170 StringRef binaryName = Concrete::getBinaryName();
171 if (
failed(pass->runBeforeInterpreter(op)) ||
173 op, pass->getArgument(), sharedTransformModule,
174 transformLibraryModule,
175 {},
options, pass->transformFileName,
176 pass->transformLibraryPaths, pass->debugPayloadRootTag,
177 pass->debugTransformRootTag, binaryName)) ||
178 failed(pass->runAfterInterpreter(op))) {
179 return pass->signalPassFailure();
188 const std::shared_ptr<OwningOpRef<ModuleOp>> &
190 return sharedTransformModule;
194 const std::shared_ptr<OwningOpRef<ModuleOp>> &
196 return transformLibraryModule;
204 std::shared_ptr<OwningOpRef<ModuleOp>> sharedTransformModule =
nullptr;
210 std::shared_ptr<OwningOpRef<ModuleOp>> transformLibraryModule =
nullptr;
static llvm::ManagedStatic< PassManagerOptions > options
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
MLIRContext is the top-level object for a collection of MLIR operations.
This class helps build Operations.
Operation is the basic unit of execution within MLIR.
Include the generated interface declarations.
llvm::function_ref< Fn > function_ref
LogicalResult success(bool isSuccess=true)
Utility function to generate a LogicalResult.
bool failed(LogicalResult result)
Utility function that returns true if the provided LogicalResult corresponds to a failure value.
This class represents an efficient way to signal success or failure.