LLVM 20.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]

Public Member Functions

 PassManager ()=default
 Construct a pass manager.
 
 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.
 
template<typename PassT >
LLVM_ATTRIBUTE_MINSIZE std::enable_if_t<!std::is_same_v< PassT, PassManager > > addPass (PassT &&Pass)
 
template<typename PassT >
LLVM_ATTRIBUTE_MINSIZE std::enable_if_t< std::is_same_v< PassT, PassManager > > addPass (PassT &&Pass)
 When adding a pass manager pass that has the same type as this pass manager, simply move the passes over.
 
bool isEmpty () const
 Returns if the pass manager contains any passes.
 
PreservedAnalyses run (LazyCallGraph::SCC &InitialC, CGSCCAnalysisManager &AM, LazyCallGraph &G, CGSCCUpdateResult &UR)
 
PreservedAnalyses run (MachineFunction &, AnalysisManager< MachineFunction > &)
 
PreservedAnalyses run (LazyCallGraph::SCC &InitialC, CGSCCAnalysisManager &AM, LazyCallGraph &G, CGSCCUpdateResult &UR)
 Explicitly specialize the pass manager run method to handle call graph updates.
 
- Public Member Functions inherited from llvm::PassInfoMixin< DerivedT >
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< DerivedT >
static StringRef name ()
 Gets the name of the pass we are mixed into.
 

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 161 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 222 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 ( )
explicitdefault

Construct a pass manager.

◆ 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 171 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_v< PassT, PassManager > > llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::addPass ( PassT &&  Pass)
inline

Definition at line 195 of file PassManager.h.

References llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::Passes.

Referenced by addAnnotationRemarksPass(), llvm::ModuleInlinerWrapperPass::addLateModulePass(), llvm::ModuleInlinerWrapperPass::addModulePass(), llvm::PassBuilder::addPGOInstrPassesForO0(), llvm::PassBuilder::buildFatLTODefaultPipeline(), llvm::PassBuilder::buildFunctionSimplificationPipeline(), llvm::PassBuilder::buildInlinerPipeline(), llvm::PassBuilder::buildLTODefaultPipeline(), llvm::PassBuilder::buildModuleInlinerPipeline(), llvm::PassBuilder::buildModuleOptimizationPipeline(), llvm::PassBuilder::buildModuleSimplificationPipeline(), llvm::PassBuilder::buildO0DefaultPipeline(), llvm::PassBuilder::buildPerModuleDefaultPipeline(), llvm::PassBuilder::buildThinLTODefaultPipeline(), llvm::PassBuilder::buildThinLTOPreLinkDefaultPipeline(), eliminateDeadCode(), llvm::FunctionToLoopPassAdaptor::FunctionToLoopPassAdaptor(), if(), llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::insertPass(), llvm::ModuleInlinerWrapperPass::ModuleInlinerWrapperPass(), llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::AddMachinePass::operator()(), llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::AddIRPass::operator()(), llvm::parseAnalysisUtilityPasses(), llvm::AMDGPUTargetMachine::registerPassBuilderCallbacks(), llvm::BPFTargetMachine::registerPassBuilderCallbacks(), llvm::NVPTXTargetMachine::registerPassBuilderCallbacks(), llvm::CoroCleanupPass::run(), runNewPMPasses(), llvm::AMDGPUTargetMachine::splitModule(), llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::AddIRPass::~AddIRPass(), and llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::AddMachinePass::~AddMachinePass().

◆ 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_v< PassT, PassManager > > 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 211 of file PassManager.h.

References P, and llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::Passes.

◆ isEmpty()

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

◆ isRequired()

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

Definition at line 219 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

◆ 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

◆ run() [1/4]

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

◆ run() [2/4]

◆ run() [3/4]

◆ run() [4/4]

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 files: