LLVM 20.0.0git
Public Member Functions | List of all members
llvm::AbstractLatticeFunction< LatticeKey, LatticeVal > Class Template Referenceabstract

AbstractLatticeFunction - This class is implemented by the dataflow instance to specify what the lattice values are and how they handle merges etc. More...

#include "llvm/Analysis/SparsePropagation.h"

Public Member Functions

 AbstractLatticeFunction (LatticeVal undefVal, LatticeVal overdefinedVal, LatticeVal untrackedVal)
 
virtual ~AbstractLatticeFunction ()=default
 
LatticeVal getUndefVal () const
 
LatticeVal getOverdefinedVal () const
 
LatticeVal getUntrackedVal () const
 
virtual bool IsUntrackedValue (LatticeKey Key)
 IsUntrackedValue - If the specified LatticeKey is obviously uninteresting to the analysis (i.e., it would always return UntrackedVal), this function can return true to avoid pointless work.
 
virtual LatticeVal ComputeLatticeVal (LatticeKey Key)
 ComputeLatticeVal - Compute and return a LatticeVal corresponding to the given LatticeKey.
 
virtual bool IsSpecialCasedPHI (PHINode *PN)
 IsSpecialCasedPHI - Given a PHI node, determine whether this PHI node is one that the we want to handle through ComputeInstructionState.
 
virtual LatticeVal MergeValues (LatticeVal X, LatticeVal Y)
 MergeValues - Compute and return the merge of the two specified lattice values.
 
virtual void ComputeInstructionState (Instruction &I, DenseMap< LatticeKey, LatticeVal > &ChangedValues, SparseSolver< LatticeKey, LatticeVal > &SS)=0
 ComputeInstructionState - Compute the LatticeKeys that change as a result of executing instruction I.
 
virtual void PrintLatticeVal (LatticeVal LV, raw_ostream &OS)
 PrintLatticeVal - Render the given LatticeVal to the specified stream.
 
virtual void PrintLatticeKey (LatticeKey Key, raw_ostream &OS)
 PrintLatticeKey - Render the given LatticeKey to the specified stream.
 
virtual ValueGetValueFromLatticeVal (LatticeVal LV, Type *Ty=nullptr)
 GetValueFromLatticeVal - If the given LatticeVal is representable as an LLVM value, return it; otherwise, return nullptr.
 

Detailed Description

template<class LatticeKey, class LatticeVal>
class llvm::AbstractLatticeFunction< LatticeKey, LatticeVal >

AbstractLatticeFunction - This class is implemented by the dataflow instance to specify what the lattice values are and how they handle merges etc.

This gives the client the power to compute lattice values from instructions, constants, etc. The current requirement is that lattice values must be copyable. At the moment, nothing tries to avoid copying. Additionally, lattice keys must be able to be used as keys of a mapping data structure. Internally, the generic solver currently uses a DenseMap to map lattice keys to lattice values. If the lattice key is a non-standard type, a specialization of DenseMapInfo must be provided.

Definition at line 47 of file SparsePropagation.h.

Constructor & Destructor Documentation

◆ AbstractLatticeFunction()

template<class LatticeKey , class LatticeVal >
llvm::AbstractLatticeFunction< LatticeKey, LatticeVal >::AbstractLatticeFunction ( LatticeVal  undefVal,
LatticeVal  overdefinedVal,
LatticeVal  untrackedVal 
)
inline

Definition at line 52 of file SparsePropagation.h.

◆ ~AbstractLatticeFunction()

template<class LatticeKey , class LatticeVal >
virtual llvm::AbstractLatticeFunction< LatticeKey, LatticeVal >::~AbstractLatticeFunction ( )
virtualdefault

Member Function Documentation

◆ ComputeInstructionState()

template<class LatticeKey , class LatticeVal >
virtual void llvm::AbstractLatticeFunction< LatticeKey, LatticeVal >::ComputeInstructionState ( Instruction I,
DenseMap< LatticeKey, LatticeVal > &  ChangedValues,
SparseSolver< LatticeKey, LatticeVal > &  SS 
)
pure virtual

ComputeInstructionState - Compute the LatticeKeys that change as a result of executing instruction I.

Their associated LatticeVals are store in ChangedValues.

◆ ComputeLatticeVal()

template<class LatticeKey , class LatticeVal >
virtual LatticeVal llvm::AbstractLatticeFunction< LatticeKey, LatticeVal >::ComputeLatticeVal ( LatticeKey  Key)
inlinevirtual

ComputeLatticeVal - Compute and return a LatticeVal corresponding to the given LatticeKey.

Definition at line 72 of file SparsePropagation.h.

References llvm::AbstractLatticeFunction< LatticeKey, LatticeVal >::getOverdefinedVal().

◆ getOverdefinedVal()

template<class LatticeKey , class LatticeVal >
LatticeVal llvm::AbstractLatticeFunction< LatticeKey, LatticeVal >::getOverdefinedVal ( ) const
inline

◆ getUndefVal()

template<class LatticeKey , class LatticeVal >
LatticeVal llvm::AbstractLatticeFunction< LatticeKey, LatticeVal >::getUndefVal ( ) const
inline

Definition at line 61 of file SparsePropagation.h.

◆ getUntrackedVal()

template<class LatticeKey , class LatticeVal >
LatticeVal llvm::AbstractLatticeFunction< LatticeKey, LatticeVal >::getUntrackedVal ( ) const
inline

◆ GetValueFromLatticeVal()

template<class LatticeKey , class LatticeVal >
virtual Value * llvm::AbstractLatticeFunction< LatticeKey, LatticeVal >::GetValueFromLatticeVal ( LatticeVal  LV,
Type Ty = nullptr 
)
inlinevirtual

GetValueFromLatticeVal - If the given LatticeVal is representable as an LLVM value, return it; otherwise, return nullptr.

If a type is given, the returned value must have the same type. This function is used by the generic solver in attempting to resolve branch and switch conditions.

Definition at line 105 of file SparsePropagation.h.

◆ IsSpecialCasedPHI()

template<class LatticeKey , class LatticeVal >
virtual bool llvm::AbstractLatticeFunction< LatticeKey, LatticeVal >::IsSpecialCasedPHI ( PHINode PN)
inlinevirtual

IsSpecialCasedPHI - Given a PHI node, determine whether this PHI node is one that the we want to handle through ComputeInstructionState.

Definition at line 78 of file SparsePropagation.h.

◆ IsUntrackedValue()

template<class LatticeKey , class LatticeVal >
virtual bool llvm::AbstractLatticeFunction< LatticeKey, LatticeVal >::IsUntrackedValue ( LatticeKey  Key)
inlinevirtual

IsUntrackedValue - If the specified LatticeKey is obviously uninteresting to the analysis (i.e., it would always return UntrackedVal), this function can return true to avoid pointless work.

Definition at line 68 of file SparsePropagation.h.

◆ MergeValues()

template<class LatticeKey , class LatticeVal >
virtual LatticeVal llvm::AbstractLatticeFunction< LatticeKey, LatticeVal >::MergeValues ( LatticeVal  X,
LatticeVal  Y 
)
inlinevirtual

MergeValues - Compute and return the merge of the two specified lattice values.

Merging should only move one direction down the lattice to guarantee convergence (toward overdefined).

Definition at line 83 of file SparsePropagation.h.

References llvm::AbstractLatticeFunction< LatticeKey, LatticeVal >::getOverdefinedVal().

◆ PrintLatticeKey()

template<class LatticeKey , class LatticeVal >
void llvm::AbstractLatticeFunction< LatticeKey, LatticeVal >::PrintLatticeKey ( LatticeKey  Key,
raw_ostream OS 
)
virtual

PrintLatticeKey - Render the given LatticeKey to the specified stream.

Definition at line 219 of file SparsePropagation.h.

References OS.

◆ PrintLatticeVal()

template<class LatticeKey , class LatticeVal >
void llvm::AbstractLatticeFunction< LatticeKey, LatticeVal >::PrintLatticeVal ( LatticeVal  LV,
raw_ostream OS 
)
virtual

PrintLatticeVal - Render the given LatticeVal to the specified stream.

Definition at line 206 of file SparsePropagation.h.

References OS.


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