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:58

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 DisableTailCalls
public bool DisableUnrollLoops
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 PrepareForLTO
public bool PrepareForThinLTO
public bool PerformThinLTO
public bool DivergentTarget
public unsigned int LicmMssaOptCap
public unsigned int LicmMssaNoAccForPromotionCap
public bool EnablePGOInstrGen
Enable profile instrumentation pass.
public bool EnablePGOCSInstrGen
Enable profile context sensitive instrumentation pass.
public bool EnablePGOCSInstrUse
Enable profile context sensitive profile use pass.
public std::string PGOInstrGen
Profile data file name that the instrumentation will be written to.
public std::string PGOInstrUse
Path of the profile data file.
public std::string PGOSampleUse
Path of the sample Profile data file.

Method Overview

Methods

PassManagerBuilder()

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

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

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

Parameters

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

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:201

Parameters

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

Returns

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

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:225

Parameters

legacy::FunctionPassManager& FPM

void populateLTOPassManager(
    legacy::PassManagerBase& PM)

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

Parameters

legacy::PassManagerBase& PM

void populateModulePassManager(
    legacy::PassManagerBase& MPM)

Description

populateModulePassManager - This sets up the primary pass manager.

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

Parameters

legacy::PassManagerBase& MPM

void populateThinLTOPassManager(
    legacy::PassManagerBase& PM)

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

Parameters

legacy::PassManagerBase& PM

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:208

Parameters

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

~PassManagerBuilder()

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