LLVM  3.7.0
Public Member Functions | List of all members
llvm::PassBuilder Class Reference

This class provides access to building LLVM's passes. More...

#include <PassBuilder.h>

Public Member Functions

 PassBuilder (TargetMachine *TM=nullptr)
 
void registerModuleAnalyses (ModuleAnalysisManager &MAM)
 Registers all available module analysis passes. More...
 
void registerCGSCCAnalyses (CGSCCAnalysisManager &CGAM)
 Registers all available CGSCC analysis passes. More...
 
void registerFunctionAnalyses (FunctionAnalysisManager &FAM)
 Registers all available function analysis passes. More...
 
bool parsePassPipeline (ModulePassManager &MPM, StringRef PipelineText, bool VerifyEachPass=true, bool DebugLogging=false)
 Parse a textual pass pipeline description into a ModulePassManager. More...
 

Detailed Description

This class provides access to building LLVM's passes.

It's members provide the baseline state available to passes during their construction. The PassRegistry.def file specifies how to construct all of the built-in passes, and those may reference these members during construction.

Definition at line 32 of file PassBuilder.h.

Constructor & Destructor Documentation

llvm::PassBuilder::PassBuilder ( TargetMachine TM = nullptr)
inlineexplicit

Definition at line 36 of file PassBuilder.h.

Member Function Documentation

bool PassBuilder::parsePassPipeline ( ModulePassManager MPM,
StringRef  PipelineText,
bool  VerifyEachPass = true,
bool  DebugLogging = false 
)

Parse a textual pass pipeline description into a ModulePassManager.

The format of the textual pass pipeline description looks something like:

module(function(instcombine,sroa),dce,cgscc(inliner,function(...)),...)

Pass managers have ()s describing the nest structure of passes. All passes are comma separated. As a special shortcut, if the very first pass is not a module pass (as a module pass manager is), this will automatically form the shortest stack of pass managers that allow inserting that first pass. So, assuming function passes 'fpassN', CGSCC passes 'cgpassN', and loop passes 'lpassN', all of these are valid:

fpass1,fpass2,fpass3 cgpass1,cgpass2,cgpass3 lpass1,lpass2,lpass3

And they are equivalent to the following (resp.):

module(function(fpass1,fpass2,fpass3)) module(cgscc(cgpass1,cgpass2,cgpass3)) module(function(loop(lpass1,lpass2,lpass3)))

This shortcut is especially useful for debugging and testing small pass combinations. Note that these shortcuts don't introduce any other magic. If the sequence of passes aren't all the exact same kind of pass, it will be an error. You cannot mix different levels implicitly, you must explicitly form a pass manager in which to nest passes.

Definition at line 371 of file PassBuilder.cpp.

References llvm::PassManager< IRUnitT >::addPass(), llvm::createModuleToFunctionPassAdaptor(), llvm::createModuleToPostOrderCGSCCPassAdaptor(), llvm::StringRef::empty(), llvm::StringRef::find_first_of(), isCGSCCPassName(), isFunctionPassName(), isModulePassName(), and llvm::StringRef::substr().

void PassBuilder::registerCGSCCAnalyses ( CGSCCAnalysisManager CGAM)

Registers all available CGSCC analysis passes.

This is an interface that can be used to populate a CGSCCAnalysisManager with all registered CGSCC analyses. Callers can still manually register any additional analyses.

Definition at line 104 of file PassBuilder.cpp.

void PassBuilder::registerFunctionAnalyses ( FunctionAnalysisManager FAM)

Registers all available function analysis passes.

This is an interface that can be used to populate a FunctionAnalysisManager with all registered function analyses. Callers can still manually register any additional analyses.

Definition at line 110 of file PassBuilder.cpp.

void PassBuilder::registerModuleAnalyses ( ModuleAnalysisManager MAM)

Registers all available module analysis passes.

This is an interface that can be used to populate a ModuleAnalysisManager with all registered module analyses. Callers can still manually register any additional analyses.

Definition at line 98 of file PassBuilder.cpp.


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