LLVM  6.0.0svn
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. More...
 
virtual LatticeVal ComputeLatticeVal (LatticeKey Key)
 ComputeLatticeVal - Compute and return a LatticeVal corresponding to the given LatticeKey. More...
 
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. More...
 
virtual LatticeVal MergeValues (LatticeVal X, LatticeVal Y)
 MergeValues - Compute and return the merge of the two specified lattice values. More...
 
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. More...
 
virtual void PrintLatticeVal (LatticeVal LV, raw_ostream &OS)
 PrintLatticeVal - Render the given LatticeVal to the specified stream. More...
 
virtual void PrintLatticeKey (LatticeKey Key, raw_ostream &OS)
 PrintLatticeKey - Render the given LatticeKey to the specified stream. More...
 
virtual ValueGetValueFromLatticeVal (LatticeVal LV, Type *Ty=nullptr)
 GetValueFromLatticeVal - If the given LatticeVal is representable as an LLVM value, return it; otherwise, return nullptr. More...
 

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 46 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 51 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 71 of file SparsePropagation.h.

◆ getOverdefinedVal()

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

Definition at line 61 of file SparsePropagation.h.

◆ getUndefVal()

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

Definition at line 60 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 104 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 77 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 67 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 82 of file SparsePropagation.h.

References I.

◆ 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 218 of file SparsePropagation.h.

◆ 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 205 of file SparsePropagation.h.


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