LLVM 24.0.0git
llvm::MDFunctionLocalContext Class Reference

Storage class for function-local metadata objects. More...

#include "llvm/IR/FunctionLocalMetadata.h"

Inheritance diagram for llvm::MDFunctionLocalContext:
[legend]

Public Member Functions

LLVM_ABI void getUsedMDNodes (SmallVectorImpl< const MDNode * > &Nodes) const
TempMDFunctionLocalContext clone () const
TempMDFunctionLocalContext cloneImpl () const
bool isNonDebug () const
ArrayRef< FLScope > getScopes () const
ArrayRef< FLSrcLoc > getSrcLocs () const
ArrayRef< FLInlinedCall > getInlinedCalls () const
FLScope getScope (FLIndex< FLScope > Idx) const
FLScope getScope (FLIndex< FLScope > Idx, FLIndex< FLInlinedCall > InlinedAt) const
FLSrcLoc getSrcLoc (FLIndex< FLSrcLoc > Idx) const
FLSrcLoc getSrcLoc (FLIndex< FLSrcLoc > Idx, FLIndex< FLInlinedCall > InlinedAt) const
FLInlinedCall getInlinedCall (FLIndex< FLInlinedCall > Idx) const
uint16_t getMaxAtomGroup () const
void setMaxAtomGroup (uint16_t NewAtomGroup)
 Generally this shouldn't be called directly; prefer updateAtomGroupWaterline, including any relevant InlinedAt.
uint16_t getNewAtomGroup (FLIndex< FLInlinedCall > InlinedCallIdx)
void updateAtomGroupWaterline (FLIndex< FLInlinedCall > InlinedCallIdx, uint16_t NewWaterline)
uint16_t getAtomGroupWaterline (FLIndex< FLInlinedCall > InlinedCallIdx)
FLIndex< FLScope > insertScope (FLScope Scope)
 Inserts a new FLScope Scope and returns its index.
FLIndex< FLScope > getOrInsertScope (FLScope Scope)
 Returns the existing index of Scope, or else inserts it and returns its new index.
FLIndex< FLSrcLoc > insertSrcLoc (FLSrcLoc SrcLoc)
 Inserts a new FLSrcLoc SrcLoc and returns its index.
FLIndex< FLSrcLoc > getOrInsertSrcLoc (FLSrcLoc SrcLoc)
 Returns the existing index of SrcLoc, or else inserts it and returns its new index.
FLIndex< FLInlinedCall > insertInlinedCall (FLInlinedCall InlinedCall, bool UniquableMayExist=true)
 Returns the existing index of a uniquable InlinedCall, or else inserts it and returns its new index.
Public Member Functions inherited from llvm::MDNode
 MDNode (const MDNode &)=delete
void operator= (const MDNode &)=delete
void * operator new (size_t)=delete
LLVM_ABI TempMDNode clone () const
 Create a (temporary) clone of this.
LLVMContext & getContext () const
LLVM_ABI void replaceOperandWith (unsigned I, Metadata *New)
 Replace a specific operand.
bool isResolved () const
 Check if node is fully resolved.
bool isUniqued () const
bool isDistinct () const
bool isTemporary () const
bool isReplaceable () const
unsigned getNumTemporaryUses () const
void replaceAllUsesWith (Metadata *MD)
 RAUW a temporary.
LLVM_ABI void resolveCycles ()
 Resolve cycles.
LLVM_ABI void resolve ()
 Resolve a unique, unresolved node.
op_iterator op_begin () const
op_iterator op_end () const
ArrayRef< MDOperand > operands () const
const MDOperand & getOperand (unsigned I) const
unsigned getNumOperands () const
 Return number of MDNode operands.
LLVM_ABI bool isTBAAVtableAccess () const
 Check whether MDNode is a vtable access.
LLVM_ABI void printTree (raw_ostream &OS, const Module *M=nullptr) const
 Print in tree shape.
LLVM_ABI void printTree (raw_ostream &OS, ModuleSlotTracker &MST, const Module *M=nullptr) const
LLVM_ABI void dumpTree () const
 User-friendly dump in tree shape.
LLVM_ABI void dumpTree (const Module *M) const

Static Public Member Functions

