LLVM  14.0.0git
Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | List of all members
llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs > Class Template Reference

Manages a sequence of passes over a particular unit of IR. More...

#include "llvm/IR/PassManager.h"

Inheritance diagram for llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >:
Inheritance graph
[legend]
Collaboration diagram for llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >:
Collaboration graph
[legend]

Public Member Functions

 PassManager ()
 Construct a pass manager. More...
 
 PassManager (PassManager &&Arg)
 
PassManageroperator= (PassManager &&RHS)
 
void printPipeline (raw_ostream &OS, function_ref< StringRef(StringRef)> MapClassName2PassName)
 
PreservedAnalyses run (IRUnitT &IR, AnalysisManagerT &AM, ExtraArgTs... ExtraArgs)
 Run all of the passes in this manager over the given unit of IR. More...
 
template<typename PassT >
LLVM_ATTRIBUTE_MINSIZE std::enable_if_t<!std::is_same< PassT, PassManager >::value > addPass (PassT &&Pass)
 
template<typename PassT >
LLVM_ATTRIBUTE_MINSIZE std::enable_if_t< std::is_same< PassT, PassManager >::value > addPass (PassT &&Pass)
 When adding a pass manager pass that has the same type as this pass manager, simply move the passes over. More...
 
bool isEmpty () const
 Returns if the pass manager contains any passes. More...
 
PreservedAnalyses run (LazyCallGraph::SCC &InitialC, CGSCCAnalysisManager &AM, LazyCallGraph &G, CGSCCUpdateResult &UR)
 
PreservedAnalyses run (LazyCallGraph::SCC &InitialC, CGSCCAnalysisManager &AM, LazyCallGraph &G, CGSCCUpdateResult &UR)
 Explicitly specialize the pass manager run method to handle call graph updates. More...
 
- Public Member Functions inherited from llvm::PassInfoMixin< PassManager< IRUnitT, AnalysisManager< IRUnitT >, ExtraArgTs... > >
void printPipeline (raw_ostream &OS, function_ref< StringRef(StringRef)> MapClassName2PassName)
 

Static Public Member Functions

static bool isRequired ()
 
- Static Public Member Functions inherited from llvm::PassInfoMixin< PassManager< IRUnitT, AnalysisManager< IRUnitT >, ExtraArgTs... > >
static StringRef name ()
 Gets the name of the pass we are mixed into. More...
 

Protected Types

using PassConceptT = detail::PassConcept< IRUnitT, AnalysisManagerT, ExtraArgTs... >
 

Protected Attributes

std::vector< std::unique_ptr< PassConceptT > > Passes
 

Detailed Description

template<typename IRUnitT, typename AnalysisManagerT = AnalysisManager<IRUnitT>, typename... ExtraArgTs>
class llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >

Manages a sequence of passes over a particular unit of IR.

A pass manager contains a sequence of passes to run over a particular unit of IR (e.g. Functions, Modules). It is itself a valid pass over that unit of IR, and when run over some given IR will run each of its contained passes in sequence. Pass managers are the primary and most basic building block of a pass pipeline.

When you run a pass manager, you provide an AnalysisManager<IRUnitT> argument. The pass manager will propagate that analysis manager to each pass it runs, and will call the analysis manager's invalidation routine with the PreservedAnalyses of each pass it runs.

Definition at line 472 of file PassManager.h.

Member Typedef Documentation

◆ PassConceptT

template<typename IRUnitT , typename AnalysisManagerT = AnalysisManager<IRUnitT>, typename... ExtraArgTs>
using llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::PassConceptT = detail::PassConcept<IRUnitT, AnalysisManagerT, ExtraArgTs...>
protected

Definition at line 583 of file PassManager.h.

Constructor & Destructor Documentation

◆ PassManager() [1/2]

template<typename IRUnitT , typename AnalysisManagerT = AnalysisManager<IRUnitT>, typename... ExtraArgTs>
llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::PassManager ( )
inlineexplicit

