diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2021-07-29 20:15:26 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2021-07-29 20:15:26 +0000 |
commit | 344a3780b2e33f6ca763666c380202b18aab72a3 (patch) | |
tree | f0b203ee6eb71d7fdd792373e3c81eb18d6934dd /llvm/tools/opt/NewPMDriver.cpp | |
parent | b60736ec1405bb0a8dd40989f67ef4c93da068ab (diff) | |
download | src-344a3780b2e33f6ca763666c380202b18aab72a3.tar.gz src-344a3780b2e33f6ca763666c380202b18aab72a3.zip |
Vendor import of llvm-project main 88e66fa60ae5, the last commit beforevendor/llvm-project/llvmorg-13-init-16847-g88e66fa60ae5vendor/llvm-project/llvmorg-12.0.1-rc2-0-ge7dac564cd0evendor/llvm-project/llvmorg-12.0.1-0-gfed41342a82f
the upstream release/13.x branch was created.
Diffstat (limited to 'llvm/tools/opt/NewPMDriver.cpp')
-rw-r--r-- | llvm/tools/opt/NewPMDriver.cpp | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/llvm/tools/opt/NewPMDriver.cpp b/llvm/tools/opt/NewPMDriver.cpp index 401a58fc154a..8b1fbd09e40b 100644 --- a/llvm/tools/opt/NewPMDriver.cpp +++ b/llvm/tools/opt/NewPMDriver.cpp @@ -52,9 +52,19 @@ cl::opt<std::string> cl::value_desc("filename")); } // namespace llvm -static cl::opt<bool> - DebugPM("debug-pass-manager", cl::Hidden, - cl::desc("Print pass management debugging information")); +enum class DebugLogging { None, Normal, Verbose, Quiet }; + +static cl::opt<DebugLogging> DebugPM( + "debug-pass-manager", cl::Hidden, cl::ValueOptional, + cl::desc("Print pass management debugging information"), + cl::init(DebugLogging::None), + cl::values( + clEnumValN(DebugLogging::Normal, "", ""), + clEnumValN(DebugLogging::Quiet, "quiet", + "Skip printing info about analyses"), + clEnumValN( + DebugLogging::Verbose, "verbose", + "Print extra information about adaptors and pass managers"))); static cl::list<std::string> PassPlugins("load-pass-plugin", @@ -121,11 +131,13 @@ static cl::opt<std::string> OptimizerLastEPPipeline( // Individual pipeline tuning options. extern cl::opt<bool> DisableLoopUnrolling; +namespace llvm { extern cl::opt<PGOKind> PGOKindFlag; extern cl::opt<std::string> ProfileFile; extern cl::opt<CSPGOKind> CSPGOKindFlag; extern cl::opt<std::string> CSProfileGenFile; extern cl::opt<bool> DisableBasicAA; +} // namespace llvm static cl::opt<std::string> ProfileRemappingFile("profile-remapping-file", @@ -137,10 +149,6 @@ static cl::opt<bool> DebugInfoForProfiling( static cl::opt<bool> 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<bool> UniqueInternalLinkageNames( - "new-pm-unique-internal-linkage-names", cl::init(false), cl::Hidden, - cl::desc("Uniqueify Internal Linkage Symbol Names by appending the MD5 " - "hash of the module path.")); /// @}} template <typename PassManagerT> @@ -235,7 +243,7 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM, bool ShouldPreserveAssemblyUseListOrder, bool ShouldPreserveBitcodeUseListOrder, bool EmitSummaryIndex, bool EmitModuleHash, - bool EnableDebugify, bool Coroutines) { + bool EnableDebugify) { bool VerifyEachPass = VK == VK_VerifyEachPass; Optional<PGOOptions> P; @@ -279,9 +287,18 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM, P->CSAction = PGOOptions::CSIRUse; } } + LoopAnalysisManager LAM; + FunctionAnalysisManager FAM; + CGSCCAnalysisManager CGAM; + ModuleAnalysisManager MAM; + PassInstrumentationCallbacks PIC; - StandardInstrumentations SI(DebugPM, VerifyEachPass); - SI.registerCallbacks(PIC); + PrintPassOptions PrintPassOpts; + PrintPassOpts.Verbose = DebugPM == DebugLogging::Verbose; + PrintPassOpts.SkipAnalyses = DebugPM == DebugLogging::Quiet; + StandardInstrumentations SI(DebugPM != DebugLogging::None, VerifyEachPass, + PrintPassOpts); + SI.registerCallbacks(PIC, &FAM); DebugifyEachInstrumentation Debugify; if (DebugifyEach) Debugify.registerCallbacks(PIC); @@ -291,9 +308,7 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM, // to false above so we shouldn't necessarily need to check whether or not the // option has been enabled. PTO.LoopUnrolling = !DisableLoopUnrolling; - PTO.Coroutines = Coroutines; - PTO.UniqueLinkageNames = UniqueInternalLinkageNames; - PassBuilder PB(DebugPM, TM, PTO, P, &PIC); + PassBuilder PB(TM, PTO, P, &PIC); registerEPCallbacks(PB); // Load requested pass plugins and let them register pass builder callbacks @@ -378,11 +393,6 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM, } } - LoopAnalysisManager LAM(DebugPM); - FunctionAnalysisManager FAM(DebugPM); - CGSCCAnalysisManager CGAM(DebugPM); - ModuleAnalysisManager MAM(DebugPM); - // Register the AA manager first so that our version is the one used. FAM.registerPass([&] { return std::move(AA); }); // Register our TargetLibraryInfoImpl. @@ -395,7 +405,7 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM, PB.registerLoopAnalyses(LAM); PB.crossRegisterProxies(LAM, FAM, CGAM, MAM); - ModulePassManager MPM(DebugPM); + ModulePassManager MPM; if (VK > VK_NoVerifier) MPM.addPass(VerifierPass()); if (EnableDebugify) @@ -463,3 +473,8 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM, return true; } + +void llvm::printPasses(raw_ostream &OS) { + PassBuilder PB; + PB.printPassNames(OS); +} |