static bool classof (const Metadata *MD)
static LLVM_ABI MDFunctionLocalContext * getDistinct (LLVMContext &Context, bool NonDebug=false)
Static Public Member Functions inherited from llvm::MDNode
static MDTuple * get (LLVMContext &Context, ArrayRef< Metadata * > MDs)
static MDTuple * getIfExists (LLVMContext &Context, ArrayRef< Metadata * > MDs)
static MDTuple * getDistinct (LLVMContext &Context, ArrayRef< Metadata * > MDs)
static TempMDTuple getTemporary (LLVMContext &Context, ArrayRef< Metadata * > MDs)
static LLVM_ABI void deleteTemporary (MDNode *N)
 Deallocate a node created by getTemporary.
template<class T>
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithPermanent (std::unique_ptr< T, TempMDNodeDeleter > N)
 Replace a temporary node with a permanent one.
template<class T>
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithUniqued (std::unique_ptr< T, TempMDNodeDeleter > N)
 Replace a temporary node with a uniqued one.
template<class T>
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithDistinct (std::unique_ptr< T, TempMDNodeDeleter > N)
 Replace a temporary node with a distinct one.
static bool classof (const Metadata *MD)
 Methods for support type inquiry through isa, cast, and dyn_cast:
static LLVM_ABI MDNode * concatenate (MDNode *A, MDNode *B)
 Methods for metadata merging.
static LLVM_ABI MDNode * intersect (MDNode *A, MDNode *B)
static LLVM_ABI MDNode * getMostGenericTBAA (MDNode *A, MDNode *B)
static LLVM_ABI MDNode * getMostGenericFPMath (MDNode *A, MDNode *B)
static LLVM_ABI MDNode * getMostGenericRange (MDNode *A, MDNode *B)
static LLVM_ABI MDNode * getMostGenericNoaliasAddrspace (MDNode *A, MDNode *B)
static LLVM_ABI MDNode * getMostGenericAliasScope (MDNode *A, MDNode *B)
static LLVM_ABI MDNode * getMostGenericAlignmentOrDereferenceable (MDNode *A, MDNode *B)
static LLVM_ABI MDNode * getMostGenericNoFPClass (MDNode *A, MDNode *B)
static LLVM_ABI MDNode * getMergedProfMetadata (MDNode *A, MDNode *B, const Instruction *AInstr, const Instruction *BInstr)
 Merge !prof metadata from two instructions.
static LLVM_ABI MDNode * getMergedMemProfMetadata (MDNode *A, MDNode *B)
static LLVM_ABI MDNode * getMergedCallsiteMetadata (MDNode *A, MDNode *B)
static LLVM_ABI MDNode * getMergedCalleeTypeMetadata (const MDNode *A, const MDNode *B)
static LLVM_ABI MDNode * getMergedCalleesMetadata (MDNode *A, MDNode *B)
static LLVM_ABI MDNode * getMergedPCSectionsMetadata (MDNode *A, MDNode *B)
 Merge !pcsections of two merged instructions: the result requests every section that either requests.
static LLVM_ABI MDNode * getMergedAllocTokenMetadata (const MDNode *A, const MDNode *B)
static LLVM_ABI CaptureComponents toCaptureComponents (const MDNode *MD)
 Convert !captures metadata to CaptureComponents. MD may be nullptr.
static LLVM_ABI MDNode * fromCaptureComponents (LLVMContext &Ctx, CaptureComponents CC)
 Convert CaptureComponents to !captures metadata.

Static Public Attributes

static constexpr uint16_t MaxAllowedAtomGroup

Friends

class LLVMContextImpl
class MDNode

Additional Inherited Members

Public Types inherited from llvm::MDNode
using op_iterator = const MDOperand *
using op_range = iterator_range<op_iterator>
Protected Types inherited from llvm::MDNode
using mutable_op_range = iterator_range<MDOperand *>
 Active type of storage. More...
Protected Member Functions inherited from llvm::MDNode
LLVM_ABI MDNode (LLVMContext &Context, unsigned ID, StorageType Storage, ArrayRef< Metadata * > Ops1, ArrayRef< Metadata * > Ops2={})
 ~MDNode ()=default
LLVM_ABI void * operator new (size_t Size, size_t NumOps, StorageType Storage)
LLVM_ABI void operator delete (void *Mem)
void operator delete (void *, unsigned)
 Required by std, but never called.
void operator delete (void *, unsigned, bool)
 Required by std, but never called.
LLVM_ABI void dropAllReferences ()
MDOperand * mutable_begin ()
MDOperand * mutable_end ()
mutable_op_range mutable_operands ()
LLVM_ABI void setOperand (unsigned I, Metadata *New)
 Set an operand.
