14 #ifndef MLIR_PASS_PASSREGISTRY_H_
15 #define MLIR_PASS_PASSREGISTRY_H_
40 function_ref<LogicalResult(
const Twine &)> errorHandler)>;
56 function_ref<LogicalResult(
const Twine &)> errorHandler)
const {
58 "cannot call addToPipeline on PassRegistryEntry without builder");
59 return builder(pm,
options, errorHandler);
72 void printHelpStr(
size_t indent,
size_t descIndent)
const;
82 : arg(arg), description(description), builder(builder),
83 optHandler(std::move(optHandler)) {}
90 std::string description;
119 PassInfo(StringRef arg, StringRef description,
151 template <
typename ConcretePass>
173 template <
typename Options = EmptyPipelineOptions>
176 StringRef arg, StringRef description,
181 function_ref<LogicalResult(
const Twine &)> errorHandler) {
183 if (failed(
options.parseFromString(optionsStr)))
189 optHandler(Options());
199 StringRef arg, StringRef description,
204 function_ref<LogicalResult(
const Twine &)> errorHandler) {
205 if (!optionsStr.empty())
218 raw_ostream &errorStream = llvm::errs());
226 FailureOr<OpPassManager>
234 struct PassPipelineCLParserImpl;
264 function_ref<LogicalResult(
const Twine &)> errorHandler)
const;
267 std::unique_ptr<detail::PassPipelineCLParserImpl>
impl;
269 llvm::cl::opt<std::string> passPipeline;
270 std::optional<llvm::cl::alias> passPipelineAlias;
290 std::unique_ptr<detail::PassPipelineCLParserImpl>
impl;
306 std::optional<std::string> pipeline;
307 std::optional<bool> verifyEach;
308 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.
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.