class AnalysisManager

Declaration

template <typename IRUnitT, typename... ExtraArgTs>
class AnalysisManager { /* full declaration omitted */ };

Description

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.

Declared at: llvm/include/llvm/IR/PassManager.h:626

Templates

IRUnitT
ExtraArgTs

Member Variables

private llvm::AnalysisManager::AnalysisPassMapT AnalysisPasses
Collection of analysis passes, indexed by ID.
private llvm::AnalysisManager::AnalysisResultListMapT AnalysisResultLists
Provides linear time removal of all analysis results for a IR unit and the ultimate storage for a particular cached analysis result.
private llvm::AnalysisManager::AnalysisResultMapT AnalysisResults
Map from an analysis ID and IR unit to a particular cached analysis result.

Method Overview

  • public AnalysisManager<IRUnitT, ExtraArgTs...>()
  • public AnalysisManager<IRUnitT, ExtraArgTs...>(AnalysisManager<IRUnitT, ExtraArgTs...> &&)
  • public void clear(IRUnitT & IR, llvm::StringRef Name)
  • public void clear()
  • public bool empty() const
  • public template <typename PassT>typename PassT::Result * getCachedResult(IRUnitT & IR) const
  • private llvm::AnalysisManager::ResultConceptT * getCachedResultImpl(llvm::AnalysisKey * ID, IRUnitT & IR) const
  • public template <typename PassT>typename PassT::Result & getResult(IRUnitT & IR, ExtraArgTs... ExtraArgs)
  • private llvm::AnalysisManager::ResultConceptT & getResultImpl(llvm::AnalysisKey * ID, IRUnitT & IR, ExtraArgTs... ExtraArgs)
  • public void invalidate(IRUnitT & IR, const llvm::PreservedAnalyses & PA)
  • private llvm::AnalysisManager::PassConceptT & lookUpPass(llvm::AnalysisKey * ID)
  • private const llvm::AnalysisManager::PassConceptT & lookUpPass(llvm::AnalysisKey * ID) const
  • public template <typename PassBuilderT>bool registerPass(PassBuilderT && PassBuilder)
  • public template <typename PassT>void verifyNotInvalidated(IRUnitT & IR, typename PassT::Result * Result) const

Methods

AnalysisManager<IRUnitT, ExtraArgTs...>()

Description

Construct an empty analysis manager.

Declared at: llvm/include/llvm/IR/PassManager.h:746

AnalysisManager<IRUnitT, ExtraArgTs...>(
    AnalysisManager<IRUnitT, ExtraArgTs...>&&)

Declared at: llvm/include/llvm/IR/PassManager.h:747

Parameters

AnalysisManager<IRUnitT, ExtraArgTs...>&&

void clear(IRUnitT& IR, llvm::StringRef Name)

Description

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.

Declared at: llvm/include/llvm/IR/PassManager.h:763

Parameters

IRUnitT& IR
llvm::StringRef Name

void clear()

Description

Clear all analysis results cached by this AnalysisManager. Like \c 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.

Declared at: llvm/include/llvm/IR/PassManager.h:771

bool empty() const

Description

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

Declared at: llvm/include/llvm/IR/PassManager.h:751

template <typename PassT>
typename PassT::Result* getCachedResult(
    IRUnitT& IR) const

Description

Get the cached result of an analysis pass for a given IR unit. This method never runs the analysis.

Declared at: llvm/include/llvm/IR/PassManager.h:799

Templates

PassT

Parameters

IRUnitT& IR

Returns

null if there is no cached result.

llvm::AnalysisManager::ResultConceptT*
getCachedResultImpl(llvm::AnalysisKey* ID,
                    IRUnitT& IR) const

Description

Get a cached analysis result or return null.

Declared at: llvm/include/llvm/IR/PassManager.h:886

Parameters

llvm::AnalysisKey* ID
IRUnitT& IR

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

Description

Get the result of an analysis pass for a given IR unit. Runs the analysis if a cached result is not available.

Declared at: llvm/include/llvm/IR/PassManager.h:780

Templates

PassT

Parameters

IRUnitT& IR
ExtraArgTs... ExtraArgs

llvm::AnalysisManager::ResultConceptT&
getResultImpl(llvm::AnalysisKey* ID,
              IRUnitT& IR,
              ExtraArgTs... ExtraArgs)

Description

Get an analysis result, running the pass if necessary.

Declared at: llvm/include/llvm/IR/PassManager.h:882

Parameters

llvm::AnalysisKey* ID
IRUnitT& IR
ExtraArgTs... ExtraArgs

void invalidate(IRUnitT& IR,
                const llvm::PreservedAnalyses& PA)

Description

Invalidate cached analyses for an IR unit. Walk through all of the analyses pertaining to this unit of IR and invalidate them, unless they are preserved by the PreservedAnalyses set.

Declared at: llvm/include/llvm/IR/PassManager.h:862

Parameters

IRUnitT& IR
const llvm::PreservedAnalyses& PA

llvm::AnalysisManager::PassConceptT& lookUpPass(
    llvm::AnalysisKey* ID)

Description

Look up a registered analysis pass.

Declared at: llvm/include/llvm/IR/PassManager.h:866

Parameters

llvm::AnalysisKey* ID

const llvm::AnalysisManager::PassConceptT&
lookUpPass(llvm::AnalysisKey* ID) const

Description

Look up a registered analysis pass.

Declared at: llvm/include/llvm/IR/PassManager.h:874

Parameters

llvm::AnalysisKey* ID

template <typename PassBuilderT>
bool registerPass(PassBuilderT&& PassBuilder)

Description

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 \c 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 \c 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.)

Declared at: llvm/include/llvm/IR/PassManager.h:842

Templates

PassBuilderT

Parameters

PassBuilderT&& PassBuilder

template <typename PassT>
void verifyNotInvalidated(
    IRUnitT& IR,
    typename PassT::Result* Result) const

Description

Verify that the given Result cannot be invalidated, assert otherwise.

Declared at: llvm/include/llvm/IR/PassManager.h:816

Templates

PassT

Parameters

IRUnitT& IR
typename PassT::Result* Result