LLVM  17.0.0git
Public Types | Public Member Functions | Public Attributes | List of all members
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:
Collaboration graph
[legend]

Public Types

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

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 DisableGVNLoadPRE
 
bool ForgetAllSCEVInLoopUnroll
 
bool VerifyInput
 
bool VerifyOutput
 
bool MergeFunctions
 
bool DivergentTarget
 
unsigned LicmMssaOptCap
 
unsigned LicmMssaNoAccForPromotionCap
 

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.

Member Typedef Documentation

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

Constructor & Destructor Documentation

◆ PassManagerBuilder()

PassManagerBuilder::PassManagerBuilder ( )

◆ ~PassManagerBuilder()

PassManagerBuilder::~PassManagerBuilder ( )

Definition at line 64 of file PassManagerBuilder.cpp.

References Inliner, and LibraryInfo.

Member Function Documentation

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

References llvm::legacy::FunctionPassManager::add(), llvm::createCFGSimplificationPass(), llvm::createEarlyCSEPass(), llvm::createLowerExpectIntrinsicPass(), llvm::createSROAPass(), LibraryInfo, and OptLevel.

◆ populateModulePassManager()

void PassManagerBuilder::populateModulePassManager ( legacy::PassManagerBase MPM)

Member Data Documentation

◆ CallGraphProfile

bool llvm::PassManagerBuilder::CallGraphProfile

Definition at line 94 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

◆ DisableGVNLoadPRE

bool llvm::PassManagerBuilder::DisableGVNLoadPRE

Definition at line 98 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

◆ DisableUnrollLoops

bool llvm::PassManagerBuilder::DisableUnrollLoops

Definition at line 93 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

◆ DivergentTarget

bool llvm::PassManagerBuilder::DivergentTarget

Definition at line 103 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 86 of file PassManagerBuilder.h.

◆ ForgetAllSCEVInLoopUnroll

bool llvm::PassManagerBuilder::ForgetAllSCEVInLoopUnroll

Definition at line 99 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 91 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 81 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 77 of file PassManagerBuilder.h.

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

◆ LicmMssaNoAccForPromotionCap

unsigned llvm::PassManagerBuilder::LicmMssaNoAccForPromotionCap

Definition at line 105 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

◆ LicmMssaOptCap

unsigned llvm::PassManagerBuilder::LicmMssaOptCap

Definition at line 104 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

◆ LoopsInterleaved

bool llvm::PassManagerBuilder::LoopsInterleaved

Definition at line 97 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

◆ LoopVectorize

bool llvm::PassManagerBuilder::LoopVectorize

Definition at line 96 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

◆ MergeFunctions

bool llvm::PassManagerBuilder::MergeFunctions

Definition at line 102 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder(), and populateModulePassManager().

◆ OptLevel

unsigned llvm::PassManagerBuilder::OptLevel

The Optimization Level - Specify the basic optimization level.

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

Definition at line 68 of file PassManagerBuilder.h.

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

◆ SizeLevel

unsigned llvm::PassManagerBuilder::SizeLevel

SizeLevel - How much we're optimizing for size.

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

Definition at line 72 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder(), and populateModulePassManager().

◆ SLPVectorize

bool llvm::PassManagerBuilder::SLPVectorize

Definition at line 95 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

◆ VerifyInput

bool llvm::PassManagerBuilder::VerifyInput

Definition at line 100 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().

◆ VerifyOutput

bool llvm::PassManagerBuilder::VerifyOutput

Definition at line 101 of file PassManagerBuilder.h.

Referenced by PassManagerBuilder().


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