LLVM  8.0.1
Public Member Functions | List of all members
llvm::GVN::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 ()
 
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. More...
 
uint32_t lookup (Value *V, bool Verify=true) const
 Returns the value number of the specified value. More...
 
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. More...
 
uint32_t phiTranslate (const BasicBlock *BB, const BasicBlock *PhiBlock, uint32_t Num, GVN &Gvn)
 Wrap phiTranslateImpl to provide caching functionality. More...
 
void eraseTranslateCacheEntry (uint32_t Num, const BasicBlock &CurrBlock)
 Erase stale entry from phiTranslate cache so phiTranslate can be computed again. More...
 
bool exists (Value *V) const
 Returns true if a value number exists for the specified value. More...
 
void add (Value *V, uint32_t num)
 add - Insert a value into the table with a specified value number. More...
 
void clear ()
 Remove all entries from the ValueTable. More...
 
void erase (Value *v)
 Remove a value from the value numbering. More...
 
void setAliasAnalysis (AliasAnalysis *A)
 
AliasAnalysisgetAliasAnalysis () 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. More...
 

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 90 of file GVN.h.

Constructor & Destructor Documentation

◆ ValueTable() [1/3]

GVN::ValueTable::ValueTable ( )
default

◆ ValueTable() [2/3]

GVN::ValueTable::ValueTable ( const ValueTable Arg)
default

◆ ValueTable() [3/3]

GVN::ValueTable::ValueTable ( ValueTable &&  Arg)
default

◆ ~ValueTable()

GVN::ValueTable::~ValueTable ( )
default

Member Function Documentation

◆ add()

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

◆ clear()

void GVN::ValueTable::clear ( )

Remove all entries from the ValueTable.

Definition at line 596 of file GVN.cpp.

References Expressions.

◆ erase()

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

Remove a value from the value numbering.

Definition at line 608 of file GVN.cpp.

◆ eraseTranslateCacheEntry()

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

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

Definition at line 1594 of file GVN.cpp.

References if(), and llvm::predecessors().

◆ exists()

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

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

Definition at line 497 of file GVN.cpp.

◆ getAliasAnalysis()

AliasAnalysis* llvm::GVN::ValueTable::getAliasAnalysis ( ) const
inline

Definition at line 145 of file GVN.h.

◆ getNextUnusedValueNumber()

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

Definition at line 148 of file GVN.h.

◆ lookup()

uint32_t GVN::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 575 of file GVN.cpp.

References assert(), and VI.

◆ lookupOrAdd()

uint32_t GVN::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 501 of file GVN.cpp.

References llvm::MCID::Add, llvm::MCID::Call, llvm::Intrinsic::exp, llvm::Instruction::getOpcode(), if(), llvm::MCID::Select, and VI.

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

◆ lookupOrAddCmp()

uint32_t GVN::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 588 of file GVN.cpp.

References llvm::Intrinsic::exp.

◆ phiTranslate()

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

◆ setAliasAnalysis()

void llvm::GVN::ValueTable::setAliasAnalysis ( AliasAnalysis A)
inline

Definition at line 144 of file GVN.h.

◆ setDomTree()

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

Definition at line 147 of file GVN.h.

References D.

◆ setMemDep()

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

Definition at line 146 of file GVN.h.

◆ verifyRemoved()

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

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

Definition at line 618 of file GVN.cpp.

References assert(), E, and I.


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