Skip to content

Commit

Permalink
Specify that some flags are legacy PM-specific
Browse files Browse the repository at this point in the history
Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D96100
  • Loading branch information
aeubanks committed Feb 10, 2021
1 parent 183b75f commit c2c977c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 44 deletions.
17 changes: 8 additions & 9 deletions llvm/lib/IR/LegacyPassManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,14 @@ enum PassDebugLevel {
};
} // namespace

static cl::opt<enum PassDebugLevel>
PassDebugging("debug-pass", cl::Hidden,
cl::desc("Print PassManager debugging information"),
cl::values(
clEnumVal(Disabled , "disable debug output"),
clEnumVal(Arguments , "print pass arguments to pass to 'opt'"),
clEnumVal(Structure , "print pass structure before run()"),
clEnumVal(Executions, "print pass name before it is executed"),
clEnumVal(Details , "print pass details when it is executed")));
static cl::opt<enum PassDebugLevel> PassDebugging(
"debug-pass", cl::Hidden,
cl::desc("Print legacy PassManager debugging information"),
cl::values(clEnumVal(Disabled, "disable debug output"),
clEnumVal(Arguments, "print pass arguments to pass to 'opt'"),
clEnumVal(Structure, "print pass structure before run()"),
clEnumVal(Executions, "print pass name before it is executed"),
clEnumVal(Details, "print pass details when it is executed")));

/// isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions
/// or higher is specified.
Expand Down
72 changes: 37 additions & 35 deletions llvm/tools/opt/opt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,15 @@ static codegen::RegisterCodeGenFlags CFG;

// The OptimizationList is automatically populated with registered Passes by the
// PassNameParser.
//
static cl::list<const PassInfo*, bool, PassNameParser>
PassList(cl::desc("Optimizations available:"));
static cl::list<const PassInfo *, bool, PassNameParser> PassList(cl::desc(
"Optimizations available (use '-passes=' for the new pass manager)"));

static cl::opt<bool>
EnableNewPassManager("enable-new-pm",
cl::desc("Enable the new pass manager"),
cl::init(LLVM_ENABLE_NEW_PASS_MANAGER));
static cl::opt<bool> EnableNewPassManager(
"enable-new-pm",
cl::desc("Enable the new pass manager, translating "
"'opt -foo' to 'opt -passes=foo'. This is strictly for the new PM "
"migration, use '-passes=' when possible."),
cl::init(LLVM_ENABLE_NEW_PASS_MANAGER));

// This flag specifies a textual description of the optimization pass pipeline
// to run over the module. This flag switches opt to use the new pass manager
Expand All @@ -84,8 +85,6 @@ static cl::opt<std::string> PassPipeline(
cl::desc("A textual description of the pass pipeline for optimizing"),
cl::Hidden);

// Other command line options...
//
static cl::opt<std::string>
InputFilename(cl::Positional, cl::desc("<input bitcode file>"),
cl::init("-"), cl::value_desc("filename"));
Expand Down Expand Up @@ -142,44 +141,46 @@ static cl::opt<bool>
StripNamedMetadata("strip-named-metadata",
cl::desc("Strip module-level named metadata"));

static cl::opt<bool> DisableInline("disable-inlining",
cl::desc("Do not run the inliner pass"));
static cl::opt<bool>
DisableInline("disable-inlining",
cl::desc("Do not run the inliner pass (legacy PM only)"));

static cl::opt<bool>
DisableOptimizations("disable-opt",
cl::desc("Do not run any optimization passes"));

static cl::opt<bool>
StandardLinkOpts("std-link-opts",
cl::desc("Include the standard link time optimizations"));
static cl::opt<bool> StandardLinkOpts(
"std-link-opts",
cl::desc("Include the standard link time optimizations (legacy PM only)"));

static cl::opt<bool>
OptLevelO0("O0",
cl::desc("Optimization level 0. Similar to clang -O0"));
OptLevelO0("O0", cl::desc("Optimization level 0. Similar to clang -O0. "
"Use -passes='default<O0>' for the new PM"));

static cl::opt<bool>
OptLevelO1("O1",
cl::desc("Optimization level 1. Similar to clang -O1"));
OptLevelO1("O1", cl::desc("Optimization level 1. Similar to clang -O1. "
"Use -passes='default<O1>' for the new PM"));

static cl::opt<bool>
OptLevelO2("O2",
cl::desc("Optimization level 2. Similar to clang -O2"));
OptLevelO2("O2", cl::desc("Optimization level 2. Similar to clang -O2. "
"Use -passes='default<O2>' for the new PM"));

static cl::opt<bool>
OptLevelOs("Os",
cl::desc("Like -O2 with extra optimizations for size. Similar to clang -Os"));
OptLevelOs("Os", cl::desc("Like -O2 but size-conscious. Similar to clang "
"-Os. Use -passes='default<Os>' for the new PM"));

static cl::opt<bool>
OptLevelOz("Oz",
cl::desc("Like -Os but reduces code size further. Similar to clang -Oz"));
static cl::opt<bool> OptLevelOz(
"Oz",
cl::desc("Like -O2 but optimize for code size above all else. Similar to "
"clang -Oz. Use -passes='default<Oz>' for the new PM"));

static cl::opt<bool>
OptLevelO3("O3",
cl::desc("Optimization level 3. Similar to clang -O3"));
OptLevelO3("O3", cl::desc("Optimization level 3. Similar to clang -O3. "
"Use -passes='default<O3>' for the new PM"));

static cl::opt<unsigned>
CodeGenOptLevel("codegen-opt-level",
cl::desc("Override optimization level for codegen hooks"));
static cl::opt<unsigned> CodeGenOptLevel(
"codegen-opt-level",
cl::desc("Override optimization level for codegen hooks, legacy PM only"));

static cl::opt<std::string>
TargetTriple("mtriple", cl::desc("Override target triple for module"));
Expand All @@ -205,7 +206,8 @@ DisableBuiltins("disable-builtin",
cl::ZeroOrMore);

static cl::opt<bool>
AnalyzeOnly("analyze", cl::desc("Only perform analysis, no optimization"));
AnalyzeOnly("analyze", cl::desc("Only perform analysis, no optimization. "
"Legacy pass manager only."));

static cl::opt<bool> EnableDebugify(
"enable-debugify",
Expand All @@ -231,10 +233,10 @@ static cl::opt<bool> PreserveAssemblyUseListOrder(
cl::desc("Preserve use-list order when writing LLVM assembly."),
cl::init(false), cl::Hidden);

static cl::opt<bool>
RunTwice("run-twice",
cl::desc("Run all passes twice, re-using the same pass manager."),
cl::init(false), cl::Hidden);
static cl::opt<bool> RunTwice("run-twice",
cl::desc("Run all passes twice, re-using the "
"same pass manager (legacy PM only)."),
cl::init(false), cl::Hidden);

static cl::opt<bool> DiscardValueNames(
"discard-value-names",
Expand Down

0 comments on commit c2c977c

Please sign in to comment.