From c2c977ce50597b0e5186afc342c5784bd0aa6973 Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Thu, 4 Feb 2021 19:34:09 -0800 Subject: [PATCH] Specify that some flags are legacy PM-specific Reviewed By: asbirlea Differential Revision: https://reviews.llvm.org/D96100 --- llvm/lib/IR/LegacyPassManager.cpp | 17 ++++---- llvm/tools/opt/opt.cpp | 72 ++++++++++++++++--------------- 2 files changed, 45 insertions(+), 44 deletions(-) diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp index 4547c3a01239e9..a1dae5bd572e32 100644 --- a/llvm/lib/IR/LegacyPassManager.cpp +++ b/llvm/lib/IR/LegacyPassManager.cpp @@ -52,15 +52,14 @@ enum PassDebugLevel { }; } // namespace -static cl::opt -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 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. diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp index a45c575d174836..9426940d3ba7e2 100644 --- a/llvm/tools/opt/opt.cpp +++ b/llvm/tools/opt/opt.cpp @@ -66,14 +66,15 @@ static codegen::RegisterCodeGenFlags CFG; // The OptimizationList is automatically populated with registered Passes by the // PassNameParser. -// -static cl::list -PassList(cl::desc("Optimizations available:")); +static cl::list PassList(cl::desc( + "Optimizations available (use '-passes=' for the new pass manager)")); -static cl::opt - EnableNewPassManager("enable-new-pm", - cl::desc("Enable the new pass manager"), - cl::init(LLVM_ENABLE_NEW_PASS_MANAGER)); +static cl::opt 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 @@ -84,8 +85,6 @@ static cl::opt PassPipeline( cl::desc("A textual description of the pass pipeline for optimizing"), cl::Hidden); -// Other command line options... -// static cl::opt InputFilename(cl::Positional, cl::desc(""), cl::init("-"), cl::value_desc("filename")); @@ -142,44 +141,46 @@ static cl::opt StripNamedMetadata("strip-named-metadata", cl::desc("Strip module-level named metadata")); -static cl::opt DisableInline("disable-inlining", - cl::desc("Do not run the inliner pass")); +static cl::opt + DisableInline("disable-inlining", + cl::desc("Do not run the inliner pass (legacy PM only)")); static cl::opt DisableOptimizations("disable-opt", cl::desc("Do not run any optimization passes")); -static cl::opt -StandardLinkOpts("std-link-opts", - cl::desc("Include the standard link time optimizations")); +static cl::opt StandardLinkOpts( + "std-link-opts", + cl::desc("Include the standard link time optimizations (legacy PM only)")); static cl::opt -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' for the new PM")); static cl::opt -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' for the new PM")); static cl::opt -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' for the new PM")); static cl::opt -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' for the new PM")); -static cl::opt -OptLevelOz("Oz", - cl::desc("Like -Os but reduces code size further. Similar to clang -Oz")); +static cl::opt OptLevelOz( + "Oz", + cl::desc("Like -O2 but optimize for code size above all else. Similar to " + "clang -Oz. Use -passes='default' for the new PM")); static cl::opt -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' for the new PM")); -static cl::opt -CodeGenOptLevel("codegen-opt-level", - cl::desc("Override optimization level for codegen hooks")); +static cl::opt CodeGenOptLevel( + "codegen-opt-level", + cl::desc("Override optimization level for codegen hooks, legacy PM only")); static cl::opt TargetTriple("mtriple", cl::desc("Override target triple for module")); @@ -205,7 +206,8 @@ DisableBuiltins("disable-builtin", cl::ZeroOrMore); static cl::opt -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 EnableDebugify( "enable-debugify", @@ -231,10 +233,10 @@ static cl::opt PreserveAssemblyUseListOrder( cl::desc("Preserve use-list order when writing LLVM assembly."), cl::init(false), cl::Hidden); -static cl::opt - RunTwice("run-twice", - cl::desc("Run all passes twice, re-using the same pass manager."), - cl::init(false), cl::Hidden); +static cl::opt 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 DiscardValueNames( "discard-value-names",