unsigned getNumUnresolved () const
void setNumUnresolved (unsigned N)
LLVM_ABI void storeDistinctInContext ()
void resize (size_t NumOps)
 Resize the node to hold NumOps operands.
Static Protected Member Functions inherited from llvm::MDNode
template<class T, class StoreT>
static T * storeImpl (T *N, StorageType Storage, StoreT &Store)
template<class T>
static T * storeImpl (T *N, StorageType Storage)

Detailed Description

Storage class for function-local metadata objects.

This is a special MDNode variation: the class benefits from being able to appear as an operand in other MDNodes, to be treated as a metadata attachment to functions, and from the generic MDNode enumeration logic. However, it holds MDNode references that are not part of the MDNode operands() array and are not tracking references (meaning it contains forward references that must be resolved separately from the generic MDNode tracking/resolution facilities), does not meaningfully support cloning, and can only ever be created as distinct, not unique or temporary. To access all MDNodes referenced from this context, use the getUsedMDNodes() function.

Definition at line 220 of file FunctionLocalMetadata.h.

Member Function Documentation

◆ classof()

bool llvm::MDFunctionLocalContext::classof ( const Metadata * MD)
inlinestatic

Definition at line 248 of file FunctionLocalMetadata.h.

References llvm::Metadata::getMetadataID().

◆ clone()

TempMDFunctionLocalContext llvm::MDFunctionLocalContext::clone ( ) const
inline

Definition at line 257 of file FunctionLocalMetadata.h.

References cloneImpl().

◆ cloneImpl()

TempMDFunctionLocalContext llvm::MDFunctionLocalContext::cloneImpl ( ) const
inline

Definition at line 258 of file FunctionLocalMetadata.h.

References llvm_unreachable.

Referenced by clone().

◆ getAtomGroupWaterline()

uint16_t llvm::MDFunctionLocalContext::getAtomGroupWaterline ( FLIndex< FLInlinedCall > InlinedCallIdx)
inline

◆ getDistinct()

MDFunctionLocalContext * MDFunctionLocalContext::getDistinct ( LLVMContext & Context,
bool NonDebug = false )
static

◆ getInlinedCall()

FLInlinedCall llvm::MDFunctionLocalContext::getInlinedCall ( FLIndex< FLInlinedCall > Idx) const
inline

◆ getInlinedCalls()

ArrayRef< FLInlinedCall > llvm::MDFunctionLocalContext::getInlinedCalls ( ) const
inline

Definition at line 282 of file FunctionLocalMetadata.h.

Referenced by getUsedMDNodes().

◆ getMaxAtomGroup()

uint16_t llvm::MDFunctionLocalContext::getMaxAtomGroup ( ) const
inline

◆ getNewAtomGroup()

uint16_t llvm::MDFunctionLocalContext::getNewAtomGroup ( FLIndex< FLInlinedCall > InlinedCallIdx)
inline

◆ getOrInsertScope()

FLIndex< FLScope > llvm::MDFunctionLocalContext::getOrInsertScope ( FLScope Scope)
inline

Returns the existing index of Scope, or else inserts it and returns its new index.

NB: Uses linear search, which is very inefficient, but required if we may be inserting a duplicate Scope; if performing this operation repeatedly, FLMDBuilder is significantly more efficient.

Definition at line 353 of file FunctionLocalMetadata.h.

References insertScope().

◆ getOrInsertSrcLoc()

FLIndex< FLSrcLoc > llvm::MDFunctionLocalContext::getOrInsertSrcLoc ( FLSrcLoc SrcLoc)
inline

Returns the existing index of SrcLoc, or else inserts it and returns its new index.

NB: Uses linear search, which is very inefficient, but required if we may be inserting a duplicate SrcLoc; if performing this operation repeatedly, FLMDBuilder is significantly more efficient. An exception to this is if inserting a SrcLoc with DISubprogram scope, column=0, and line equal to either 0, SP->getLine(), or SP->getScopeLine(); these are inserted near the front of SrcLocs by FLMDBuilder, so can generally be retrieved quickly.

Definition at line 374 of file FunctionLocalMetadata.h.

References insertSrcLoc().

◆ getScope() [1/2]

FLScope llvm::MDFunctionLocalContext::getScope ( FLIndex< FLScope > Idx) const
inline

Definition at line 284 of file FunctionLocalMetadata.h.

References assert().

◆ getScope() [2/2]

