LLVM  6.0.0svn
Classes | Public Member Functions | List of all members
llvm::AnalysisManager< IRUnitT, ExtraArgTs > Class Template Reference

A container for analyses that lazily runs them and caches their results. More...

#include "llvm/Analysis/InstructionSimplify.h"

Classes

class  Invalidator
 API to communicate dependencies between analyses during invalidation. More...
 

Public Member Functions

 AnalysisManager (bool DebugLogging=false)
 Construct an empty analysis manager. More...
 
 AnalysisManager (AnalysisManager &&)=default
 
AnalysisManageroperator= (AnalysisManager &&)=default
 
bool empty () const
 Returns true if the analysis manager has an empty results cache. More...
 
void clear (IRUnitT &IR, llvm::StringRef Name)
 Clear any cached analysis results for a single unit of IR. More...
 
void clear ()
 Clear all analysis results cached by this AnalysisManager. More...
 
template<typename PassT >
PassT::Result & getResult (IRUnitT &IR, ExtraArgTs... ExtraArgs)
 Get the result of an analysis pass for a given IR unit. More...
 
template<typename PassT >
PassT::Result * getCachedResult (IRUnitT &IR) const
 Get the cached result of an analysis pass for a given IR unit. More...
 
template<typename PassBuilderT >
bool registerPass (PassBuilderT &&PassBuilder)
 Register an analysis pass with the manager. More...
 
template<typename PassT >
void invalidate (IRUnitT &IR)
 Invalidate a specific analysis pass for an IR module. More...
 
void invalidate (IRUnitT &IR, const PreservedAnalyses &PA)
 Invalidate cached analyses for an IR unit. More...
 

Detailed Description

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

A container for analyses that lazily runs them and caches their results.

This class can manage analyses for any IR unit where the address of the IR unit sufficies as its identity.

Definition at line 39 of file InstructionSimplify.h.

Constructor & Destructor Documentation

◆ AnalysisManager() [1/2]

template<typename IRUnitT, typename... ExtraArgTs>
llvm::AnalysisManager< IRUnitT, ExtraArgTs >::AnalysisManager ( bool  DebugLogging = false)
inline

Construct an empty analysis manager.

If DebugLogging is true, we'll log our progress to llvm::dbgs().

Definition at line 640 of file PassManager.h.

◆ AnalysisManager() [2/2]

template<typename IRUnitT, typename... ExtraArgTs>
llvm::AnalysisManager< IRUnitT, ExtraArgTs >::AnalysisManager ( AnalysisManager< IRUnitT, ExtraArgTs > &&  )
default

Member Function Documentation

◆ clear() [1/2]

template<typename IRUnitT, typename... ExtraArgTs>
void llvm::AnalysisManager< IRUnitT, ExtraArgTs >::clear ( IRUnitT &  IR,
llvm::StringRef  Name 
)
inline

Clear any cached analysis results for a single unit of IR.

This doesn't invalidate, but instead simply deletes, the relevant results. It is useful when the IR is being removed and we want to clear out all the memory pinned for it.

Definition at line 657 of file PassManager.h.

References llvm::dbgs(), and llvm::StringRef::find().

Referenced by llvm::InlinerPass::run().

◆ clear() [2/2]

template<typename IRUnitT, typename... ExtraArgTs>
void llvm::AnalysisManager< IRUnitT, ExtraArgTs >::clear ( )
inline

Clear all analysis results cached by this AnalysisManager.

Like clear(IRUnitT&), this doesn't invalidate the results; it simply deletes them. This lets you clean up the AnalysisManager when the set of IR units itself has potentially changed, and thus we can't even look up a a result and invalidate/clear it directly.

Definition at line 678 of file PassManager.h.

◆ empty()

template<typename IRUnitT, typename... ExtraArgTs>
bool llvm::AnalysisManager< IRUnitT, ExtraArgTs >::empty ( ) const
inline

Returns true if the analysis manager has an empty results cache.

Definition at line 645 of file PassManager.h.

References assert().

◆ getCachedResult()

template<typename IRUnitT, typename... ExtraArgTs>
template<typename PassT >
PassT::Result* llvm::AnalysisManager< IRUnitT, ExtraArgTs >::getCachedResult ( IRUnitT &  IR) const
inline

◆ getResult()

template<typename IRUnitT, typename... ExtraArgTs>
template<typename PassT >
PassT::Result& llvm::AnalysisManager< IRUnitT, ExtraArgTs >::getResult ( IRUnitT &  IR,
ExtraArgTs...  ExtraArgs 
)
inline

Get the result of an analysis pass for a given IR unit.

Runs the analysis if a cached result is not available.

Definition at line 687 of file PassManager.h.

References assert().

Referenced by llvm::createSampleProfileLoaderPass(), llvm::ExpandReductionsPass::run(), llvm::CorrelatedValuePropagationPass::run(), llvm::SampleProfileLoaderPass::run(), llvm::LibCallsShrinkWrapPass::run(), llvm::PromotePass::run(), llvm::IVUsersPrinterPass::run(), llvm::LoopAccessInfoPrinterPass::run(), llvm::DivRemPairsPass::run(), llvm::PartiallyInlineLibCallsPass::run(), llvm::SinkingPass::run(), llvm::ArgumentPromotionPass::run(), llvm::PartialInlinerPass::run(), llvm::BDCEPass::run(), llvm::GuardWideningPass::run(), llvm::NewGVNPass::run(), llvm::InstSimplifierPass::run(), llvm::InferFunctionAttrsPass::run(), llvm::LoopDataPrefetchPass::run(), llvm::LoopDistributePass::run(), llvm::GlobalOptPass::run(), llvm::LoopLoadEliminationPass::run(), llvm::LoopFullUnrollPass::run(), llvm::AlignmentFromAssumptionsPass::run(), llvm::DSEPass::run(), llvm::IPSCCPPass::run(), llvm::ADCEPass::run(), llvm::SCCPPass::run(), llvm::PGOInstrumentationGen::run(), llvm::EarlyCSEPass::run(), llvm::ThinLTOBitcodeWriterPass::run(), llvm::LoopSinkPass::run(), llvm::LoopStrengthReducePass::run(), llvm::InstCombinePass::run(), llvm::LCSSAPass::run(), llvm::SimplifyCFGPass::run(), llvm::InstrProfiling::run(), llvm::PGOInstrumentationUse::run(), llvm::LoopUnrollPass::run(), llvm::LICMPass::run(), llvm::SCEVAA::run(), llvm::MemCpyOptPass::run(), llvm::ModuleSummaryIndexAnalysis::run(), llvm::PostOrderFunctionAttrsPass::run(), llvm::LoopSimplifyPass::run(), llvm::PGOIndirectCallPromotion::run(), llvm::PassManager< Function >::run(), llvm::AAEvaluator::run(), llvm::PostDominatorTreePrinterPass::run(), llvm::TailCallElimPass::run(), llvm::PGOMemOPSizeOpt::run(), llvm::BitcodeWriterPass::run(), llvm::GVN::run(), llvm::ReversePostOrderFunctionAttrsPass::run(), llvm::SpeculativeExecutionPass::run(), llvm::SLPVectorizerPass::run(), llvm::LoopVectorizePass::run(), llvm::InlinerPass::run(), llvm::CFLAndersAA::run(), llvm::DemandedBitsAnalysis::run(), llvm::NaryReassociatePass::run(), llvm::ConstantHoistingPass::run(), llvm::JumpThreadingPass::run(), llvm::DemandedBitsPrinterPass::run(), llvm::BlockFrequencyAnalysis::run(), llvm::SROA::run(), llvm::CFLSteensAA::run(), llvm::BlockFrequencyPrinterPass::run(), llvm::GlobalsAA::run(), llvm::LazyValueAnalysis::run(), llvm::VerifierPass::run(), llvm::ProfileSummaryPrinterPass::run(), llvm::OptimizationRemarkEmitterAnalysis::run(), llvm::AssumptionPrinterPass::run(), llvm::DominanceFrontierAnalysis::run(), llvm::DominanceFrontierPrinterPass::run(), llvm::BranchProbabilityAnalysis::run(), llvm::BranchProbabilityPrinterPass::run(), llvm::WholeProgramDevirtPass::run(), llvm::BasicAA::run(), llvm::DominatorTreePrinterPass::run(), llvm::FunctionToLoopPassAdaptor< LoopPassT >::run(), llvm::DominatorTreeVerifierPass::run(), llvm::PredicateInfoPrinterPass::run(), llvm::PredicateInfoVerifierPass::run(), llvm::GVNHoistPass::run(), llvm::CallGraphPrinterPass::run(), llvm::ModuleToPostOrderCGSCCPassAdaptor< CGSCCPassT >::run(), llvm::MemoryDependenceAnalysis::run(), llvm::FunctionAnalysisManagerCGSCCProxy::run(), llvm::CGSCCToFunctionPassAdaptor< FunctionPassT >::run(), llvm::MemorySSAAnalysis::run(), llvm::MemorySSAPrinterPass::run(), llvm::MemorySSAVerifierPass::run(), llvm::LoopAnalysis::run(), llvm::AAManager::run(), llvm::DependenceAnalysis::run(), llvm::LoopPrinterPass::run(), llvm::LoopVerifierPass::run(), llvm::RegionInfoAnalysis::run(), llvm::RegionInfoPrinterPass::run(), llvm::RegionInfoVerifierPass::run(), llvm::ModuleToFunctionPassAdaptor< FunctionPassT >::run(), llvm::LazyCallGraphAnalysis::run(), llvm::LazyCallGraphPrinterPass::run(), llvm::LazyCallGraphDOTPrinterPass::run(), llvm::ScalarEvolutionAnalysis::run(), llvm::ScalarEvolutionPrinterPass::run(), llvm::updateCGAndAnalysisManagerForFunctionPass(), and updateNewSCCFunctionAnalyses().

◆ invalidate() [1/2]

template<typename IRUnitT, typename... ExtraArgTs>
template<typename PassT >
void llvm::AnalysisManager< IRUnitT, ExtraArgTs >::invalidate ( IRUnitT &  IR)
inline

◆ invalidate() [2/2]

template<typename IRUnitT, typename... ExtraArgTs>
void llvm::AnalysisManager< IRUnitT, ExtraArgTs >::invalidate ( IRUnitT &  IR,
const PreservedAnalyses PA 
)
inline

◆ operator=()

template<typename IRUnitT, typename... ExtraArgTs>
AnalysisManager& llvm::AnalysisManager< IRUnitT, ExtraArgTs >::operator= ( AnalysisManager< IRUnitT, ExtraArgTs > &&  )
default

◆ registerPass()

template<typename IRUnitT, typename... ExtraArgTs>
template<typename PassBuilderT >
bool llvm::AnalysisManager< IRUnitT, ExtraArgTs >::registerPass ( PassBuilderT &&  PassBuilder)
inline

Register an analysis pass with the manager.

The parameter is a callable whose result is an analysis pass. This allows passing in a lambda to construct the analysis.

The analysis type to register is the type returned by calling the PassBuilder argument. If that type has already been registered, then the argument will not be called and this function will return false. Otherwise, we register the analysis returned by calling PassBuilder(), and this function returns true.

(Note: Although the return value of this function indicates whether or not an analysis was previously registered, there intentionally isn't a way to query this directly. Instead, you should just register all the analyses you might want and let this class run them lazily. This idiom lets us minimize the number of times we have to look up analyses in our hashtable.)

Definition at line 739 of file PassManager.h.

Referenced by llvm::lto::Config::addSaveTemps(), llvm::PassBuilder::crossRegisterProxies(), and eliminateDeadCode().


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