LLVM  15.0.0git
llvm::PassManagerBuilder Class Reference

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"

Collaboration diagram for llvm::PassManagerBuilder:
[legend]

## Public Types

enum  ExtensionPointTy {
EP_EarlyAsPossible, EP_ModuleOptimizerEarly, EP_LoopOptimizerEnd, EP_ScalarOptimizerLate,
EP_OptimizerLast, EP_VectorizerStart, EP_EnabledOnOptLevel0, EP_Peephole,
EP_LateLoopOptimizations, EP_CGSCCOptimizerLate, EP_FullLinkTimeOptimizationEarly, EP_FullLinkTimeOptimizationLast
}

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 addExtension (ExtensionPointTy Ty, ExtensionFn Fn)

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

## Static Public Member Functions

static GlobalExtensionID addGlobalExtension (ExtensionPointTy Ty, ExtensionFn Fn)
Adds an extension that will be used by all PassManagerBuilder instances. More...

static void removeGlobalExtension (GlobalExtensionID ExtensionID)
Removes an extension that was previously added using addGlobalExtension. 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...

TargetLibraryInfoImplLibraryInfo
LibraryInfo - Specifies information about the runtime library for the optimizer. More...

PassInliner
Inliner - Specifies the inliner to use. More...

ModuleSummaryIndexExportSummary = 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 ModuleSummaryIndexImportSummary = 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 RerollLoops

bool NewGVN

bool DisableGVNLoadPRE

bool ForgetAllSCEVInLoopUnroll

bool VerifyInput

bool VerifyOutput

bool MergeFunctions

bool PrepareForLTO

bool PrepareForThinLTO

bool PerformThinLTO

bool DivergentTarget

unsigned LicmMssaOptCap

unsigned LicmMssaNoAccForPromotionCap

bool EnablePGOInstrGen
Enable profile instrumentation pass. More...

bool EnablePGOCSInstrGen
Enable profile context sensitive instrumentation pass. More...

bool EnablePGOCSInstrUse
Enable profile context sensitive profile use pass. More...

std::string PGOInstrGen
Profile data file name that the instrumentation will be written to. More...

std::string PGOInstrUse
Path of the profile data file. More...

std::string PGOSampleUse
Path of the sample Profile data file. More...

## 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 PassManagerBuilder.h.

## ◆ ExtensionFn

 typedef std::function 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.

## ◆ GlobalExtensionID

Definition at line 64 of file PassManagerBuilder.h.

## ◆ ExtensionPointTy

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_VectorizerStart

EP_VectorizerStart - This extension point allows adding optimization passes before the vectorizer and other highly target specific optimization passes are executed.

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.

EP_LateLoopOptimizations

EP_LateLoopOptimizations - This extension point allows adding late loop canonicalization and simplification passes.

This is the last point in the loop optimization pipeline before loop deletion. Each pass added here must be an instance of LoopPass. This is the place to add passes that can remove loops, such as target- specific loop idiom recognition.

EP_CGSCCOptimizerLate

EP_CGSCCOptimizerLate - This extension point allows adding CallGraphSCC passes at the end of the main CallGraphSCC passes and before any function simplification passes run by CGPassManager.

EP_FullLinkTimeOptimizationEarly

EP_FullLinkTimeOptimizationEarly - This extensions point allow adding passes that run at Link Time, before Full Link Time Optimization.

EP_FullLinkTimeOptimizationLast

EP_FullLinkTimeOptimizationLast - This extensions point allow adding passes that run at Link Time, after Full Link Time Optimization.

Definition at line 66 of file PassManagerBuilder.h.

## ◆ PassManagerBuilder()

 PassManagerBuilder::PassManagerBuilder ( )

## ◆ ~PassManagerBuilder()

 PassManagerBuilder::~PassManagerBuilder ( )

Definition at line 209 of file PassManagerBuilder.cpp.

References Inliner, and LibraryInfo.

## ◆ addExtension()

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

Definition at line 255 of file PassManagerBuilder.cpp.

References move.

Referenced by llvm::HexagonTargetMachine::adjustPassManager().

## ◆ addGlobalExtension()

 PassManagerBuilder::GlobalExtensionID 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.

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

Definition at line 231 of file PassManagerBuilder.cpp.

References GlobalExtensions, GlobalExtensionsCounter, and move.

Referenced by llvm::RegisterStandardPasses::RegisterStandardPasses().

## ◆ populateFunctionPassManager()

 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 296 of file PassManagerBuilder.cpp.

## ◆ removeGlobalExtension()

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

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.

Parameters
 ExtensionID Identifier of the extension to be removed.

Definition at line 238 of file PassManagerBuilder.cpp.

References assert(), llvm::find_if(), and GlobalExtensions.

