LLVM  13.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)
 
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 >
std::enable_if_t<!std::is_same< PassT, PassManager >::value > addPass (PassT Pass)
 
template<typename PassT >
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...
 

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 466 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 569 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 470 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 476 of file PassManager.h.

Member Function Documentation

◆ addPass() [1/2]

template<typename IRUnitT , typename AnalysisManagerT = AnalysisManager<IRUnitT>, typename... ExtraArgTs>
template<typename PassT >
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 557 of file PassManager.h.

◆ addPass() [2/2]

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

◆ 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 563 of file PassManager.h.

Referenced by llvm::PassBuilder::buildO0DefaultPipeline().

◆ isRequired()

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

Definition at line 565 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 478 of file PassManager.h.

◆ 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 485 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 64 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: