LLVM  8.0.1
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 41 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 723 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 740 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 761 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 728 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 770 of file PassManager.h.

References assert().

Referenced by llvm::createSampleProfileLoaderPass(), llvm::SyntheticCountsPropagation::run(), llvm::LoadStoreVectorizerPass::run(), llvm::ExpandReductionsPass::run(), llvm::BoundsCheckingPass::run(), llvm::CorrelatedValuePropagationPass::run(), llvm::CGProfilePass::run(), llvm::LibCallsShrinkWrapPass::run(), llvm::GCOVProfilerPass::run(), llvm::HotColdSplittingPass::run(), llvm::CallSiteSplittingPass::run(), llvm::IRCEPass::run(), llvm::IVUsersPrinterPass::run(), llvm::LoopAccessInfoPrinterPass::run(), llvm::PromotePass::run(), llvm::DivRemPairsPass::run(), llvm::PartiallyInlineLibCallsPass::run(), llvm::SinkingPass::run(), llvm::InferFunctionAttrsPass::run(), llvm::PartialInlinerPass::run(), llvm::BDCEPass::run(), llvm::GuardWideningPass::run(), llvm::LoopPredicationPass::run(), llvm::NewGVNPass::run(), llvm::ControlHeightReductionPass::run(), llvm::GlobalOptPass::run(), llvm::LoopDataPrefetchPass::run(), llvm::LoopDistributePass::run(), llvm::LoopLoadEliminationPass::run(), llvm::LoopUnrollAndJamPass::run(), llvm::ArgumentPromotionPass::run(), llvm::ThreadSanitizerPass::run(), llvm::AlignmentFromAssumptionsPass::run(), llvm::WarnMissedTransformationsPass::run(), llvm::AggressiveInstCombinePass::run(), llvm::DSEPass::run(), llvm::RewriteStatepointsForGC::run(), llvm::PGOInstrumentationGen::run(), llvm::IPSCCPPass::run(), llvm::SampleProfileLoaderPass::run(), llvm::ADCEPass::run(), llvm::EarlyCSEPass::run(), llvm::ThinLTOBitcodeWriterPass::run(), llvm::LoopStrengthReducePass::run(), llvm::LoopSinkPass::run(), llvm::InstCombinePass::run(), llvm::LoopFullUnrollPass::run(), llvm::InstSimplifyPass::run(), llvm::MemorySanitizerPass::run(), llvm::SCCPPass::run(), llvm::LCSSAPass::run(), llvm::InstrProfiling::run(), llvm::PGOInstrumentationUse::run(), llvm::LICMPass::run(), llvm::StackSafetyAnalysis::run(), llvm::SCEVAA::run(), llvm::MemCpyOptPass::run(), llvm::SimplifyCFGPass::run(), llvm::ModuleSummaryIndexAnalysis::run(), llvm::PostOrderFunctionAttrsPass::run(), llvm::LoopSimplifyPass::run(), llvm::PassManager< Function >::run(), llvm::PGOIndirectCallPromotion::run(), llvm::StackSafetyPrinterPass::run(), llvm::AAEvaluator::run(), llvm::TailCallElimPass::run(), llvm::PostDominatorTreePrinterPass::run(), llvm::PGOMemOPSizeOpt::run(), llvm::ReversePostOrderFunctionAttrsPass::run(), llvm::GVN::run(), llvm::BitcodeWriterPass::run(), llvm::SpeculativeExecutionPass::run(), llvm::SLPVectorizerPass::run(), llvm::StackSafetyGlobalAnalysis::run(), llvm::StackSafetyGlobalPrinterPass::run(), llvm::LoopVectorizePass::run(), llvm::CFLAndersAA::run(), llvm::InlinerPass::run(), llvm::JumpThreadingPass::run(), llvm::NaryReassociatePass::run(), llvm::SpeculateAroundPHIsPass::run(), llvm::LoopUnrollPass::run(), llvm::SROA::run(), llvm::CFLSteensAA::run(), llvm::DemandedBitsAnalysis::run(), llvm::BlockFrequencyAnalysis::run(), llvm::ConstantHoistingPass::run(), llvm::GlobalsAA::run(), llvm::DemandedBitsPrinterPass::run(), llvm::BlockFrequencyPrinterPass::run(), llvm::LazyValueAnalysis::run(), llvm::PhiValuesPrinterPass::run(), llvm::VerifierPass::run(), llvm::OptimizationRemarkEmitterAnalysis::run(), llvm::ProfileSummaryPrinterPass::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::DominatorTreeVerifierPass::run(), llvm::FunctionToLoopPassAdaptor< LoopPassT >::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::DevirtSCCRepeatedPass< PassT >::run(), llvm::DependenceAnalysis::run(), llvm::MemorySSAAnalysis::run(), llvm::DependenceAnalysisPrinterPass::run(), llvm::MemorySSAPrinterPass::run(), llvm::MemorySSAVerifierPass::run(), llvm::LoopAnalysis::run(), llvm::LoopPrinterPass::run(), llvm::LoopVerifierPass::run(), llvm::RegionInfoAnalysis::run(), llvm::RegionInfoPrinterPass::run(), llvm::RegionInfoVerifierPass::run(), llvm::AAManager::run(), llvm::LazyCallGraphAnalysis::run(), llvm::LazyCallGraphPrinterPass::run(), llvm::ModuleToFunctionPassAdaptor< FunctionPassT >::run(), llvm::LazyCallGraphDOTPrinterPass::run(), llvm::ScalarEvolutionAnalysis::run(), llvm::ScalarEvolutionPrinterPass::run(), and updateNewSCCFunctionAnalyses().

◆ invalidate() [1/2]

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

Invalidate a specific analysis pass for an IR module.

Note that the analysis result can disregard invalidation, if it determines it is in fact still valid.

Definition at line 842 of file PassManager.h.

References assert().

Referenced by incorporateNewSCCRange(), llvm::PassManager< Function >::run(), llvm::ModuleToPostOrderCGSCCPassAdaptor< CGSCCPassT >::run(), llvm::CGSCCToFunctionPassAdaptor< FunctionPassT >::run(), llvm::DevirtSCCRepeatedPass< PassT >::run(), and llvm::ModuleToFunctionPassAdaptor< FunctionPassT >::run().

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

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


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