LLVM  15.0.0git
Public Member Functions | List of all members
llvm::BitcodeReaderValueList Class Reference

#include "Bitcode/Reader/ValueList.h"

Public Member Functions

 BitcodeReaderValueList (LLVMContext &C, size_t RefsUpperBound)
 
 ~BitcodeReaderValueList ()
 
unsigned size () const
 
void resize (unsigned N)
 
void push_back (Value *V, unsigned TypeID)
 
void clear ()
 
Valueoperator[] (unsigned i) const
 
unsigned getTypeID (unsigned ValNo) const
 
Valueback () const
 
void pop_back ()
 
bool empty () const
 
void shrinkTo (unsigned N)
 
ConstantgetConstantFwdRef (unsigned Idx, Type *Ty, unsigned TyID)
 
ValuegetValueFwdRef (unsigned Idx, Type *Ty, unsigned TyID)
 
Error assignValue (unsigned Idx, Value *V, unsigned TypeID)
 
void resolveConstantForwardRefs ()
 Once all constants are read, this method bulk resolves any forward references. More...
 

Detailed Description

Definition at line 29 of file ValueList.h.

Constructor & Destructor Documentation

◆ BitcodeReaderValueList()

llvm::BitcodeReaderValueList::BitcodeReaderValueList ( LLVMContext C,
size_t  RefsUpperBound 
)
inline

Definition at line 49 of file ValueList.h.

References Context.

◆ ~BitcodeReaderValueList()

llvm::BitcodeReaderValueList::~BitcodeReaderValueList ( )
inline

Definition at line 54 of file ValueList.h.

References assert().

Member Function Documentation

◆ assignValue()

Error BitcodeReaderValueList::assignValue ( unsigned  Idx,
Value V,
unsigned  TypeID 
)

◆ back()

Value* llvm::BitcodeReaderValueList::back ( ) const
inline

Definition at line 82 of file ValueList.h.

◆ clear()

void llvm::BitcodeReaderValueList::clear ( )
inline

Definition at line 67 of file ValueList.h.

References assert().

◆ empty()

bool llvm::BitcodeReaderValueList::empty ( ) const
inline

Definition at line 86 of file ValueList.h.

◆ getConstantFwdRef()

Constant * BitcodeReaderValueList::getConstantFwdRef ( unsigned  Idx,
Type Ty,
unsigned  TyID 
)

Definition at line 100 of file ValueList.cpp.

References llvm::report_fatal_error(), resize(), and size().

◆ getTypeID()

unsigned llvm::BitcodeReaderValueList::getTypeID ( unsigned  ValNo) const
inline

Definition at line 77 of file ValueList.h.

References assert().

◆ getValueFwdRef()

Value * BitcodeReaderValueList::getValueFwdRef ( unsigned  Idx,
Type Ty,
unsigned  TyID 
)

Definition at line 121 of file ValueList.cpp.

References resize(), and size().

◆ operator[]()

Value* llvm::BitcodeReaderValueList::operator[] ( unsigned  i) const
inline

Definition at line 72 of file ValueList.h.

References assert(), and i.

Referenced by resolveConstantForwardRefs().

◆ pop_back()

void llvm::BitcodeReaderValueList::pop_back ( )
inline

Definition at line 83 of file ValueList.h.

◆ push_back()

void llvm::BitcodeReaderValueList::push_back ( Value V,
unsigned  TypeID 
)
inline

Definition at line 63 of file ValueList.h.

Referenced by assignValue().

◆ resize()

void llvm::BitcodeReaderValueList::resize ( unsigned  N)
inline

Definition at line 60 of file ValueList.h.

References N.

Referenced by assignValue(), getConstantFwdRef(), and getValueFwdRef().

◆ resolveConstantForwardRefs()

void BitcodeReaderValueList::resolveConstantForwardRefs ( )

Once all constants are read, this method bulk resolves any forward references.

The idea behind this is that we sometimes get constants (such as large arrays) which reference many forward ref constants. Replacing each of these causes a lot of thrashing when building/reuniquing the constant. Instead of doing this, we look at all the uses and rewrite all the place holders at once for any constant that uses a placeholder.

Definition at line 153 of file ValueList.cpp.

References assert(), llvm::SmallVectorImpl< T >::clear(), llvm::Constant::destroyConstant(), E, llvm::ConstantArray::get(), llvm::ConstantStruct::get(), llvm::ConstantVector::get(), I, llvm::lower_bound(), llvm::User::op_begin(), llvm::User::op_end(), operator[](), llvm::Value::replaceAllUsesWith(), and llvm::sort().

◆ shrinkTo()

void llvm::BitcodeReaderValueList::shrinkTo ( unsigned  N)
inline

Definition at line 88 of file ValueList.h.

References assert(), N, and size().

◆ size()

unsigned llvm::BitcodeReaderValueList::size ( ) const
inline

Definition at line 59 of file ValueList.h.

Referenced by assignValue(), getConstantFwdRef(), getValueFwdRef(), and shrinkTo().


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