LLVM 22.0.0git
|
Manages a sequence of passes over a particular unit of IR. More...
#include "llvm/IR/PassManager.h"
Public Member Functions | |
PassManager ()=default | |
Construct a pass manager. | |
PassManager (PassManager &&Arg) | |
PassManager & | operator= (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. | |
LLVM_ABI PreservedAnalyses | run (LazyCallGraph::SCC &InitialC, CGSCCAnalysisManager &AM, LazyCallGraph &G, CGSCCUpdateResult &UR) |
LLVM_ABI 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. | |
![]() | |
void | printPipeline (raw_ostream &OS, function_ref< StringRef(StringRef)> MapClassName2PassName) |
Static Public Member Functions | |
static bool | isRequired () |
![]() | |
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 |
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 162 of file PassManager.h.
|
protected |
Definition at line 223 of file PassManager.h.
|
explicitdefault |
Construct a pass manager.
|
inline |
Definition at line 172 of file PassManager.h.
|
inline |
Definition at line 196 of file PassManager.h.
References llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::Passes.
Referenced by addAnnotationRemarksPass(), llvm::ModuleInlinerWrapperPass::addLateModulePass(), llvm::ModuleInlinerWrapperPass::addModulePass(), llvm::ExtraFunctionPassManager< MarkerTy >::addPass(), llvm::PassBuilder::addPGOInstrPassesForO0(), buildCoroWrapper(), 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 >::AddIRPass::operator()(), llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::AddMachinePass::operator()(), optimizeModule(), llvm::parseAnalysisUtilityPasses(), llvm::AArch64TargetMachine::registerPassBuilderCallbacks(), llvm::AMDGPUTargetMachine::registerPassBuilderCallbacks(), llvm::BPFTargetMachine::registerPassBuilderCallbacks(), llvm::NVPTXTargetMachine::registerPassBuilderCallbacks(), llvm::CoroCleanupPass::run(), runNewPMPasses(), llvm::AMDGPUTargetMachine::splitModule(), and llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::AddMachinePass::~AddMachinePass().
|
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 212 of file PassManager.h.
References P, and llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::Passes.
|
inline |
Returns if the pass manager contains any passes.
Definition at line 218 of file PassManager.h.
References llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::Passes.
Referenced by llvm::PassBuilder::buildO0DefaultPipeline(), llvm::ModuleInlinerWrapperPass::printPipeline(), and llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::AddMachinePass::~AddMachinePass().
|
inlinestatic |
Definition at line 220 of file PassManager.h.
|
inline |
Definition at line 174 of file PassManager.h.
References llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::Passes, and RHS.
|
inline |
Definition at line 179 of file PassManager.h.
References Idx, OS, P, llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::Passes, and Size.
Referenced by llvm::CoroConditionalWrapper::printPipeline(), llvm::ModuleInlinerWrapperPass::printPipeline(), and runNewPMPasses().
PreservedAnalyses llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::run | ( | IRUnitT & | IR, |
AnalysisManagerT & | AM, | ||
ExtraArgTs... | ExtraArgs | ||
) |
Run all of the passes in this manager over the given unit of IR.
ExtraArgs are passed to each pass.
Definition at line 28 of file PassManagerImpl.h.
References llvm::PreservedAnalyses::all(), llvm::PassInstrumentation::getPassNameForClassName(), llvm::PreservedAnalyses::intersect(), IR, OS, P, Passes, PassName, llvm::PreservedAnalyses::preserveSet(), print(), llvm::printIRUnitNameForStackTrace(), llvm::PassInstrumentation::runAfterPass(), and llvm::PassInstrumentation::runBeforePass().
Referenced by eliminateDeadCode(), if(), optimizeModule(), llvm::FunctionToLoopPassAdaptor::run(), llvm::ExtraFunctionPassManager< MarkerTy >::run(), llvm::CoroConditionalWrapper::run(), llvm::CoroCleanupPass::run(), runNewPMPasses(), and llvm::AMDGPUTargetMachine::splitModule().
LLVM_ABI PreservedAnalyses llvm::PassManager< LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, CGSCCUpdateResult & >::run | ( | LazyCallGraph::SCC & | InitialC, |
CGSCCAnalysisManager & | AM, | ||
LazyCallGraph & | G, | ||
CGSCCUpdateResult & | UR | ||
) |
PreservedAnalyses llvm::PassManager< LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, CGSCCUpdateResult & >::run | ( | LazyCallGraph::SCC & | InitialC, |
CGSCCAnalysisManager & | AM, | ||
LazyCallGraph & | G, | ||
CGSCCUpdateResult & | UR | ||
) |
Explicitly specialize the pass manager run method to handle call graph updates.
Definition at line 68 of file CGSCCPassManager.cpp.
References llvm::PreservedAnalyses::all(), assert(), llvm::CallingConv::C, llvm::CGSCCUpdateResult::CrossSCCPA, llvm::dbgs(), FAM, G, llvm::AnalysisManager< IRUnitT, ExtraArgTs >::getCachedResult(), llvm::AnalysisManager< IRUnitT, ExtraArgTs >::getResult(), llvm::PreservedAnalyses::intersect(), llvm::AnalysisManager< IRUnitT, ExtraArgTs >::invalidate(), llvm::CGSCCUpdateResult::InvalidatedSCCs, LLVM_DEBUG, Passes, llvm::PassInstrumentation::runAfterPass(), llvm::PassInstrumentation::runAfterPassInvalidated(), llvm::PassInstrumentation::runBeforePass(), and llvm::CGSCCUpdateResult::UpdatedC.
LLVM_ABI PreservedAnalyses llvm::PassManager< MachineFunction >::run | ( | MachineFunction & | , |
AnalysisManager< MachineFunction > & | |||
) |
|
protected |
Definition at line 226 of file PassManager.h.
Referenced by llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::addPass(), llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::isEmpty(), llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::operator=(), and llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::printPipeline().