LLVM  14.0.0git
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
llvm::ValueEnumerator Class Reference

#include "Bitcode/Writer/ValueEnumerator.h"

Collaboration diagram for llvm::ValueEnumerator:
Collaboration graph
[legend]

Public Types

using TypeList = std::vector< Type * >
 
using ValueList = std::vector< std::pair< const Value *, unsigned > >
 
using IndexAndAttrSet = std::pair< unsigned, AttributeSet >
 Attribute groups as encoded in bitcode are almost AttributeSets, but they include the AttributeList index, so we have to track that in our map. More...
 

Public Member Functions

 ValueEnumerator (const Module &M, bool ShouldPreserveUseListOrder)
 
 ValueEnumerator (const ValueEnumerator &)=delete
 
ValueEnumeratoroperator= (const ValueEnumerator &)=delete
 
void dump () const
 
void print (raw_ostream &OS, const ValueMapType &Map, const char *Name) const
 
void print (raw_ostream &OS, const MetadataMapType &Map, const char *Name) const
 
unsigned getValueID (const Value *V) const
 
unsigned getMetadataID (const Metadata *MD) const
 
unsigned getMetadataOrNullID (const Metadata *MD) const
 
unsigned numMDs () const
 
bool shouldPreserveUseListOrder () const
 
unsigned getTypeID (Type *T) const
 
unsigned getInstructionID (const Instruction *I) const
 
void setInstructionID (const Instruction *I)
 
unsigned getAttributeListID (AttributeList PAL) const
 
unsigned getAttributeGroupID (IndexAndAttrSet Group) const
 
void getFunctionConstantRange (unsigned &Start, unsigned &End) const
 getFunctionConstantRange - Return the range of values that corresponds to function-local constants. More...
 
const ValueListgetValues () const
 
bool hasMDs () const
 Check whether the current block has any metadata to emit. More...
 
ArrayRef< const Metadata * > getMDStrings () const
 Get the MDString metadata for this block. More...
 
ArrayRef< const Metadata * > getNonMDStrings () const
 Get the non-MDString metadata for this block. More...
 
const TypeListgetTypes () const
 
const std::vector< const BasicBlock * > & getBasicBlocks () const
 
const std::vector< AttributeList > & getAttributeLists () const
 
const std::vector< IndexAndAttrSet > & getAttributeGroups () const
 
const ComdatSetTypegetComdats () const
 
unsigned getComdatID (const Comdat *C) const
 
unsigned getGlobalBasicBlockID (const BasicBlock *BB) const
 getGlobalBasicBlockID - This returns the function-specific ID for the specified basic block. More...
 
void incorporateFunction (const Function &F)
 incorporateFunction/purgeFunction - If you'd like to deal with a function, use these two methods to get its data into the ValueEnumerator! More...
 
void purgeFunction ()
 
uint64_t computeBitsRequiredForTypeIndicies () const
 

Public Attributes

UseListOrderStack UseListOrders
 

Detailed Description

Definition at line 43 of file ValueEnumerator.h.

Member Typedef Documentation

◆ IndexAndAttrSet

Attribute groups as encoded in bitcode are almost AttributeSets, but they include the AttributeList index, so we have to track that in our map.

Definition at line 52 of file ValueEnumerator.h.

◆ TypeList

using llvm::ValueEnumerator::TypeList = std::vector<Type *>

Definition at line 45 of file ValueEnumerator.h.

◆ ValueList

using llvm::ValueEnumerator::ValueList = std::vector<std::pair<const Value *, unsigned> >

Definition at line 48 of file ValueEnumerator.h.

Constructor & Destructor Documentation

◆ ValueEnumerator() [1/2]

ValueEnumerator::ValueEnumerator ( const Module M,
bool  ShouldPreserveUseListOrder 
)

◆ ValueEnumerator() [2/2]

llvm::ValueEnumerator::ValueEnumerator ( const ValueEnumerator )
delete

Member Function Documentation

◆ computeBitsRequiredForTypeIndicies()

uint64_t ValueEnumerator::computeBitsRequiredForTypeIndicies ( ) const

Definition at line 1179 of file ValueEnumerator.cpp.

References getTypes(), llvm::Log2_32_Ceil(), and llvm::size().

◆ dump()

LLVM_DUMP_METHOD void ValueEnumerator::dump ( ) const

Definition at line 532 of file ValueEnumerator.cpp.

References llvm::dbgs(), and print().

◆ getAttributeGroupID()

unsigned llvm::ValueEnumerator::getAttributeGroupID ( IndexAndAttrSet  Group) const
inline

Definition at line 182 of file ValueEnumerator.h.

References assert(), and I.

◆ getAttributeGroups()

const std::vector<IndexAndAttrSet>& llvm::ValueEnumerator::getAttributeGroups ( ) const
inline

Definition at line 220 of file ValueEnumerator.h.

◆ getAttributeListID()

unsigned llvm::ValueEnumerator::getAttributeListID ( AttributeList  PAL) const
inline

Definition at line 175 of file ValueEnumerator.h.

References assert(), I, and llvm::AttributeList::isEmpty().

◆ getAttributeLists()

