|
LLVM
10.0.0
|
PassManagerBuilder - This class is used to set up a standard optimization sequence for languages like C and C++, allowing some APIs to customize the pass sequence in various ways. More...
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
Public Types | |
| enum | ExtensionPointTy { EP_EarlyAsPossible, EP_ModuleOptimizerEarly, EP_LoopOptimizerEnd, EP_ScalarOptimizerLate, EP_OptimizerLast, EP_VectorizerStart, EP_EnabledOnOptLevel0, EP_Peephole, EP_LateLoopOptimizations, EP_CGSCCOptimizerLate, EP_FullLinkTimeOptimizationEarly, EP_FullLinkTimeOptimizationLast } |
| typedef std::function< void(const PassManagerBuilder &Builder, legacy::PassManagerBase &PM)> | ExtensionFn |
| Extensions are passed to the builder itself (so they can see how it is configured) as well as the pass manager to add stuff to. More... | |
| typedef int | GlobalExtensionID |
Public Member Functions | |
| PassManagerBuilder () | |
| ~PassManagerBuilder () | |
| void | addExtension (ExtensionPointTy Ty, ExtensionFn Fn) |
| void | populateFunctionPassManager (legacy::FunctionPassManager &FPM) |
| populateFunctionPassManager - This fills in the function pass manager, which is expected to be run on each function immediately as it is generated. More... | |
| void | populateModulePassManager (legacy::PassManagerBase &MPM) |
| populateModulePassManager - This sets up the primary pass manager. More... | |
| void | populateLTOPassManager (legacy::PassManagerBase &PM) |
| void | populateThinLTOPassManager (legacy::PassManagerBase &PM) |
Static Public Member Functions | |
| static GlobalExtensionID | addGlobalExtension (ExtensionPointTy Ty, ExtensionFn Fn) |
| Adds an extension that will be used by all PassManagerBuilder instances. More... | |
| static void | removeGlobalExtension (GlobalExtensionID ExtensionID) |
| Removes an extension that was previously added using addGlobalExtension. More... | |
Public Attributes | |
| unsigned | OptLevel |
| The Optimization Level - Specify the basic optimization level. More... | |
| unsigned | SizeLevel |
| SizeLevel - How much we're optimizing for size. More... | |
| TargetLibraryInfoImpl * | LibraryInfo |
| LibraryInfo - Specifies information about the runtime library for the optimizer. More... | |
| Pass * | Inliner |
| Inliner - Specifies the inliner to use. More... | |
| ModuleSummaryIndex * | ExportSummary = nullptr |
| The module summary index to use for exporting information from the regular LTO phase, for example for the CFI and devirtualization type tests. More... | |
| const ModuleSummaryIndex * | ImportSummary = nullptr |
| The module summary index to use for importing information to the thin LTO backends, for example for the CFI and devirtualization type tests. More... | |
| bool | DisableTailCalls |
| bool | DisableUnrollLoops |
| bool | SLPVectorize |
| bool | LoopVectorize |
| bool | LoopsInterleaved |
| bool | RerollLoops |
| bool | NewGVN |
| bool | DisableGVNLoadPRE |
| bool | ForgetAllSCEVInLoopUnroll |
| bool | VerifyInput |
| bool | VerifyOutput |
| bool | MergeFunctions |
| bool | PrepareForLTO |
| bool | PrepareForThinLTO |
| bool | PerformThinLTO |
| bool | DivergentTarget |
| unsigned | LicmMssaOptCap |
| unsigned | LicmMssaNoAccForPromotionCap |
| bool | EnablePGOInstrGen |
| Enable profile instrumentation pass. More... | |
| bool | EnablePGOCSInstrGen |
| Enable profile context sensitive instrumentation pass. More... | |
| bool | EnablePGOCSInstrUse |
| Enable profile context sensitive profile use pass. More... | |
| std::string | PGOInstrGen |
| Profile data file name that the instrumentation will be written to. More... | |
| std::string | PGOInstrUse |
| Path of the profile data file. More... | |
| std::string | PGOSampleUse |
| Path of the sample Profile data file. More... | |
PassManagerBuilder - This class is used to set up a standard optimization sequence for languages like C and C++, allowing some APIs to customize the pass sequence in various ways.
A simple example of using it would be:
PassManagerBuilder Builder; Builder.OptLevel = 2; Builder.populateFunctionPassManager(FPM); Builder.populateModulePassManager(MPM);
In addition to setting up the basic passes, PassManagerBuilder allows frontends to vend a plugin API, where plugins are allowed to add extensions to the default pass manager. They do this by specifying where in the pass pipeline they want to be added, along with a callback function that adds the pass(es). For example, a plugin that wanted to add a loop optimization could do something like this:
static void addMyLoopPass(const PMBuilder &Builder, PassManagerBase &PM) { if (Builder.getOptLevel() > 2 && Builder.getOptSizeLevel() == 0) PM.add(createMyAwesomePass()); } ... Builder.addExtension(PassManagerBuilder::EP_LoopOptimizerEnd, addMyLoopPass); ...
Definition at line 58 of file PassManagerBuilder.h.
| typedef std::function<void(const PassManagerBuilder &Builder, legacy::PassManagerBase &PM)> llvm::PassManagerBuilder::ExtensionFn |
Extensions are passed to the builder itself (so they can see how it is configured) as well as the pass manager to add stuff to.
Definition at line 64 of file PassManagerBuilder.h.
| typedef int llvm::PassManagerBuilder::GlobalExtensionID |
Definition at line 65 of file PassManagerBuilder.h.
| Enumerator | |
|---|---|
| EP_EarlyAsPossible | EP_EarlyAsPossible - This extension point allows adding passes before any other transformations, allowing them to see the code as it is coming out of the frontend. |
| EP_ModuleOptimizerEarly | EP_ModuleOptimizerEarly - This extension point allows adding passes just before the main module-level optimization passes. |
| EP_LoopOptimizerEnd | EP_LoopOptimizerEnd - This extension point allows adding loop passes to the end of the loop optimizer. |
| EP_ScalarOptimizerLate | EP_ScalarOptimizerLate - This extension point allows adding optimization passes after most of the main optimizations, but before the last cleanup-ish optimizations. |
| EP_OptimizerLast | EP_OptimizerLast – This extension point allows adding passes that run after everything else. |
| EP_VectorizerStart | EP_VectorizerStart - This extension point allows adding optimization passes before the vectorizer and other highly target specific optimization passes are executed. |
| EP_EnabledOnOptLevel0 | EP_EnabledOnOptLevel0 - This extension point allows adding passes that should not be disabled by O0 optimization level. The passes will be inserted after the inlining pass. |
| EP_Peephole | EP_Peephole - This extension point allows adding passes that perform peephole optimizations similar to the instruction combiner. These passes will be inserted after each instance of the instruction combiner pass. |
| EP_LateLoopOptimizations | EP_LateLoopOptimizations - This extension point allows adding late loop canonicalization and simplification passes. This is the last point in the loop optimization pipeline before loop deletion. Each pass added here must be an instance of LoopPass. This is the place to add passes that can remove loops, such as target- specific loop idiom recognition. |
| EP_CGSCCOptimizerLate | EP_CGSCCOptimizerLate - This extension point allows adding CallGraphSCC passes at the end of the main CallGraphSCC passes and before any function simplification passes run by CGPassManager. |
| EP_FullLinkTimeOptimizationEarly | EP_FullLinkTimeOptimizationEarly - This extensions point allow adding passes that run at Link Time, before Full Link Time Optimization. |
| EP_FullLinkTimeOptimizationLast | EP_FullLinkTimeOptimizationLast - This extensions point allow adding passes that run at Link Time, after Full Link Time Optimization. |
Definition at line 67 of file PassManagerBuilder.h.
| PassManagerBuilder::PassManagerBuilder | ( | ) |
Definition at line 155 of file PassManagerBuilder.cpp.
References llvm::EnableLoopInterleaving, llvm::EnableLoopVectorization, EnablePerformThinLTO, EnablePrepareForThinLTO, llvm::ForgetSCEVInLoopUnroll, Inliner, RunLoopRerolling, RunNewGVN, llvm::RunSLPVectorization, llvm::SetLicmMssaNoAccForPromotionCap, and llvm::SetLicmMssaOptCap.
| PassManagerBuilder::~PassManagerBuilder | ( | ) |
Definition at line 185 of file PassManagerBuilder.cpp.
References Inliner.
| void PassManagerBuilder::addExtension | ( | ExtensionPointTy | Ty, |
| ExtensionFn | Fn | ||
| ) |
Definition at line 231 of file PassManagerBuilder.cpp.
References llvm::legacy::PassManagerBase::add(), Andersen, Both, llvm::createCFLAndersAAWrapperPass(), llvm::createCFLSteensAAWrapperPass(), llvm::createInstructionCombiningPass(), llvm::createScopedNoAliasAAWrapperPass(), llvm::createTypeBasedAAWrapperPass(), llvm::numbers::e, llvm::MipsISD::Ext, first, GlobalExtensions, GlobalExtensionsNotEmpty(), and Steensgaard.
Referenced by llvm::addCoroutinePassesToExtensionPoints(), llvm::HexagonTargetMachine::adjustPassManager(), llvm::AMDGPUTargetMachine::adjustPassManager(), and llvm::NVPTXTargetMachine::adjustPassManager().
|
static |
Adds an extension that will be used by all PassManagerBuilder instances.
This is intended to be used by plugins, to register a set of optimisations to run automatically.
Definition at line 207 of file PassManagerBuilder.cpp.
References GlobalExtensions.
Referenced by llvm::RegisterStandardPasses::RegisterStandardPasses().
| void PassManagerBuilder::populateFunctionPassManager | ( | legacy::FunctionPassManager & | FPM | ) |
populateFunctionPassManager - This fills in the function pass manager, which is expected to be run on each function immediately as it is generated.
The idea is to reduce the size of the IR in memory.
Definition at line 278 of file PassManagerBuilder.cpp.
References llvm::legacy::PassManagerBase::add(), llvm::legacy::FunctionPassManager::add(), assert(), llvm::createAggressiveDCEPass(), llvm::createAggressiveInstCombinerPass(), llvm::createBitTrackingDCEPass(), llvm::createCFGSimplificationPass(), llvm::createControlHeightReductionLegacyPass(), llvm::createCorrelatedValuePropagationPass(), llvm::createDeadStoreEliminationPass(), llvm::createEarlyCSEPass(), llvm::createEntryExitInstrumenterPass(), llvm::createFunctionInliningPass(), llvm::createGVNHoistPass(), llvm::createGVNPass(), llvm::createGVNSinkPass(), llvm::createIndVarSimplifyPass(), llvm::createInstrProfilingLegacyPass(), llvm::createInstructionCombiningPass(), llvm::createJumpThreadingPass(), llvm::createLibCallsShrinkWrapPass(), llvm::createLICMPass(), llvm::createLoopDeletionPass(), llvm::createLoopIdiomPass(), llvm::createLoopInstSimplifyPass(), llvm::createLoopInterchangePass(), llvm::createLoopRerollPass(), llvm::createLoopRotatePass(), llvm::createLoopSimplifyCFGPass(), llvm::createLoopUnswitchPass(), llvm::createLowerExpectIntrinsicPass(), llvm::createMemCpyOptPass(), llvm::createMergedLoadStoreMotionPass(), llvm::createNewGVNPass(), llvm::createPGOIndirectCallPromotionLegacyPass(), llvm::createPGOInstrumentationGenLegacyPass(), llvm::createPGOInstrumentationUseLegacyPass(), llvm::createPGOMemOPSizeOptLegacyPass(), llvm::createReassociatePass(), llvm::createSCCPPass(), llvm::createSimpleLoopUnrollPass(), llvm::createSimpleLoopUnswitchLegacyPass(), llvm::createSpeculativeExecutionIfHasBranchDivergencePass(), llvm::createSROAPass(), llvm::createTailCallEliminationPass(), llvm::InlineParams::DefaultThreshold, llvm::InstrProfOptions::DoCounterPromotion, llvm::InlineParams::HintThreshold, llvm::InstrProfOptions::InstrProfileOutput, PreInlineThreshold, and llvm::InstrProfOptions::UseBFIInPromotion.
Referenced by LLVMPassManagerBuilderPopulateFunctionPassManager().
| void PassManagerBuilder::populateLTOPassManager | ( | legacy::PassManagerBase & | PM | ) |
Definition at line 1064 of file PassManagerBuilder.cpp.
References llvm::legacy::PassManagerBase::add(), llvm::createCrossDSOCFIPass(), llvm::createLowerTypeTestsPass(), llvm::createVerifierPass(), and llvm::createWholeProgramDevirtPass().
Referenced by LLVMPassManagerBuilderPopulateLTOPassManager().
| void PassManagerBuilder::populateModulePassManager | ( | legacy::PassManagerBase & | MPM | ) |
populateModulePassManager - This sets up the primary pass manager.
Definition at line 468 of file PassManagerBuilder.cpp.
References llvm::legacy::PassManagerBase::add(), llvm::createAggressiveInstCombinerPass(), llvm::createAlignmentFromAssumptionsPass(), llvm::createArgumentPromotionPass(), llvm::createAttributorLegacyPass(), llvm::createBarrierNoopPass(), llvm::createBitTrackingDCEPass(), llvm::createCalledValuePropagationPass(), llvm::createCallSiteSplittingPass(), llvm::createCanonicalizeAliasesPass(), llvm::createCFGSimplificationPass(), llvm::createConstantMergePass(), llvm::createCorrelatedValuePropagationPass(), llvm::createDeadArgEliminationPass(), llvm::createDeadStoreEliminationPass(), llvm::createDivRemPairsPass(), llvm::createEarlyCSEPass(), llvm::createEliminateAvailableExternallyPass(), llvm::createFloat2IntPass(), llvm::createForceFunctionAttrsLegacyPass(), llvm::createGlobalDCEPass(), llvm::createGlobalOptimizerPass(), llvm::createGlobalsAAWrapperPass(), llvm::createGlobalSplitPass(), llvm::createGVNPass(), llvm::createHotColdSplittingPass(), llvm::createIndVarSimplifyPass(), llvm::createInferFunctionAttrsLegacyPass(), llvm::createInstrOrderFilePass(), llvm::createInstSimplifyLegacyPass(), llvm::createIPSCCPPass(), llvm::createJumpThreadingPass(), llvm::createLICMPass(), llvm::createLoopDeletionPass(), llvm::createLoopDistributePass(), llvm::createLoopInterchangePass(), llvm::createLoopLoadEliminationPass(), llvm::createLoopRotatePass(), llvm::createLoopSinkPass(), llvm::createLoopUnrollAndJamPass(), llvm::createLoopUnrollPass(), llvm::createLoopUnswitchPass(), llvm::createLoopVectorizePass(), llvm::createLoopVersioningLICMPass(), llvm::createLowerConstantIntrinsicsPass(), llvm::createLowerMatrixIntrinsicsPass(), llvm::createMemCpyOptPass(), llvm::createMergedLoadStoreMotionPass(), llvm::createMergeFunctionsPass(), llvm::createNameAnonGlobalPass(), llvm::createNewGVNPass(), llvm::createPartialInliningPass(), llvm::createPGOIndirectCallPromotionLegacyPass(), llvm::createPGOInstrumentationGenCreateVarLegacyPass(), llvm::createPostOrderFunctionAttrsLegacyPass(), llvm::createPromoteMemoryToRegisterPass(), llvm::createPruneEHPass(), llvm::createReversePostOrderFunctionAttrsPass(), llvm::createSampleProfileLoaderPass(), llvm::createSCCPPass(), llvm::createSimpleLoopUnrollPass(), llvm::createSLPVectorizerPass(), llvm::createSROAPass(), llvm::createStripDeadPrototypesPass(), llvm::createTailCallEliminationPass(), llvm::createWarnMissedTransformationsPass(), llvm::createWholeProgramDevirtPass(), ExtraVectorizerPasses, GlobalExtensionsNotEmpty(), Inliner, and RunPartialInlining.
Referenced by LLVMPassManagerBuilderPopulateModulePassManager().
| void PassManagerBuilder::populateThinLTOPassManager | ( | legacy::PassManagerBase & | PM | ) |
Definition at line 1031 of file PassManagerBuilder.cpp.
References llvm::legacy::PassManagerBase::add(), llvm::createLowerTypeTestsPass(), llvm::createVerifierPass(), and llvm::createWholeProgramDevirtPass().
|
static |
Removes an extension that was previously added using addGlobalExtension.
This is also intended to be used by plugins, to remove any extension that was previously registered before being unloaded.
| ExtensionID | Identifier of the extension to be removed. |
Definition at line 214 of file PassManagerBuilder.cpp.
References assert(), llvm::find_if(), and GlobalExtensions.
Referenced by llvm::RegisterStandardPasses::~RegisterStandardPasses().
| bool llvm::PassManagerBuilder::DisableGVNLoadPRE |
Definition at line 163 of file PassManagerBuilder.h.
Referenced by llvm::LTOCodeGenerator::optimize().
| bool llvm::PassManagerBuilder::DisableTailCalls |
Definition at line 156 of file PassManagerBuilder.h.
| bool llvm::PassManagerBuilder::DisableUnrollLoops |
Definition at line 157 of file PassManagerBuilder.h.
Referenced by LLVMPassManagerBuilderSetDisableUnrollLoops().
| bool llvm::PassManagerBuilder::DivergentTarget |
Definition at line 171 of file PassManagerBuilder.h.
Referenced by llvm::AMDGPUTargetMachine::adjustPassManager().
| bool llvm::PassManagerBuilder::EnablePGOCSInstrGen |
Enable profile context sensitive instrumentation pass.
Definition at line 178 of file PassManagerBuilder.h.
| bool llvm::PassManagerBuilder::EnablePGOCSInstrUse |
Enable profile context sensitive profile use pass.
Definition at line 180 of file PassManagerBuilder.h.
| bool llvm::PassManagerBuilder::EnablePGOInstrGen |
Enable profile instrumentation pass.
Definition at line 176 of file PassManagerBuilder.h.
| ModuleSummaryIndex* llvm::PassManagerBuilder::ExportSummary = nullptr |
The module summary index to use for exporting information from the regular LTO phase, for example for the CFI and devirtualization type tests.
Definition at line 149 of file PassManagerBuilder.h.
| bool llvm::PassManagerBuilder::ForgetAllSCEVInLoopUnroll |
Definition at line 164 of file PassManagerBuilder.h.
| const ModuleSummaryIndex* llvm::PassManagerBuilder::ImportSummary = nullptr |
The module summary index to use for importing information to the thin LTO backends, for example for the CFI and devirtualization type tests.
Definition at line 154 of file PassManagerBuilder.h.
| Pass* llvm::PassManagerBuilder::Inliner |
Inliner - Specifies the inliner to use.
If this is non-null, it is added to the per-module passes.
Definition at line 144 of file PassManagerBuilder.h.
Referenced by llvm::AMDGPUTargetMachine::adjustPassManager(), LLVMPassManagerBuilderPopulateLTOPassManager(), and LLVMPassManagerBuilderUseInlinerWithThreshold().
| TargetLibraryInfoImpl* llvm::PassManagerBuilder::LibraryInfo |
LibraryInfo - Specifies information about the runtime library for the optimizer.
If this is non-null, it is added to both the function and per-module pass pipeline.
Definition at line 140 of file PassManagerBuilder.h.
| unsigned llvm::PassManagerBuilder::LicmMssaNoAccForPromotionCap |
Definition at line 173 of file PassManagerBuilder.h.
| unsigned llvm::PassManagerBuilder::LicmMssaOptCap |
Definition at line 172 of file PassManagerBuilder.h.
| bool llvm::PassManagerBuilder::LoopsInterleaved |
Definition at line 160 of file PassManagerBuilder.h.
| bool llvm::PassManagerBuilder::LoopVectorize |
Definition at line 159 of file PassManagerBuilder.h.
| bool llvm::PassManagerBuilder::MergeFunctions |
Definition at line 167 of file PassManagerBuilder.h.
| bool llvm::PassManagerBuilder::NewGVN |
Definition at line 162 of file PassManagerBuilder.h.
| unsigned llvm::PassManagerBuilder::OptLevel |
The Optimization Level - Specify the basic optimization level.
0 = -O0, 1 = -O1, 2 = -O2, 3 = -O3
Definition at line 131 of file PassManagerBuilder.h.
Referenced by LLVMPassManagerBuilderSetOptLevel().
| bool llvm::PassManagerBuilder::PerformThinLTO |
Definition at line 170 of file PassManagerBuilder.h.
| std::string llvm::PassManagerBuilder::PGOInstrGen |
Profile data file name that the instrumentation will be written to.
Definition at line 182 of file PassManagerBuilder.h.
| std::string llvm::PassManagerBuilder::PGOInstrUse |
Path of the profile data file.
Definition at line 184 of file PassManagerBuilder.h.
| std::string llvm::PassManagerBuilder::PGOSampleUse |
Path of the sample Profile data file.
Definition at line 186 of file PassManagerBuilder.h.
| bool llvm::PassManagerBuilder::PrepareForLTO |
Definition at line 168 of file PassManagerBuilder.h.
| bool llvm::PassManagerBuilder::PrepareForThinLTO |
Definition at line 169 of file PassManagerBuilder.h.
| bool llvm::PassManagerBuilder::RerollLoops |
Definition at line 161 of file PassManagerBuilder.h.
| unsigned llvm::PassManagerBuilder::SizeLevel |
SizeLevel - How much we're optimizing for size.
0 = none, 1 = -Os, 2 = -Oz
Definition at line 135 of file PassManagerBuilder.h.
Referenced by LLVMPassManagerBuilderSetSizeLevel().
| bool llvm::PassManagerBuilder::SLPVectorize |
Definition at line 158 of file PassManagerBuilder.h.
| bool llvm::PassManagerBuilder::VerifyInput |
Definition at line 165 of file PassManagerBuilder.h.
| bool llvm::PassManagerBuilder::VerifyOutput |
Definition at line 166 of file PassManagerBuilder.h.
1.8.13