LLVM 20.0.0git
Public Member Functions | List of all members
llvm::GVNPass::ValueTable Class Reference

This class holds the mapping between values and value numbers. More...

#include "llvm/Transforms/Scalar/GVN.h"

Public Member Functions

 ValueTable ()
 
 ValueTable (const ValueTable &Arg)
 
 ValueTable (ValueTable &&Arg)
 
 ~ValueTable ()
 
ValueTableoperator= (const ValueTable &Arg)
 
uint32_t lookupOrAdd (Value *V)
 lookup_or_add - Returns the value number for the specified value, assigning it a new number if it did not have one before.
 
uint32_t lookup (Value *V, bool Verify=true) const
 Returns the value number of the specified value.
 
uint32_t lookupOrAddCmp (unsigned Opcode, CmpInst::Predicate Pred, Value *LHS, Value *RHS)
 Returns the value number of the given comparison, assigning it a new number if it did not have one before.
 
uint32_t phiTranslate (const BasicBlock *BB, const BasicBlock *PhiBlock, uint32_t Num, GVNPass &Gvn)
 Wrap phiTranslateImpl to provide caching functionality.
 
void eraseTranslateCacheEntry (uint32_t Num, const BasicBlock &CurrBlock)
 Erase stale entry from phiTranslate cache so phiTranslate can be computed again.
 
bool exists (Value *V) const
 Returns true if a value number exists for the specified value.
 
void add (Value *V, uint32_t num)
 add - Insert a value into the table with a specified value number.
 
void clear ()
 Remove all entries from the ValueTable.
 
void erase (Value *v)
 Remove a value from the value numbering.
 
void setAliasAnalysis (AAResults *A)
 
AAResultsgetAliasAnalysis () const
 
void setMemDep (MemoryDependenceResults *M)
 
void setDomTree (DominatorTree *D)
 
uint32_t getNextUnusedValueNumber ()
 
void verifyRemoved (const Value *) const
 verifyRemoved - Verify that the value is removed from all internal data structures.
 

Detailed Description

This class holds the mapping between values and value numbers.

It is used as an efficient mechanism to determine the expression-wise equivalence of two values.

Definition at line 151 of file GVN.h.

Constructor & Destructor Documentation

◆ ValueTable() [1/3]

GVNPass::ValueTable::ValueTable ( )
default

◆ ValueTable() [2/3]

GVNPass::ValueTable::ValueTable ( const ValueTable Arg)
default

◆ ValueTable() [3/3]

GVNPass::ValueTable::ValueTable ( ValueTable &&  Arg)
default

◆ ~ValueTable()

GVNPass::ValueTable::~ValueTable ( )
default

Member Function Documentation

◆ add()

void GVNPass::ValueTable::add ( Value V,
uint32_t  num 
)

add - Insert a value into the table with a specified value number.

Definition at line 464 of file GVN.cpp.

References llvm::SmallVectorImpl< T >::insert().

◆ clear()

void GVNPass::ValueTable::clear ( )

Remove all entries from the ValueTable.

Definition at line 701 of file GVN.cpp.

◆ erase()

void GVNPass::ValueTable::erase ( Value v)

Remove a value from the value numbering.

Definition at line 713 of file GVN.cpp.

Referenced by llvm::GVNPass::markInstructionForDeletion().

◆ eraseTranslateCacheEntry()

void GVNPass::ValueTable::eraseTranslateCacheEntry ( uint32_t  Num,
const BasicBlock CurrBlock 
)

Erase stale entry from phiTranslate cache so phiTranslate can be computed again.

Definition at line 2379 of file GVN.cpp.

References llvm::predecessors().

◆ exists()

bool GVNPass::ValueTable::exists ( Value V) const

Returns true if a value number exists for the specified value.

Definition at line 595 of file GVN.cpp.

◆ getAliasAnalysis()

AAResults * llvm::GVNPass::ValueTable::getAliasAnalysis ( ) const
inline

Definition at line 210 of file GVN.h.

Referenced by llvm::GVNPass::getAliasAnalysis().

◆ getNextUnusedValueNumber()

uint32_t llvm::GVNPass::ValueTable::getNextUnusedValueNumber ( )
inline

Definition at line 213 of file GVN.h.

◆ lookup()

uint32_t GVNPass::ValueTable::lookup ( Value V,
bool  Verify = true 
) const

Returns the value number of the specified value.

Fails if the value has not yet been numbered.

Definition at line 680 of file GVN.cpp.

References assert(), and Verify.

◆ lookupOrAdd()

uint32_t GVNPass::ValueTable::lookupOrAdd ( Value V)

lookup_or_add - Returns the value number for the specified value, assigning it a new number if it did not have one before.

Definition at line 601 of file GVN.cpp.

References I.

Referenced by llvm::CallInfo::insert(), llvm::InsnInfo::insert(), llvm::LoadInfo::insert(), and llvm::StoreInfo::insert().

◆ lookupOrAddCmp()

uint32_t GVNPass::ValueTable::lookupOrAddCmp ( unsigned  Opcode,
CmpInst::Predicate  Predicate,
Value LHS,
Value RHS 
)

Returns the value number of the given comparison, assigning it a new number if it did not have one before.

Useful when we deduced the result of a comparison, but don't immediately have an instruction realizing that comparison to hand.

Definition at line 693 of file GVN.cpp.

References LHS, and RHS.

◆ operator=()

GVNPass::ValueTable & GVNPass::ValueTable::operator= ( const ValueTable Arg)
default

◆ phiTranslate()

uint32_t GVNPass::ValueTable::phiTranslate ( const BasicBlock BB,
const BasicBlock PhiBlock,
uint32_t  Num,
GVNPass Gvn 
)

Wrap phiTranslateImpl to provide caching functionality.

Definition at line 2276 of file GVN.cpp.

◆ setAliasAnalysis()

void llvm::GVNPass::ValueTable::setAliasAnalysis ( AAResults A)
inline

Definition at line 209 of file GVN.h.

References A.

◆ setDomTree()

void llvm::GVNPass::ValueTable::setDomTree ( DominatorTree D)
inline

Definition at line 212 of file GVN.h.

References D.

◆ setMemDep()

void llvm::GVNPass::ValueTable::setMemDep ( MemoryDependenceResults M)
inline

Definition at line 211 of file GVN.h.

◆ verifyRemoved()

void GVNPass::ValueTable::verifyRemoved ( const Value V) const

verifyRemoved - Verify that the value is removed from all internal data structures.

Definition at line 723 of file GVN.cpp.

References assert().


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