Referenced by llvm::RegisterStandardPasses::~RegisterStandardPasses().

## ◆ CallGraphProfile

 bool llvm::PassManagerBuilder::CallGraphProfile

Definition at line 156 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder(), and populateModulePassManager().

## ◆ DisableGVNLoadPRE

 bool llvm::PassManagerBuilder::DisableGVNLoadPRE

Definition at line 162 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

## ◆ DisableUnrollLoops

 bool llvm::PassManagerBuilder::DisableUnrollLoops

Definition at line 155 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder(), and populateModulePassManager().

## ◆ DivergentTarget

 bool llvm::PassManagerBuilder::DivergentTarget

Definition at line 170 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

## ◆ EnablePGOCSInstrGen

 bool llvm::PassManagerBuilder::EnablePGOCSInstrGen

Enable profile context sensitive instrumentation pass.

Definition at line 177 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

## ◆ EnablePGOCSInstrUse

 bool llvm::PassManagerBuilder::EnablePGOCSInstrUse

Enable profile context sensitive profile use pass.

Definition at line 179 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

## ◆ EnablePGOInstrGen

 bool llvm::PassManagerBuilder::EnablePGOInstrGen

Enable profile instrumentation pass.

Definition at line 175 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

## ◆ ExportSummary

 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 148 of file PassManagerBuilder.h.

## ◆ ForgetAllSCEVInLoopUnroll

 bool llvm::PassManagerBuilder::ForgetAllSCEVInLoopUnroll

Definition at line 163 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

## ◆ ImportSummary

 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 153 of file PassManagerBuilder.h.

## ◆ Inliner

 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 143 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder(), populateModulePassManager(), and ~PassManagerBuilder().

## ◆ LibraryInfo

 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 139 of file PassManagerBuilder.h.

## ◆ LicmMssaNoAccForPromotionCap

 unsigned llvm::PassManagerBuilder::LicmMssaNoAccForPromotionCap

Definition at line 172 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder(), and populateModulePassManager().

## ◆ LicmMssaOptCap

 unsigned llvm::PassManagerBuilder::LicmMssaOptCap

Definition at line 171 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder(), and populateModulePassManager().

## ◆ LoopsInterleaved

 bool llvm::PassManagerBuilder::LoopsInterleaved

Definition at line 159 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

## ◆ LoopVectorize

 bool llvm::PassManagerBuilder::LoopVectorize

Definition at line 158 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

## ◆ MergeFunctions

 bool llvm::PassManagerBuilder::MergeFunctions

Definition at line 166 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder(), and populateModulePassManager().

## ◆ NewGVN

 bool llvm::PassManagerBuilder::NewGVN

Definition at line 161 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

## ◆ OptLevel

 unsigned llvm::PassManagerBuilder::OptLevel

The Optimization Level - Specify the basic optimization level.

0 = -O0, 1 = -O1, 2 = -O2, 3 = -O3

Definition at line 130 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder(), populateFunctionPassManager(), and populateModulePassManager().

## ◆ PerformThinLTO

 bool llvm::PassManagerBuilder::PerformThinLTO

Definition at line 169 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder(), and populateModulePassManager().

## ◆ PGOInstrGen

 std::string llvm::PassManagerBuilder::PGOInstrGen

Profile data file name that the instrumentation will be written to.

Definition at line 181 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

## ◆ PGOInstrUse

 std::string llvm::PassManagerBuilder::PGOInstrUse

Path of the profile data file.

Definition at line 183 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

## ◆ PGOSampleUse

 std::string llvm::PassManagerBuilder::PGOSampleUse

Path of the sample Profile data file.

Definition at line 185 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder(), and populateModulePassManager().

## ◆ PrepareForLTO

 bool llvm::PassManagerBuilder::PrepareForLTO

Definition at line 167 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder(), and populateModulePassManager().

## ◆ PrepareForThinLTO

 bool llvm::PassManagerBuilder::PrepareForThinLTO

Definition at line 168 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder(), and populateModulePassManager().

## ◆ RerollLoops

 bool llvm::PassManagerBuilder::RerollLoops

Definition at line 160 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

## ◆ SizeLevel

 unsigned llvm::PassManagerBuilder::SizeLevel

SizeLevel - How much we're optimizing for size.

0 = none, 1 = -Os, 2 = -Oz

Definition at line 134 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder(), and populateModulePassManager().

## ◆ SLPVectorize

 bool llvm::PassManagerBuilder::SLPVectorize

Definition at line 157 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

## ◆ VerifyInput

 bool llvm::PassManagerBuilder::VerifyInput

Definition at line 164 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

## ◆ VerifyOutput

 bool llvm::PassManagerBuilder::VerifyOutput

Definition at line 165 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

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