From f976a2d244f94c7b89009f667d6556bce8b99236 Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Mon, 28 Nov 2022 10:57:32 -0800 Subject: [PATCH] [NFC][opt] Move some cl::opts into the only file they're used in --- llvm/tools/opt/NewPMDriver.cpp | 50 ++++++++++++++++++++++++++++++++---------- llvm/tools/opt/opt.cpp | 35 ----------------------------- 2 files changed, 39 insertions(+), 46 deletions(-) diff --git a/llvm/tools/opt/NewPMDriver.cpp b/llvm/tools/opt/NewPMDriver.cpp index 884ffa1..6b61c1f 100644 --- a/llvm/tools/opt/NewPMDriver.cpp +++ b/llvm/tools/opt/NewPMDriver.cpp @@ -153,6 +153,7 @@ static cl::opt FullLinkTimeOptimizationLastEPPipeline( "the FullLinkTimeOptimizationLast extension point into default " "pipelines"), cl::Hidden); +/// @}} static cl::opt DisablePipelineVerification( "disable-pipeline-verification", @@ -161,17 +162,36 @@ static cl::opt DisablePipelineVerification( "-print-pipeline-passes can be used to create a pipeline."), cl::Hidden); -// Individual pipeline tuning options. -extern cl::opt DisableLoopUnrolling; -namespace llvm { -extern cl::opt PGOKindFlag; -extern cl::opt ProfileFile; -extern cl::opt CSPGOKindFlag; -extern cl::opt CSProfileGenFile; -extern cl::opt DisableBasicAA; -extern cl::opt PrintPipelinePasses; -} // namespace llvm +static cl::opt + PGOKindFlag("pgo-kind", cl::init(NoPGO), cl::Hidden, + cl::desc("The kind of profile guided optimization"), + cl::values(clEnumValN(NoPGO, "nopgo", "Do not use PGO."), + clEnumValN(InstrGen, "pgo-instr-gen-pipeline", + "Instrument the IR to generate profile."), + clEnumValN(InstrUse, "pgo-instr-use-pipeline", + "Use instrumented profile to guide PGO."), + clEnumValN(SampleUse, "pgo-sample-use-pipeline", + "Use sampled profile to guide PGO."))); +static cl::opt ProfileFile("profile-file", + cl::desc("Path to the profile."), cl::Hidden); + +static cl::opt CSPGOKindFlag( + "cspgo-kind", cl::init(NoCSPGO), cl::Hidden, + cl::desc("The kind of context sensitive profile guided optimization"), + cl::values( + clEnumValN(NoCSPGO, "nocspgo", "Do not use CSPGO."), + clEnumValN( + CSInstrGen, "cspgo-instr-gen-pipeline", + "Instrument (context sensitive) the IR to generate profile."), + clEnumValN( + CSInstrUse, "cspgo-instr-use-pipeline", + "Use instrumented (context sensitive) profile to guide PGO."))); + +static cl::opt CSProfileGenFile( + "cs-profilegen-file", + cl::desc("Path to the instrumented context sensitive profile."), + cl::Hidden); static cl::opt ProfileRemappingFile("profile-remapping-file", @@ -180,10 +200,18 @@ static cl::opt static cl::opt DebugInfoForProfiling( "new-pm-debug-info-for-profiling", cl::init(false), cl::Hidden, cl::desc("Emit special debug info to enable PGO profile generation.")); + static cl::opt PseudoProbeForProfiling( "new-pm-pseudo-probe-for-profiling", cl::init(false), cl::Hidden, cl::desc("Emit pseudo probes to enable PGO profile generation.")); -/// @}} + +static cl::opt DisableLoopUnrolling( + "disable-loop-unrolling", + cl::desc("Disable loop unrolling in all relevant passes"), cl::init(false)); + +namespace llvm { +extern cl::opt PrintPipelinePasses; +} // namespace llvm template bool tryParsePipelineText(PassBuilder &PB, diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp index 4eca3de..bb6dfcf 100644 --- a/llvm/tools/opt/opt.cpp +++ b/llvm/tools/opt/opt.cpp @@ -177,10 +177,6 @@ static cl::opt CodeGenOptLevel( static cl::opt TargetTriple("mtriple", cl::desc("Override target triple for module")); -cl::opt DisableLoopUnrolling( - "disable-loop-unrolling", - cl::desc("Disable loop unrolling in all relevant passes"), cl::init(false)); - static cl::opt EmitSummaryIndex("module-summary", cl::desc("Emit module summary index"), cl::init(false)); @@ -282,37 +278,6 @@ static cl::list PassPlugins("load-pass-plugin", cl::desc("Load passes from plugin library")); -namespace llvm { -cl::opt - PGOKindFlag("pgo-kind", cl::init(NoPGO), cl::Hidden, - cl::desc("The kind of profile guided optimization"), - cl::values(clEnumValN(NoPGO, "nopgo", "Do not use PGO."), - clEnumValN(InstrGen, "pgo-instr-gen-pipeline", - "Instrument the IR to generate profile."), - clEnumValN(InstrUse, "pgo-instr-use-pipeline", - "Use instrumented profile to guide PGO."), - clEnumValN(SampleUse, "pgo-sample-use-pipeline", - "Use sampled profile to guide PGO."))); -cl::opt ProfileFile("profile-file", - cl::desc("Path to the profile."), cl::Hidden); - -cl::opt CSPGOKindFlag( - "cspgo-kind", cl::init(NoCSPGO), cl::Hidden, - cl::desc("The kind of context sensitive profile guided optimization"), - cl::values( - clEnumValN(NoCSPGO, "nocspgo", "Do not use CSPGO."), - clEnumValN( - CSInstrGen, "cspgo-instr-gen-pipeline", - "Instrument (context sensitive) the IR to generate profile."), - clEnumValN( - CSInstrUse, "cspgo-instr-use-pipeline", - "Use instrumented (context sensitive) profile to guide PGO."))); -cl::opt CSProfileGenFile( - "cs-profilegen-file", - cl::desc("Path to the instrumented context sensitive profile."), - cl::Hidden); -} // namespace llvm - static inline void addPass(legacy::PassManagerBase &PM, Pass *P) { // Add the pass to the pass manager... PM.add(P); -- 2.7.4