LLVM
17.0.0git
|
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 | |
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 | 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... | |
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 | DisableUnrollLoops |
bool | CallGraphProfile |
bool | SLPVectorize |
bool | LoopVectorize |
bool | LoopsInterleaved |
bool | DisableGVNLoadPRE |
bool | ForgetAllSCEVInLoopUnroll |
bool | VerifyInput |
bool | VerifyOutput |
bool | MergeFunctions |
bool | DivergentTarget |
unsigned | LicmMssaOptCap |
unsigned | LicmMssaNoAccForPromotionCap |
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 57 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 63 of file PassManagerBuilder.h.
Definition at line 64 of file PassManagerBuilder.h.
PassManagerBuilder::PassManagerBuilder | ( | ) |
Definition at line 44 of file PassManagerBuilder.cpp.
References CallGraphProfile, DisableGVNLoadPRE, DisableUnrollLoops, DivergentTarget, ForgetAllSCEVInLoopUnroll, llvm::ForgetSCEVInLoopUnroll, Inliner, LibraryInfo, LicmMssaNoAccForPromotionCap, LicmMssaOptCap, LoopsInterleaved, LoopVectorize, MergeFunctions, OptLevel, llvm::SetLicmMssaNoAccForPromotionCap, llvm::SetLicmMssaOptCap, SizeLevel, SLPVectorize, VerifyInput, and VerifyOutput.
PassManagerBuilder::~PassManagerBuilder | ( | ) |
Definition at line 64 of file PassManagerBuilder.cpp.
References Inliner, and LibraryInfo.
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 78 of file PassManagerBuilder.cpp.
References llvm::legacy::FunctionPassManager::add(), llvm::createCFGSimplificationPass(), llvm::createEarlyCSEPass(), llvm::createLowerExpectIntrinsicPass(), llvm::createSROAPass(), LibraryInfo, and OptLevel.
void PassManagerBuilder::populateModulePassManager | ( | legacy::PassManagerBase & | MPM | ) |
populateModulePassManager - This sets up the primary pass manager.
Definition at line 290 of file PassManagerBuilder.cpp.
References llvm::createAnnotation2MetadataLegacyPass(), llvm::createBarrierNoopPass(), llvm::createCalledValuePropagationPass(), llvm::createCallSiteSplittingPass(), llvm::createCFGSimplificationPass(), llvm::createConstantMergePass(), llvm::createDeadArgEliminationPass(), llvm::createDivRemPairsPass(), llvm::createEliminateAvailableExternallyPass(), llvm::createFloat2IntPass(), llvm::createForceFunctionAttrsLegacyPass(), llvm::createGlobalDCEPass(), llvm::createGlobalOptimizerPass(), llvm::createGlobalsAAWrapperPass(), llvm::createInferFunctionAttrsLegacyPass(), llvm::createInstructionCombiningPass(), llvm::createInstSimplifyLegacyPass(), llvm::createIPSCCPPass(), llvm::createLoopDistributePass(), llvm::createLoopRotatePass(), llvm::createLoopSinkPass(), llvm::createLowerConstantIntrinsicsPass(), llvm::createMergeFunctionsPass(), llvm::createPostOrderFunctionAttrsLegacyPass(), llvm::createPromoteMemoryToRegisterPass(), llvm::createReversePostOrderFunctionAttrsPass(), llvm::createStripDeadPrototypesPass(), Inliner, LibraryInfo, MergeFunctions, MPM, OptLevel, and SizeLevel.
bool llvm::PassManagerBuilder::CallGraphProfile |
Definition at line 94 of file PassManagerBuilder.h.
Referenced by PassManagerBuilder().
bool llvm::PassManagerBuilder::DisableGVNLoadPRE |
Definition at line 98 of file PassManagerBuilder.h.
Referenced by PassManagerBuilder().
bool llvm::PassManagerBuilder::DisableUnrollLoops |
Definition at line 93 of file PassManagerBuilder.h.
Referenced by PassManagerBuilder().
bool llvm::PassManagerBuilder::DivergentTarget |
Definition at line 103 of file PassManagerBuilder.h.
Referenced by PassManagerBuilder().
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 86 of file PassManagerBuilder.h.
bool llvm::PassManagerBuilder::ForgetAllSCEVInLoopUnroll |
Definition at line 99 of file PassManagerBuilder.h.
Referenced by PassManagerBuilder().
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 91 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 81 of file PassManagerBuilder.h.
Referenced by PassManagerBuilder(), populateModulePassManager(), and ~PassManagerBuilder().
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 77 of file PassManagerBuilder.h.
Referenced by PassManagerBuilder(), populateFunctionPassManager(), populateModulePassManager(), and ~PassManagerBuilder().
unsigned llvm::PassManagerBuilder::LicmMssaNoAccForPromotionCap |
Definition at line 105 of file PassManagerBuilder.h.
Referenced by PassManagerBuilder().
unsigned llvm::PassManagerBuilder::LicmMssaOptCap |
Definition at line 104 of file PassManagerBuilder.h.
Referenced by PassManagerBuilder().
bool llvm::PassManagerBuilder::LoopsInterleaved |
Definition at line 97 of file PassManagerBuilder.h.
Referenced by PassManagerBuilder().
bool llvm::PassManagerBuilder::LoopVectorize |
Definition at line 96 of file PassManagerBuilder.h.
Referenced by PassManagerBuilder().
bool llvm::PassManagerBuilder::MergeFunctions |
Definition at line 102 of file PassManagerBuilder.h.
Referenced by PassManagerBuilder(), and populateModulePassManager().
unsigned llvm::PassManagerBuilder::OptLevel |
The Optimization Level - Specify the basic optimization level.
0 = -O0, 1 = -O1, 2 = -O2, 3 = -O3
Definition at line 68 of file PassManagerBuilder.h.
Referenced by PassManagerBuilder(), populateFunctionPassManager(), and populateModulePassManager().
unsigned llvm::PassManagerBuilder::SizeLevel |
SizeLevel - How much we're optimizing for size.
0 = none, 1 = -Os, 2 = -Oz
Definition at line 72 of file PassManagerBuilder.h.
Referenced by PassManagerBuilder(), and populateModulePassManager().
bool llvm::PassManagerBuilder::SLPVectorize |
Definition at line 95 of file PassManagerBuilder.h.
Referenced by PassManagerBuilder().
bool llvm::PassManagerBuilder::VerifyInput |
Definition at line 100 of file PassManagerBuilder.h.
Referenced by PassManagerBuilder().
bool llvm::PassManagerBuilder::VerifyOutput |
Definition at line 101 of file PassManagerBuilder.h.
Referenced by PassManagerBuilder().