class PhiValues

Declaration

class PhiValues { /* full declaration omitted */ };

Description

Class for calculating and caching the underlying values of phis in a function. Initially the PhiValues is empty, and gets incrementally populated whenever it is queried.

Declared at: llvm/include/llvm/Analysis/PhiValues.h:40

Member Variables

private unsigned int NextDepthNumber = 1
The next depth number to be used by processPhi.
private DenseMap<const llvm::PHINode*, unsigned int> DepthMap
Depth numbers of phis. Phis with the same depth number are part of the same strongly connected component.
private DenseMap<unsigned int, llvm::PhiValues::ValueSet> NonPhiReachableMap
Non-phi values reachable from each component.
private DenseMap<unsigned int, llvm::PhiValues::ConstValueSet> ReachableMap
All values reachable from each component.
private DenseSet<llvm::PhiValues::PhiValuesCallbackVH, DenseMapInfo<llvm::Value*>> TrackedValues
A set of callbacks to the values that processPhi has seen.
private const llvm::Function& F
The function that the PhiValues is for.

Method Overview

  • public PhiValues(const llvm::Function & F)
  • public const llvm::PhiValues::ValueSet & getValuesForPhi(const llvm::PHINode * PN)
  • public bool invalidate(llvm::Function &, const llvm::PreservedAnalyses &, FunctionAnalysisManager::Invalidator &)
  • public void invalidateValue(const llvm::Value * V)
  • public void print(llvm::raw_ostream & OS) const
  • private void processPhi(const llvm::PHINode * PN, SmallVectorImpl<const llvm::PHINode *> & Stack)
  • public void releaseMemory()

Methods

PhiValues(const llvm::Function& F)

Description

Construct an empty PhiValues.

Declared at: llvm/include/llvm/Analysis/PhiValues.h:45

Parameters

const llvm::Function& F

const llvm::PhiValues::ValueSet& getValuesForPhi(
    const llvm::PHINode* PN)

Description

Get the underlying values of a phi. This returns the cached value if PN has previously been processed, otherwise it processes it first.

Declared at: llvm/include/llvm/Analysis/PhiValues.h:51

Parameters

const llvm::PHINode* PN

bool invalidate(
    llvm::Function&,
    const llvm::PreservedAnalyses&,
    FunctionAnalysisManager::Invalidator&)

Description

Handle invalidation events in the new pass manager.

Declared at: llvm/include/llvm/Analysis/PhiValues.h:68

Parameters

llvm::Function&
const llvm::PreservedAnalyses&
FunctionAnalysisManager::Invalidator&

void invalidateValue(const llvm::Value* V)

Description

Notify PhiValues that the cached information using V is no longer valid Whenever a phi has its operands modified the cached values for that phi (and the phis that use that phi) become invalid. A user of PhiValues has to notify it of this by calling invalidateValue on either the operand or the phi, which will then clear the relevant cached information.

Declared at: llvm/include/llvm/Analysis/PhiValues.h:59

Parameters

const llvm::Value* V

void print(llvm::raw_ostream& OS) const

Description

Print out the values currently in the cache.

Declared at: llvm/include/llvm/Analysis/PhiValues.h:65

Parameters

llvm::raw_ostream& OS

void processPhi(
    const llvm::PHINode* PN,
    SmallVectorImpl<const llvm::PHINode*>& Stack)

Description

Process a phi so that its entries in the depth and reachable maps are fully populated.

Declared at: llvm/include/llvm/Analysis/PhiValues.h:108

Parameters

const llvm::PHINode* PN
SmallVectorImpl<const llvm::PHINode*>& Stack

void releaseMemory()

Description

Free the memory used by this class.

Declared at: llvm/include/llvm/Analysis/PhiValues.h:62