14 #ifndef MLIR_PASS_PASSREGISTRY_H_
15 #define MLIR_PASS_PASSREGISTRY_H_
40 function_ref<LogicalResult(
const Twine &)> errorHandler)>;
59 function_ref<LogicalResult(
const Twine &)> errorHandler)
const {
61 "cannot call addToPipeline on PassRegistryEntry without builder");
62 return builder(pm,
options, errorHandler);
75 void printHelpStr(
size_t indent,
size_t descIndent)
const;
85 : arg(arg), description(description), builder(builder),
86 optHandler(std::move(optHandler)) {}
93 std::string description;
122 PassInfo(StringRef arg, StringRef description,
154 template <
typename ConcretePass>
176 template <
typename Options = EmptyPipelineOptions>
179 StringRef arg, StringRef description,
184 function_ref<LogicalResult(
const Twine &)> errorHandler) {
186 if (failed(
options.parseFromString(optionsStr)))
192 optHandler(Options());
202 StringRef arg, StringRef description,
207 function_ref<LogicalResult(
const Twine &)> errorHandler) {
208 if (!optionsStr.empty())
221 raw_ostream &errorStream = llvm::errs());
229 FailureOr<OpPassManager>
237 struct PassPipelineCLParserImpl;
267 function_ref<LogicalResult(
const Twine &)> errorHandler)
const;
270 std::unique_ptr<detail::PassPipelineCLParserImpl>
impl;
272 llvm::cl::opt<std::string> passPipeline;
273 std::optional<llvm::cl::alias> passPipelineAlias;
293 std::unique_ptr<detail::PassPipelineCLParserImpl>
impl;
309 std::optional<std::string> pipeline;
310 std::optional<bool> verifyEach;
311 std::optional<bool> disableThreading;
static llvm::ManagedStatic< PassManagerOptions > options
This class represents a pass manager that runs passes on either a specific operation type,...
This class represents a configuration for the MLIR assembly parser.
A structure to represent the information for a derived pass class.
static const PassInfo * lookup(StringRef passArg)
Returns the pass info for the specified pass class or null if unknown.
PassInfo(StringRef arg, StringRef description, const PassAllocatorFunction &allocator)
PassInfo constructor should not be invoked directly, instead use PassRegistration or registerPass.
The main pass manager and pipeline builder.
This class implements a command-line parser specifically for MLIR pass names.
bool hasAnyOccurrences() const
Returns true if this parser contains any valid options to add.
PassNameCLParser(StringRef arg, StringRef description)
Construct a parser with the given command line description.
bool contains(const PassRegistryEntry *entry) const
Returns true if the given pass registry entry was registered at the top-level of the parser,...
This class implements a command-line parser for MLIR passes.
bool hasAnyOccurrences() const
Returns true if this parser contains any valid options to add.
PassPipelineCLParser(StringRef arg, StringRef description)
Construct a pass pipeline parser with the given command line description.
LogicalResult addToPipeline(OpPassManager &pm, function_ref< LogicalResult(const Twine &)> errorHandler) const
Adds the passes defined by this parser entry to the given pass manager.
bool contains(const PassRegistryEntry *entry) const
Returns true if the given pass registry entry was registered at the top-level of the parser,...
A structure to represent the information of a registered pass pipeline.
PassPipelineInfo(StringRef arg, StringRef description, const PassRegistryFunction &builder, std::function< void(function_ref< void(const detail::PassOptions &)>)> optHandler)
static const PassPipelineInfo * lookup(StringRef pipelineArg)
Returns the pass pipeline info for the specified pass pipeline or null if unknown.
Structure to group information about a passes and pass pipelines (argument to invoke via mlir-opt,...
void printHelpStr(size_t indent, size_t descIndent) const
Print the help information for this pass.
LogicalResult addToPipeline(OpPassManager &pm, StringRef options, function_ref< LogicalResult(const Twine &)> errorHandler) const
Adds this pass registry entry to the given pass manager.
size_t getOptionWidth() const
Return the maximum width required when printing the options of this entry.
PassRegistryEntry(StringRef arg, StringRef description, const PassRegistryFunction &builder, std::function< void(function_ref< void(const detail::PassOptions &)>)> optHandler)
StringRef getPassDescription() const
Returns a description for the pass, this never returns null.
StringRef getPassArgument() const
Returns the command line option that may be passed to 'mlir-opt' that will cause this pass to run or ...
Base container class and manager for all pass options.
Include the generated interface declarations.
const FrozenRewritePatternSet GreedyRewriteConfig config
void printRegisteredPasses()
Prints the passes that were previously registered and stored in passRegistry.
std::function< std::unique_ptr< Pass >()> PassAllocatorFunction
void registerPass(const PassAllocatorFunction &function)
Register a specific dialect pass allocator function with the system, typically used through the PassR...
void registerPassPipeline(StringRef arg, StringRef description, const PassRegistryFunction &function, std::function< void(function_ref< void(const detail::PassOptions &)>)> optHandler)
Register a specific dialect pipeline registry function with the system, typically used through the Pa...
LogicalResult parsePassPipeline(StringRef pipeline, OpPassManager &pm, raw_ostream &errorStream=llvm::errs())
Parse the textual representation of a pass pipeline, adding the result to 'pm' on success.
std::function< LogicalResult(OpPassManager &, StringRef options, function_ref< LogicalResult(const Twine &)> errorHandler)> PassRegistryFunction
A registry function that adds passes to the given pass manager.
A default empty option struct to be used for passes that do not need to take any options.
PassPipelineRegistration(StringRef arg, StringRef description, const std::function< void(OpPassManager &)> &builder)
PassPipelineRegistration provides a global initializer that registers a Pass pipeline builder routine...
PassPipelineRegistration(StringRef arg, StringRef description, std::function< void(OpPassManager &, const Options &options)> builder)
PassRegistration provides a global initializer that registers a Pass allocation routine for a concret...
PassRegistration(const PassAllocatorFunction &constructor)
void attachResourceParser(ParserConfig &config)
Attach an assembly resource parser to 'config' that collects the MLIR reproducer configuration into t...
LogicalResult apply(PassManager &pm) const
Apply the reproducer options to 'pm' and its context.