LLVM API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Public Attributes
llvm::PassManagerBuilder Class Reference

#include <PassManagerBuilder.h>

Collaboration diagram for llvm::PassManagerBuilder:
Collaboration graph
[legend]

List of all members.

Public Types

enum  ExtensionPointTy {
  EP_EarlyAsPossible, EP_ModuleOptimizerEarly, EP_LoopOptimizerEnd, EP_ScalarOptimizerLate,
  EP_OptimizerLast, EP_EnabledOnOptLevel0, EP_Peephole
}
typedef void(* ExtensionFn )(const PassManagerBuilder &Builder, PassManagerBase &PM)

Public Member Functions

 PassManagerBuilder ()
 ~PassManagerBuilder ()
void addExtension (ExtensionPointTy Ty, ExtensionFn Fn)
void populateFunctionPassManager (FunctionPassManager &FPM)
void populateModulePassManager (PassManagerBase &MPM)
 populateModulePassManager - This sets up the primary pass manager.
void populateLTOPassManager (PassManagerBase &PM, TargetMachine *TM=nullptr)

Static Public Member Functions

static void addGlobalExtension (ExtensionPointTy Ty, ExtensionFn Fn)

Public Attributes

unsigned OptLevel
unsigned SizeLevel
TargetLibraryInfoLibraryInfo
PassInliner
bool DisableTailCalls
bool DisableUnitAtATime
bool DisableUnrollLoops
bool BBVectorize
bool SLPVectorize
bool LoopVectorize
bool RerollLoops
bool LoadCombine
bool DisableGVNLoadPRE
bool VerifyInput
bool VerifyOutput
bool StripDebug
bool MergeFunctions

Detailed Description

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.


Member Typedef Documentation

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.


Member Enumeration Documentation

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_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.

Definition at line 63 of file Transforms/IPO/PassManagerBuilder.h.


Constructor & Destructor Documentation

Definition at line 97 of file PassManagerBuilder.cpp.

References Inliner, and LibraryInfo.


Member Function Documentation

Definition at line 112 of file PassManagerBuilder.cpp.

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 
)
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().


Member Data Documentation

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().

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().

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().


The documentation for this class was generated from the following files: