LLVM 22.0.0git
llvm::PhiValues Class Reference

Class for calculating and caching the underlying values of phis in a function. More...

#include "llvm/Analysis/PhiValues.h"

Public Types

using ValueSet = SmallSetVector<Value *, 4>

Public Member Functions

 PhiValues (const Function &F)
 Construct an empty PhiValues.
LLVM_ABI const ValueSetgetValuesForPhi (const PHINode *PN)
 Get the underlying values of a phi.
LLVM_ABI void invalidateValue (const Value *V)
 Notify PhiValues that the cached information using V is no longer valid.
LLVM_ABI void releaseMemory ()
 Free the memory used by this class.
LLVM_ABI void print (raw_ostream &OS) const
 Print out the values currently in the cache.
LLVM_ABI bool invalidate (Function &, const PreservedAnalyses &, FunctionAnalysisManager::Invalidator &)
 Handle invalidation events in the new pass manager.

Detailed 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.

Definition at line 41 of file PhiValues.h.

Member Typedef Documentation

◆ ValueSet

Definition at line 43 of file PhiValues.h.

Constructor & Destructor Documentation

◆ PhiValues()

llvm::PhiValues::PhiValues ( const Function & F)
inline

Construct an empty PhiValues.

Definition at line 46 of file PhiValues.h.

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

Member Function Documentation

◆ getValuesForPhi()

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

Get the underlying values of a phi.

This returns the cached value if PN has previously been processed, otherwise it processes it first.

Definition at line 127 of file PhiValues.cpp.

References assert().

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

◆ invalidate()

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

Handle invalidation events in the new pass manager.

Definition at line 26 of file PhiValues.cpp.

References llvm::PreservedAnalyses::getChecker().

◆ invalidateValue()

void PhiValues::invalidateValue ( const Value * V)

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.

Definition at line 139 of file PhiValues.cpp.

References llvm::dyn_cast(), N, and llvm::SmallVectorTemplateBase< T, bool >::push_back().

◆ print()

void PhiValues::print ( raw_ostream & OS) const

Print out the values currently in the cache.

Definition at line 165 of file PhiValues.cpp.

References llvm::dyn_cast(), I, and N.

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

◆ releaseMemory()

void PhiValues::releaseMemory ( )

Free the memory used by this class.

Definition at line 159 of file PhiValues.cpp.


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