diff options
Diffstat (limited to 'include/llvm/Passes/PassBuilder.h')
-rw-r--r-- | include/llvm/Passes/PassBuilder.h | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/include/llvm/Passes/PassBuilder.h b/include/llvm/Passes/PassBuilder.h index 33433f6b4a104..b699888262537 100644 --- a/include/llvm/Passes/PassBuilder.h +++ b/include/llvm/Passes/PassBuilder.h @@ -29,10 +29,22 @@ class TargetMachine; /// A struct capturing PGO tunables. struct PGOOptions { - std::string ProfileGenFile = ""; - std::string ProfileUseFile = ""; - std::string SampleProfileFile = ""; - bool RunProfileGen = false; + PGOOptions(std::string ProfileGenFile = "", std::string ProfileUseFile = "", + std::string SampleProfileFile = "", bool RunProfileGen = false, + bool SamplePGOSupport = false) + : ProfileGenFile(ProfileGenFile), ProfileUseFile(ProfileUseFile), + SampleProfileFile(SampleProfileFile), RunProfileGen(RunProfileGen), + SamplePGOSupport(SamplePGOSupport || !SampleProfileFile.empty()) { + assert((RunProfileGen || + !SampleProfileFile.empty() || + !ProfileUseFile.empty() || + SamplePGOSupport) && "Illegal PGOOptions."); + } + std::string ProfileGenFile; + std::string ProfileUseFile; + std::string SampleProfileFile; + bool RunProfileGen; + bool SamplePGOSupport; }; /// \brief This class provides access to building LLVM's passes. @@ -59,6 +71,18 @@ public: std::vector<PipelineElement> InnerPipeline; }; + /// \brief ThinLTO phase. + /// + /// This enumerates the LLVM ThinLTO optimization phases. + enum class ThinLTOPhase { + /// No ThinLTO behavior needed. + None, + // ThinLTO prelink (summary) phase. + PreLink, + // ThinLTO postlink (backend compile) phase. + PostLink + }; + /// \brief LLVM-provided high-level optimization levels. /// /// This enumerates the LLVM-provided high-level optimization levels. Each @@ -202,13 +226,11 @@ public: /// require some transformations for semantic reasons, they should explicitly /// build them. /// - /// \p PrepareForThinLTO indicates whether this is invoked in - /// PrepareForThinLTO phase. Special handling is needed for sample PGO to - /// ensure profile accurate in the backend profile annotation phase. + /// \p Phase indicates the current ThinLTO phase. FunctionPassManager buildFunctionSimplificationPipeline(OptimizationLevel Level, - bool DebugLogging = false, - bool PrepareForThinLTO = false); + ThinLTOPhase Phase, + bool DebugLogging = false); /// Construct the core LLVM module canonicalization and simplification /// pipeline. @@ -224,13 +246,11 @@ public: /// require some transformations for semantic reasons, they should explicitly /// build them. /// - /// \p PrepareForThinLTO indicates whether this is invoked in - /// PrepareForThinLTO phase. Special handling is needed for sample PGO to - /// ensure profile accurate in the backend profile annotation phase. + /// \p Phase indicates the current ThinLTO phase. ModulePassManager buildModuleSimplificationPipeline(OptimizationLevel Level, - bool DebugLogging = false, - bool PrepareForThinLTO = false); + ThinLTOPhase Phase, + bool DebugLogging = false); /// Construct the core LLVM module optimization pipeline. /// |