const std::vector<AttributeList>& llvm::ValueEnumerator::getAttributeLists ( ) const
inline

Definition at line 218 of file ValueEnumerator.h.

◆ getBasicBlocks()

const std::vector<const BasicBlock*>& llvm::ValueEnumerator::getBasicBlocks ( ) const
inline

Definition at line 214 of file ValueEnumerator.h.

◆ getComdatID()

unsigned ValueEnumerator::getComdatID ( const Comdat C) const

Definition at line 512 of file ValueEnumerator.cpp.

References assert(), and llvm::UniqueVector< T >::idFor().

◆ getComdats()

const ComdatSetType& llvm::ValueEnumerator::getComdats ( ) const
inline

Definition at line 224 of file ValueEnumerator.h.

◆ getFunctionConstantRange()

void llvm::ValueEnumerator::getFunctionConstantRange ( unsigned &  Start,
unsigned &  End 
) const
inline

getFunctionConstantRange - Return the range of values that corresponds to function-local constants.

Definition at line 192 of file ValueEnumerator.h.

◆ getGlobalBasicBlockID()

unsigned ValueEnumerator::getGlobalBasicBlockID ( const BasicBlock BB) const

getGlobalBasicBlockID - This returns the function-specific ID for the specified basic block.

This is relatively expensive information, so it should only be used by rare constructs such as address-of-label.

Definition at line 1170 of file ValueEnumerator.cpp.

References BB, and IncorporateFunctionInfoGlobalBBIDs().

◆ getInstructionID()

unsigned ValueEnumerator::getInstructionID ( const Instruction I) const

◆ getMDStrings()

ArrayRef<const Metadata *> llvm::ValueEnumerator::getMDStrings ( ) const
inline

Get the MDString metadata for this block.

Definition at line 203 of file ValueEnumerator.h.

References llvm::makeArrayRef().

◆ getMetadataID()

unsigned llvm::ValueEnumerator::getMetadataID ( const Metadata MD) const
inline

Definition at line 152 of file ValueEnumerator.h.

References assert(), and getMetadataOrNullID().

Referenced by getValueID().

◆ getMetadataOrNullID()

unsigned llvm::ValueEnumerator::getMetadataOrNullID ( const Metadata MD) const
inline

Definition at line 158 of file ValueEnumerator.h.

Referenced by getMetadataID().

◆ getNonMDStrings()

ArrayRef<const Metadata *> llvm::ValueEnumerator::getNonMDStrings ( ) const
inline

Get the non-MDString metadata for this block.

Definition at line 208 of file ValueEnumerator.h.

References llvm::makeArrayRef().

◆ getTypeID()

unsigned llvm::ValueEnumerator::getTypeID ( Type T) const
inline

◆ getTypes()

const TypeList& llvm::ValueEnumerator::getTypes ( ) const
inline

Definition at line 212 of file ValueEnumerator.h.

Referenced by computeBitsRequiredForTypeIndicies().

◆ getValueID()

unsigned ValueEnumerator::getValueID ( const Value V) const

◆ getValues()

const ValueList& llvm::ValueEnumerator::getValues ( ) const
inline

Definition at line 197 of file ValueEnumerator.h.

◆ hasMDs()

bool llvm::ValueEnumerator::hasMDs ( ) const
inline

Check whether the current block has any metadata to emit.

Definition at line 200 of file ValueEnumerator.h.

◆ incorporateFunction()

void ValueEnumerator::incorporateFunction ( const Function F)

incorporateFunction/purgeFunction - If you'd like to deal with a function, use these two methods to get its data into the ValueEnumerator!

Definition at line 1060 of file ValueEnumerator.cpp.

References assert(), BB, llvm::ValueMap< KeyT, ValueT, Config >::count(), llvm::numbers::e, F, llvm::DIArgList::getArgs(), i, and I.

◆ numMDs()

unsigned llvm::ValueEnumerator::numMDs ( ) const
inline

Definition at line 162 of file ValueEnumerator.h.

◆ operator=()

ValueEnumerator& llvm::ValueEnumerator::operator= ( const ValueEnumerator )
delete

◆ print() [1/2]

void ValueEnumerator::print ( raw_ostream OS,
const MetadataMapType Map,
const char *  Name 
) const

Definition at line 568 of file ValueEnumerator.cpp.

References E, I, and llvm::Metadata::print().

◆ print() [2/2]

void ValueEnumerator::print ( raw_ostream OS,
const ValueMapType Map,
const char *  Name 
) const

◆ purgeFunction()

void ValueEnumerator::purgeFunction ( )

◆ setInstructionID()

void ValueEnumerator::setInstructionID ( const Instruction I)

Definition at line 518 of file ValueEnumerator.cpp.

References I.

◆ shouldPreserveUseListOrder()

bool llvm::ValueEnumerator::shouldPreserveUseListOrder ( ) const
inline

Definition at line 164 of file ValueEnumerator.h.

Member Data Documentation

◆ UseListOrders

UseListOrderStack llvm::ValueEnumerator::UseListOrders

Definition at line 54 of file ValueEnumerator.h.

Referenced by ValueEnumerator().


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