LLVM API Documentation
#include <PassManagerBuilder.h>
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 Transforms/IPO/PassManagerBuilder.h.
typedef void(* llvm::PassManagerBuilder::ExtensionFn)(const PassManagerBuilder &Builder, PassManagerBase &PM) |
Extensions are passed the builder itself (so they can see how it is configured) as well as the pass manager to add stuff to.
Definition at line 61 of file Transforms/IPO/PassManagerBuilder.h.
Definition at line 63 of file Transforms/IPO/PassManagerBuilder.h.
Definition at line 77 of file PassManagerBuilder.cpp.
References BBVectorize, DisableGVNLoadPRE, DisableTailCalls, DisableUnitAtATime, DisableUnrollLoops, LibraryInfo, LoadCombine, LoopVectorize, MergeFunctions, OptLevel, RerollLoops, RunBBVectorization, RunLoadCombine, RunLoopRerolling, RunLoopVectorization, RunSLPVectorization, SizeLevel, SLPVectorize, StripDebug, VerifyInput, and VerifyOutput.
Definition at line 97 of file PassManagerBuilder.cpp.
References Inliner, and LibraryInfo.
void PassManagerBuilder::addExtension | ( | ExtensionPointTy | Ty, |
ExtensionFn | Fn | ||
) |
Definition at line 112 of file PassManagerBuilder.cpp.
void PassManagerBuilder::addGlobalExtension | ( | PassManagerBuilder::ExtensionPointTy | Ty, |
PassManagerBuilder::ExtensionFn | Fn | ||
) | [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 106 of file PassManagerBuilder.cpp.
References GlobalExtensions.
Referenced by llvm::RegisterStandardPasses::RegisterStandardPasses().
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 138 of file PassManagerBuilder.cpp.
References llvm::createCFGSimplificationPass(), llvm::createEarlyCSEPass(), llvm::createLowerExpectIntrinsicPass(), llvm::createScalarReplAggregatesPass(), llvm::createSROAPass(), EP_EarlyAsPossible, LibraryInfo, OptLevel, and UseNewSROA.
Referenced by LLVMPassManagerBuilderPopulateFunctionPassManager().
void PassManagerBuilder::populateLTOPassManager | ( | PassManagerBase & | PM, |
TargetMachine * | TM = nullptr |
||
) |
Definition at line 442 of file PassManagerBuilder.cpp.
References llvm::TargetMachine::addAnalysisPasses(), llvm::createDebugInfoVerifierPass(), llvm::createStripSymbolsPass(), llvm::createVerifierPass(), LibraryInfo, OptLevel, StripDebug, VerifyInput, and VerifyOutput.
Referenced by LLVMPassManagerBuilderPopulateLTOPassManager().
void PassManagerBuilder::populateModulePassManager | ( | PassManagerBase & | MPM | ) |
populateModulePassManager - This sets up the primary pass manager.
Definition at line 157 of file PassManagerBuilder.cpp.
References BBVectorize, llvm::createAggressiveDCEPass(), llvm::createAlignmentFromAssumptionsPass(), llvm::createArgumentPromotionPass(), llvm::createBarrierNoopPass(), llvm::createBBVectorizePass(), llvm::createCFGSimplificationPass(), llvm::createConstantMergePass(), llvm::createCorrelatedValuePropagationPass(), llvm::createDeadArgEliminationPass(), llvm::createDeadStoreEliminationPass(), llvm::createEarlyCSEPass(), llvm::createFunctionAttrsPass(), llvm::createGlobalDCEPass(), llvm::createGlobalOptimizerPass(), llvm::createGVNPass(), llvm::createIndVarSimplifyPass(), llvm::createInstructionCombiningPass(), llvm::createIPSCCPPass(), llvm::createJumpThreadingPass(), llvm::createLICMPass(), llvm::createLoadCombinePass(), llvm::createLoopDeletionPass(), llvm::createLoopIdiomPass(), llvm::createLoopRerollPass(), llvm::createLoopRotatePass(), llvm::createLoopUnrollPass(), llvm::createLoopUnswitchPass(), llvm::createLoopVectorizePass(), llvm::createMemCpyOptPass(), llvm::createMergedLoadStoreMotionPass(), llvm::createMergeFunctionsPass(), llvm::createPruneEHPass(), llvm::createReassociatePass(), llvm::createScalarReplAggregatesPass(), llvm::createSCCPPass(), llvm::createSimpleLoopUnrollPass(), llvm::createSLPVectorizerPass(), llvm::createSROAPass(), llvm::createStripDeadPrototypesPass(), llvm::createTailCallEliminationPass(), DisableGVNLoadPRE, DisableTailCalls, DisableUnitAtATime, DisableUnrollLoops, EnableMLSM, EP_EnabledOnOptLevel0, EP_LoopOptimizerEnd, EP_ModuleOptimizerEarly, EP_OptimizerLast, EP_Peephole, EP_ScalarOptimizerLate, GlobalExtensions, LibraryInfo, LoadCombine, LoopVectorize, MergeFunctions, OptLevel, RerollLoops, RunSLPAfterLoopVectorization, SizeLevel, SLPVectorize, UseGVNAfterVectorization, and UseNewSROA.
Referenced by LLVMPassManagerBuilderPopulateModulePassManager().
Definition at line 117 of file Transforms/IPO/PassManagerBuilder.h.
Referenced by PassManagerBuilder(), and populateModulePassManager().
Definition at line 122 of file Transforms/IPO/PassManagerBuilder.h.
Referenced by PassManagerBuilder(), and populateModulePassManager().
Definition at line 114 of file Transforms/IPO/PassManagerBuilder.h.
Referenced by PassManagerBuilder(), and populateModulePassManager().
Definition at line 115 of file Transforms/IPO/PassManagerBuilder.h.
Referenced by LLVMPassManagerBuilderSetDisableUnitAtATime(), PassManagerBuilder(), and populateModulePassManager().
Definition at line 116 of file Transforms/IPO/PassManagerBuilder.h.
Referenced by LLVMPassManagerBuilderSetDisableUnrollLoops(), PassManagerBuilder(), and populateModulePassManager().
Inliner - Specifies the inliner to use. If this is non-null, it is added to the per-module passes.
Definition at line 112 of file Transforms/IPO/PassManagerBuilder.h.
Referenced by LLVMPassManagerBuilderPopulateLTOPassManager(), LLVMPassManagerBuilderUseInlinerWithThreshold(), and ~PassManagerBuilder().
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 108 of file Transforms/IPO/PassManagerBuilder.h.
Referenced by PassManagerBuilder(), populateFunctionPassManager(), populateLTOPassManager(), populateModulePassManager(), and ~PassManagerBuilder().
Definition at line 121 of file Transforms/IPO/PassManagerBuilder.h.
Referenced by PassManagerBuilder(), and populateModulePassManager().
Definition at line 119 of file Transforms/IPO/PassManagerBuilder.h.
Referenced by PassManagerBuilder(), and populateModulePassManager().
Definition at line 126 of file Transforms/IPO/PassManagerBuilder.h.
Referenced by PassManagerBuilder(), and populateModulePassManager().
The Optimization Level - Specify the basic optimization level. 0 = -O0, 1 = -O1, 2 = -O2, 3 = -O3
Definition at line 99 of file Transforms/IPO/PassManagerBuilder.h.
Referenced by LLVMPassManagerBuilderSetOptLevel(), PassManagerBuilder(), populateFunctionPassManager(), populateLTOPassManager(), and populateModulePassManager().
Definition at line 120 of file Transforms/IPO/PassManagerBuilder.h.
Referenced by PassManagerBuilder(), and populateModulePassManager().
SizeLevel - How much we're optimizing for size. 0 = none, 1 = -Os, 2 = -Oz
Definition at line 103 of file Transforms/IPO/PassManagerBuilder.h.
Referenced by LLVMPassManagerBuilderSetSizeLevel(), PassManagerBuilder(), and populateModulePassManager().
Definition at line 118 of file Transforms/IPO/PassManagerBuilder.h.
Referenced by PassManagerBuilder(), and populateModulePassManager().
Definition at line 125 of file Transforms/IPO/PassManagerBuilder.h.
Referenced by PassManagerBuilder(), and populateLTOPassManager().
Definition at line 123 of file Transforms/IPO/PassManagerBuilder.h.
Referenced by PassManagerBuilder(), and populateLTOPassManager().
Definition at line 124 of file Transforms/IPO/PassManagerBuilder.h.
Referenced by PassManagerBuilder(), and populateLTOPassManager().