Construct a pass manager.

Definition at line 476 of file PassManager.h.

◆ PassManager() [2/2]

template<typename IRUnitT , typename AnalysisManagerT = AnalysisManager<IRUnitT>, typename... ExtraArgTs>
llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::PassManager ( PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs > &&  Arg)
inline

Definition at line 482 of file PassManager.h.

Member Function Documentation

◆ addPass() [1/2]

template<typename IRUnitT , typename AnalysisManagerT = AnalysisManager<IRUnitT>, typename... ExtraArgTs>
template<typename PassT >
LLVM_ATTRIBUTE_MINSIZE std::enable_if_t<!std::is_same<PassT, PassManager>::value> llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::addPass ( PassT &&  Pass)
inline

◆ addPass() [2/2]

template<typename IRUnitT , typename AnalysisManagerT = AnalysisManager<IRUnitT>, typename... ExtraArgTs>
template<typename PassT >
LLVM_ATTRIBUTE_MINSIZE std::enable_if_t<std::is_same<PassT, PassManager>::value> llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::addPass ( PassT &&  Pass)
inline

When adding a pass manager pass that has the same type as this pass manager, simply move the passes over.

This is because we don't have use cases rely on executing nested pass managers. Doing this could reduce implementation complexity and avoid potential invalidation issues that may happen with nested pass managers of the same type.

Definition at line 571 of file PassManager.h.

◆ isEmpty()

template<typename IRUnitT , typename AnalysisManagerT = AnalysisManager<IRUnitT>, typename... ExtraArgTs>
bool llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::isEmpty ( ) const
inline

Returns if the pass manager contains any passes.

Definition at line 577 of file PassManager.h.

Referenced by llvm::PassBuilder::buildO0DefaultPipeline(), and llvm::ModuleInlinerWrapperPass::printPipeline().

◆ isRequired()

template<typename IRUnitT , typename AnalysisManagerT = AnalysisManager<IRUnitT>, typename... ExtraArgTs>
static bool llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::isRequired ( )
inlinestatic

Definition at line 579 of file PassManager.h.

◆ operator=()

template<typename IRUnitT , typename AnalysisManagerT = AnalysisManager<IRUnitT>, typename... ExtraArgTs>
PassManager& llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::operator= ( PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs > &&  RHS)
inline

Definition at line 484 of file PassManager.h.

◆ printPipeline()

template<typename IRUnitT , typename AnalysisManagerT = AnalysisManager<IRUnitT>, typename... ExtraArgTs>
void llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::printPipeline ( raw_ostream OS,
function_ref< StringRef(StringRef)>  MapClassName2PassName 
)
inline

Definition at line 489 of file PassManager.h.

Referenced by llvm::ModuleInlinerWrapperPass::printPipeline().

◆ run() [1/3]

template<typename IRUnitT , typename AnalysisManagerT = AnalysisManager<IRUnitT>, typename... ExtraArgTs>
PreservedAnalyses llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::run ( IRUnitT &  IR,
AnalysisManagerT &  AM,
ExtraArgTs...  ExtraArgs 
)
inline

Run all of the passes in this manager over the given unit of IR.

ExtraArgs are passed to each pass.

Definition at line 501 of file PassManager.h.

Referenced by eliminateDeadCode(), llvm::ModuleInlinerWrapperPass::run(), and llvm::FunctionToLoopPassAdaptor::run().

◆ run() [2/3]

Explicitly specialize the pass manager run method to handle call graph updates.

Definition at line 63 of file CGSCCPassManager.cpp.

◆ run() [3/3]

Member Data Documentation

◆ Passes

template<typename IRUnitT , typename AnalysisManagerT = AnalysisManager<IRUnitT>, typename... ExtraArgTs>
std::vector<std::unique_ptr<PassConceptT> > llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::Passes
protected

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