LLVM  12.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 42 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 51 of file ValueEnumerator.h.

◆ TypeList

Definition at line 44 of file ValueEnumerator.h.

◆ ValueList

Definition at line 47 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 1068 of file ValueEnumerator.cpp.

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

Referenced by getAttrKindEncoding(), and getComdats().

◆ dump()

LLVM_DUMP_METHOD void ValueEnumerator::dump ( ) const

Definition at line 487 of file ValueEnumerator.cpp.

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

◆ getAttributeGroupID()

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

◆ getAttributeGroups()

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

Definition at line 219 of file ValueEnumerator.h.

Referenced by getAttrKindEncoding().

◆ getAttributeListID()

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

◆ getAttributeLists()

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

Definition at line 217 of file ValueEnumerator.h.

Referenced by getAttrKindEncoding().

◆ getBasicBlocks()

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

Definition at line 213 of file ValueEnumerator.h.

◆ getComdatID()

unsigned ValueEnumerator::getComdatID ( const Comdat C) const

Definition at line 467 of file ValueEnumerator.cpp.

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

Referenced by getComdats().

◆ getComdats()

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

◆ 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 191 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 1059 of file ValueEnumerator.cpp.

References llvm::BasicBlock::getParent(), and IncorporateFunctionInfoGlobalBBIDs().

Referenced by getComdats().

◆ 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 202 of file ValueEnumerator.h.

References llvm::makeArrayRef().

◆ getMetadataID()

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

Definition at line 151 of file ValueEnumerator.h.

References assert(), and getMetadataOrNullID().

Referenced by emitWideAPInt(), getOptimizationFlags(), and getValueID().

◆ getMetadataOrNullID()

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

◆ getNonMDStrings()

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

Get the non-MDString metadata for this block.

Definition at line 207 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 211 of file ValueEnumerator.h.

Referenced by computeBitsRequiredForTypeIndicies(), and getAttrKindEncoding().

◆ getValueID()

unsigned ValueEnumerator::getValueID ( const Value V) const

◆ getValues()

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

Definition at line 196 of file ValueEnumerator.h.

◆ hasMDs()

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

Check whether the current block has any metadata to emit.

Definition at line 199 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 969 of file ValueEnumerator.cpp.

References llvm::Function::args(), assert(), llvm::ValueMap< KeyT, ValueT, Config >::count(), llvm::numbers::e, I, llvm::SmallVectorTemplateBase< T >::push_back(), and llvm::SmallVectorBase< SmallVectorSizeType< T > >::size().

Referenced by getComdats().

◆ numMDs()

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

Definition at line 161 of file ValueEnumerator.h.

◆ operator=()

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

◆ print() [1/2]

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

◆ print() [2/2]

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

◆ purgeFunction()

void ValueEnumerator::purgeFunction ( )

◆ setInstructionID()

void ValueEnumerator::setInstructionID ( const Instruction I)

Definition at line 473 of file ValueEnumerator.cpp.

References I.

Referenced by getTypeID().

◆ shouldPreserveUseListOrder()

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

Definition at line 163 of file ValueEnumerator.h.

Referenced by writeIdentificationBlock().

Member Data Documentation

◆ UseListOrders

UseListOrderStack llvm::ValueEnumerator::UseListOrders

Definition at line 53 of file ValueEnumerator.h.

Referenced by ValueEnumerator().


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