FLScope llvm::MDFunctionLocalContext::getScope ( FLIndex< FLScope > Idx,
FLIndex< FLInlinedCall > InlinedAt ) const
inline

Definition at line 288 of file FunctionLocalMetadata.h.

References assert(), and llvm::FLIndex< IndexedType >::get().

◆ getScopes()

ArrayRef< FLScope > llvm::MDFunctionLocalContext::getScopes ( ) const
inline

Definition at line 280 of file FunctionLocalMetadata.h.

Referenced by getUsedMDNodes().

◆ getSrcLoc() [1/2]

FLSrcLoc llvm::MDFunctionLocalContext::getSrcLoc ( FLIndex< FLSrcLoc > Idx) const
inline

Definition at line 295 of file FunctionLocalMetadata.h.

References assert().

◆ getSrcLoc() [2/2]

FLSrcLoc llvm::MDFunctionLocalContext::getSrcLoc ( FLIndex< FLSrcLoc > Idx,
FLIndex< FLInlinedCall > InlinedAt ) const
inline

Definition at line 299 of file FunctionLocalMetadata.h.

References assert(), and llvm::FLIndex< IndexedType >::get().

◆ getSrcLocs()

ArrayRef< FLSrcLoc > llvm::MDFunctionLocalContext::getSrcLocs ( ) const
inline

Definition at line 281 of file FunctionLocalMetadata.h.

◆ getUsedMDNodes()

void MDFunctionLocalContext::getUsedMDNodes ( SmallVectorImpl< const MDNode * > & Nodes) const

◆ insertInlinedCall()

FLIndex< FLInlinedCall > llvm::MDFunctionLocalContext::insertInlinedCall ( FLInlinedCall InlinedCall,
bool UniquableMayExist = true )
inline

Returns the existing index of a uniquable InlinedCall, or else inserts it and returns its new index.

NB: Uses linear search for uniquing, which is very inefficient; pass UniquableMayExist as false if passing an InlinedCall which is uniquable but is known to not already exist.

Definition at line 386 of file FunctionLocalMetadata.h.

References llvm::FLInlinedCall::isEquivalent(), llvm::FLInlinedCall::MaxAtomGroup, and llvm::FLInlinedCall::Uniquable.

◆ insertScope()

FLIndex< FLScope > llvm::MDFunctionLocalContext::insertScope ( FLScope Scope)
inline

Inserts a new FLScope Scope and returns its index.

Definition at line 344 of file FunctionLocalMetadata.h.

Referenced by getOrInsertScope().

◆ insertSrcLoc()

FLIndex< FLSrcLoc > llvm::MDFunctionLocalContext::insertSrcLoc ( FLSrcLoc SrcLoc)
inline

Inserts a new FLSrcLoc SrcLoc and returns its index.

Definition at line 361 of file FunctionLocalMetadata.h.

Referenced by getOrInsertSrcLoc().

◆ isNonDebug()

bool llvm::MDFunctionLocalContext::isNonDebug ( ) const
inline

Definition at line 278 of file FunctionLocalMetadata.h.

References llvm::Metadata::SubclassData1.

◆ setMaxAtomGroup()

void llvm::MDFunctionLocalContext::setMaxAtomGroup ( uint16_t NewAtomGroup)
inline

Generally this shouldn't be called directly; prefer updateAtomGroupWaterline, including any relevant InlinedAt.

TODO: Should this be private?

Definition at line 315 of file FunctionLocalMetadata.h.

References llvm::Metadata::SubclassData16.

Referenced by getNewAtomGroup(), and updateAtomGroupWaterline().

◆ updateAtomGroupWaterline()

void llvm::MDFunctionLocalContext::updateAtomGroupWaterline ( FLIndex< FLInlinedCall > InlinedCallIdx,
uint16_t NewWaterline )
inline

◆ LLVMContextImpl

friend class LLVMContextImpl
friend

Definition at line 243 of file FunctionLocalMetadata.h.

References LLVMContextImpl.

Referenced by LLVMContextImpl.

◆ MDNode

friend class MDNode
friend

Definition at line 244 of file FunctionLocalMetadata.h.

References MDNode.

Referenced by MDNode.

Member Data Documentation

◆ MaxAllowedAtomGroup

uint16_t llvm::MDFunctionLocalContext::MaxAllowedAtomGroup
staticconstexpr
Initial value:

Definition at line 245 of file FunctionLocalMetadata.h.

Referenced by getNewAtomGroup(), and updateAtomGroupWaterline().


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