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

#include "Bitcode/Writer/ValueEnumerator.h"

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.
 

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.
 
const ValueListgetValues () const
 
bool hasMDs () const
 Check whether the current block has any metadata to emit.
 
ArrayRef< const Metadata * > getMDStrings () const
 Get the MDString metadata for this block.
 
ArrayRef< const Metadata * > getNonMDStrings () const
 Get the non-MDString metadata for this block.
 
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.
 
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!
 
void purgeFunction ()
 
uint64_t computeBitsRequiredForTypeIndices () 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

◆ computeBitsRequiredForTypeIndices()

uint64_t ValueEnumerator::computeBitsRequiredForTypeIndices ( ) const

Definition at line 1193 of file ValueEnumerator.cpp.

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

◆ dump()

LLVM_DUMP_METHOD void ValueEnumerator::dump ( ) const

Definition at line 529 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

◆ 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.

References End.

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

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

Referenced by getGlobalBasicBlockID().

◆ 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::ArrayRef< T >::slice().

◆ 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::ArrayRef< T >::slice().

◆ 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 computeBitsRequiredForTypeIndices().

◆ 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!

RemoveDIs: Add non-instruction function-local metadata uses.

Definition at line 1058 of file ValueEnumerator.cpp.

References assert(), llvm::ValueMap< KeyT, ValueT, Config >::count(), F, llvm::filterDbgVars(), llvm::DIArgList::getArgs(), I, Local, and llvm::SmallVectorTemplateBase< T, bool >::push_back().

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

References I, Name, OS, and llvm::Metadata::print().

◆ print() [2/2]

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

Definition at line 537 of file ValueEnumerator.cpp.

References llvm::errs(), I, Name, and OS.

Referenced by dump().

◆ purgeFunction()

void ValueEnumerator::purgeFunction ( )

◆ setInstructionID()

void ValueEnumerator::setInstructionID ( const Instruction I)

Definition at line 515 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

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