class PassPipelineCLParser {
public:
/// Construct a pass pipeline parser with the given command line description.
+ /// Optionally registers an alias for the `pass-pipeline` option.
PassPipelineCLParser(StringRef arg, StringRef description);
+ PassPipelineCLParser(StringRef arg, StringRef description, StringRef alias);
~PassPipelineCLParser();
/// Returns true if this parser contains any valid options to add.
std::unique_ptr<detail::PassPipelineCLParserImpl> impl;
llvm::cl::opt<std::string> passPipeline;
+ Optional<llvm::cl::alias> passPipelineAlias;
};
/// This class implements a command-line parser specifically for MLIR pass
/// The name for the command line option used for parsing the textual pass
/// pipeline.
-static constexpr StringLiteral passPipelineArg = "pass-pipeline";
+#define PASS_PIPELINE_ARG "pass-pipeline"
/// Adds command line option for each registered pass or pass pipeline, as well
/// as textual pass pipelines.
: impl(std::make_unique<detail::PassPipelineCLParserImpl>(
arg, description, /*passNamesOnly=*/false)),
passPipeline(
- StringRef(passPipelineArg),
+ PASS_PIPELINE_ARG,
llvm::cl::desc("Textual description of the pass pipeline to run")) {}
+
+PassPipelineCLParser::PassPipelineCLParser(StringRef arg, StringRef description,
+ StringRef alias)
+ : PassPipelineCLParser(arg, description) {
+ passPipelineAlias.emplace(alias,
+ llvm::cl::desc("Alias for --" PASS_PIPELINE_ARG),
+ llvm::cl::aliasopt(passPipeline));
+}
+
PassPipelineCLParser::~PassPipelineCLParser() = default;
/// Returns true if this parser contains any valid options to add.
if (passPipeline.getNumOccurrences()) {
if (impl->passList.getNumOccurrences())
return errorHandler(
- "'-" + passPipelineArg +
+ "'-" PASS_PIPELINE_ARG
"' option can't be used with individual pass options");
std::string errMsg;
llvm::raw_string_ostream os(errMsg);
registerPassManagerCLOptions();
registerDefaultTimingManagerCLOptions();
DebugCounter::registerCLOptions();
- PassPipelineCLParser passPipeline("", "Compiler passes to run");
+ PassPipelineCLParser passPipeline("", "Compiler passes to run", "p");
// Build the list of dialects as a header for the --help message.
std::string helpHeader = (toolName + "\nAvailable Dialects: ").str();