class PassManagerBuilder

Declaration

class PassManagerBuilder { /* full declaration omitted */ };

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

Declared at: llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h:57

Member Variables

public unsigned int OptLevel
The Optimization Level - Specify the basic optimization level. 0 = -O0, 1 = -O1, 2 = -O2, 3 = -O3
public unsigned int SizeLevel
SizeLevel - How much we're optimizing for size. 0 = none, 1 = -Os, 2 = -Oz
public llvm::TargetLibraryInfoImpl* 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.
public llvm::Pass* Inliner
Inliner - Specifies the inliner to use. If this is non-null, it is added to the per-module passes.
public llvm::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.
public const llvm::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.
public bool DisableUnrollLoops
public bool CallGraphProfile
public bool SLPVectorize
public bool LoopVectorize
public bool LoopsInterleaved
public bool RerollLoops
public bool NewGVN
public bool DisableGVNLoadPRE
public bool ForgetAllSCEVInLoopUnroll
public bool VerifyInput
public bool VerifyOutput
public bool MergeFunctions
public bool DivergentTarget
public unsigned int LicmMssaOptCap
public unsigned int LicmMssaNoAccForPromotionCap
private std::vector< std::pair<ExtensionPointTy, ExtensionFn>> Extensions
ExtensionList - This is list of all of the extensions that are registered.

Method Overview

Methods

PassManagerBuilder()

Declared at: llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h:176

void addExtension(
    llvm::PassManagerBuilder::ExtensionPointTy Ty,
    llvm::PassManagerBuilder::ExtensionFn Fn)

Declared at: llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h:192

Parameters

llvm::PassManagerBuilder::ExtensionPointTy Ty
llvm::PassManagerBuilder::ExtensionFn Fn

void addExtensionsToPM(
    llvm::PassManagerBuilder::ExtensionPointTy
        ETy,
    legacy::PassManagerBase& PM) const

Declared at: llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h:195

Parameters

llvm::PassManagerBuilder::ExtensionPointTy ETy
legacy::PassManagerBase& PM

void addFunctionSimplificationPasses(
    legacy::PassManagerBase& MPM)

Declared at: llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h:198

Parameters

legacy::PassManagerBase& MPM

static llvm::PassManagerBuilder::GlobalExtensionID
addGlobalExtension(
    llvm::PassManagerBuilder::ExtensionPointTy Ty,
    llvm::PassManagerBuilder::ExtensionFn Fn)

Description

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.

Declared at: llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h:184

Parameters

llvm::PassManagerBuilder::ExtensionPointTy Ty
llvm::PassManagerBuilder::ExtensionFn Fn

Returns

A global extension identifier that can be used to remove the extension.

void addInitialAliasAnalysisPasses(
    legacy::PassManagerBase& PM) const

Declared at: llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h:197

Parameters

legacy::PassManagerBase& PM

void addVectorPasses(legacy::PassManagerBase& PM,
                     bool IsFullLTO)

Description

FIXME: Should LTO cause any differences to this set of passes?

Declared at: llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h:199

Parameters

legacy::PassManagerBase& PM
bool IsFullLTO

void populateFunctionPassManager(
    legacy::FunctionPassManager& FPM)

Description

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.

Declared at: llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h:205

Parameters

legacy::FunctionPassManager& FPM

void populateModulePassManager(
    legacy::PassManagerBase& MPM)

Description

populateModulePassManager - This sets up the primary pass manager.

Declared at: llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h:208

Parameters

legacy::PassManagerBase& MPM

static void removeGlobalExtension(
    llvm::PassManagerBuilder::GlobalExtensionID
        ExtensionID)

Description

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.

Declared at: llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h:191

Parameters

llvm::PassManagerBuilder::GlobalExtensionID ExtensionID
Identifier of the extension to be removed.

~PassManagerBuilder()

Declared at: llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h:177