LLVM 22.0.0git
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
llvm::DILocation Class Reference

Debug location. More...

#include "llvm/IR/DebugInfoMetadata.h"

Inheritance diagram for llvm::DILocation:
[legend]

Public Member Functions

uint64_t getAtomGroup () const
 
uint8_t getAtomRank () const
 
const DILocationgetWithoutAtom () const
 
void replaceOperandWith (unsigned I, Metadata *New)=delete
 
 DEFINE_MDNODE_GET (DILocation,(unsigned Line, unsigned Column, Metadata *Scope, Metadata *InlinedAt=nullptr, bool ImplicitCode=false, uint64_t AtomGroup=0, uint8_t AtomRank=0),(Line, Column, Scope, InlinedAt, ImplicitCode, AtomGroup, AtomRank)) DEFINE_MDNODE_GET(DILocation
 
const DILocationcloneWithDiscriminator (unsigned Discriminator) const
 Returns a new DILocation with updated Discriminator.
 
std::optional< const DILocation * > cloneWithBaseDiscriminator (unsigned BD) const
 Returns a new DILocation with updated base discriminator BD.
 
unsigned getDuplicationFactor () const
 Returns the duplication factor stored in the discriminator, or 1 if no duplication factor (or 0) is encoded.
 
unsigned getCopyIdentifier () const
 Returns the copy identifier stored in the discriminator.
 
unsigned getBaseDiscriminator () const
 Returns the base discriminator stored in the discriminator.
 
std::optional< const DILocation * > cloneByMultiplyingDuplicationFactor (unsigned DF) const
 Returns a new DILocation with duplication factor DF * current duplication factor encoded in the discriminator.
 
MetadatagetRawScope () const
 
MetadatagetRawInlinedAt () const
 
- 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.
 
LLVMContextgetContext () 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
 
bool isAlwaysReplaceable () const
 
bool hasGeneralizedMDString ()
 Check if this is a valid generalized type metadata node.
 
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< MDOperandoperands () const
 
const MDOperandgetOperand (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 isPseudoProbeDiscriminator (unsigned Discriminator)
 
static LLVM_ABI DILocationgetMergedLocation (DILocation *LocA, DILocation *LocB)
 Attempts to merge LocA and LocB into a single location; see DebugLoc::getMergedLocation for more details.
 
static LLVM_ABI DILocationgetMergedLocations (ArrayRef< DILocation * > Locs)
 Try to combine the vector of locations passed as input in a single one.
 
static unsigned getMaskedDiscriminator (unsigned D, unsigned B)
 Return the masked discriminator value for an input discrimnator value D (i.e.
 
static unsigned getBaseDiscriminatorBits ()
 Return the bits used for base discriminators.
 
static unsigned getBaseDiscriminatorFromDiscriminator (unsigned D, bool IsFSDiscriminator=false)
 Returns the base discriminator for a given encoded discriminator D.
 
static LLVM_ABI std::optional< unsignedencodeDiscriminator (unsigned BD, unsigned DF, unsigned CI)
 Raw encoding of the discriminator.
 
static LLVM_ABI void decodeDiscriminator (unsigned D, unsigned &BD, unsigned &DF, unsigned &CI)
 Raw decoder for values in an encoded discriminator D.
 
static unsigned getDuplicationFactorFromDiscriminator (unsigned D)
 Returns the duplication factor for a given encoded discriminator D, or 1 if no value or 0 is encoded.
 
static unsigned getCopyIdentifierFromDiscriminator (unsigned D)
 Returns the copy identifier for a given encoded discriminator D.
 
static bool classof (const Metadata *MD)
 
- Static Public Member Functions inherited from llvm::MDNode
static MDTupleget (LLVMContext &Context, ArrayRef< Metadata * > MDs)
 
static MDTuplegetIfExists (LLVMContext &Context, ArrayRef< Metadata * > MDs)
 
static MDTuplegetDistinct (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 MDNodeconcatenate (MDNode *A, MDNode *B)
 Methods for metadata merging.
 
static LLVM_ABI MDNodeintersect (MDNode *A, MDNode *B)
 
static LLVM_ABI MDNodegetMostGenericTBAA (MDNode *A, MDNode *B)
 
static LLVM_ABI MDNodegetMostGenericFPMath (MDNode *A, MDNode *B)
 
static LLVM_ABI MDNodegetMostGenericRange (MDNode *A, MDNode *B)
 
static LLVM_ABI MDNodegetMostGenericNoaliasAddrspace (MDNode *A, MDNode *B)
 
static LLVM_ABI MDNodegetMostGenericAliasScope (MDNode *A, MDNode *B)
 
static LLVM_ABI MDNodegetMostGenericAlignmentOrDereferenceable (MDNode *A, MDNode *B)
 
static LLVM_ABI MDNodegetMergedProfMetadata (MDNode *A, MDNode *B, const Instruction *AInstr, const Instruction *BInstr)
 Merge !prof metadata from two instructions.
 
static LLVM_ABI MDNodegetMergedMemProfMetadata (MDNode *A, MDNode *B)
 
static LLVM_ABI MDNodegetMergedCallsiteMetadata (MDNode *A, MDNode *B)
 
static LLVM_ABI MDNodegetMergedCalleeTypeMetadata (const MDNode *A, const MDNode *B)
 

Public Attributes

unsigned Line
 
unsigned unsigned Column
 
unsigned unsigned DILocalScopeScope
 
unsigned unsigned DILocalScope DILocationInlinedAt = nullptr
 
unsigned unsigned DILocalScope DILocation bool ImplicitCode = false
 
unsigned unsigned DILocalScope DILocation bool uint64_t AtomGroup = 0
 
unsigned unsigned DILocalScope DILocation bool uint64_t uint8_t AtomRank
 

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 ()
 
MDOperandmutable_begin ()
 
MDOperandmutable_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 TstoreImpl (T *N, StorageType Storage, StoreT &Store)
 
template<class T >
static TstoreImpl (T *N, StorageType Storage)
 

Detailed Description

Debug location.

A debug location in source code, used for debug info and otherwise.

Uses the SubclassData1, SubclassData16 and SubclassData32 Metadata slots.

Definition at line 2506 of file DebugInfoMetadata.h.

Member Function Documentation

◆ classof()

static bool llvm::DILocation::classof ( const Metadata MD)
inlinestatic

Definition at line 2786 of file DebugInfoMetadata.h.

References llvm::Metadata::getMetadataID().

◆ cloneByMultiplyingDuplicationFactor()

std::optional< const DILocation * > llvm::DILocation::cloneByMultiplyingDuplicationFactor ( unsigned  DF) const
inline

Returns a new DILocation with duplication factor DF * current duplication factor encoded in the discriminator.

The current duplication factor is as defined by getDuplicationFactor(). Returns std::nullopt if encoding failed.

Definition at line 2975 of file DebugInfoMetadata.h.

References assert(), cloneWithDiscriminator(), D, DF, llvm::EnableFSDiscriminator, encodeDiscriminator(), getBaseDiscriminator(), getCopyIdentifier(), getDuplicationFactor(), and isPseudoProbeDiscriminator().

Referenced by llvm::VPTransformState::setDebugLocFrom().

◆ cloneWithBaseDiscriminator()

std::optional< const DILocation * > llvm::DILocation::cloneWithBaseDiscriminator ( unsigned  BD) const
inline

Returns a new DILocation with updated base discriminator BD.

Only the base discriminator is set in the new DILocation, the other encoded values are elided. If the discriminator cannot be encoded, the function returns std::nullopt.

Definition at line 2956 of file DebugInfoMetadata.h.

References cloneWithDiscriminator(), D, decodeDiscriminator(), DF, llvm::EnableFSDiscriminator, encodeDiscriminator(), and getBaseDiscriminator().

Referenced by addDiscriminators().

◆ cloneWithDiscriminator()

const DILocation * llvm::DILocation::cloneWithDiscriminator ( unsigned  Discriminator) const
inline

◆ decodeDiscriminator()

void DILocation::decodeDiscriminator ( unsigned  D,
unsigned BD,
unsigned DF,
unsigned CI 
)
static

Raw decoder for values in an encoded discriminator D.

Definition at line 446 of file DebugInfoMetadata.cpp.

References D, DF, getNextComponentInDiscriminator(), and getUnsignedFromPrefixEncoding().

Referenced by cloneWithBaseDiscriminator(), and encodeDiscriminator().

◆ DEFINE_MDNODE_GET()

llvm::DILocation::DEFINE_MDNODE_GET ( DILocation  ,
(unsigned Line, unsigned Column, Metadata *Scope, Metadata *InlinedAt=nullptr, bool ImplicitCode=false, uint64_t AtomGroup=0, uint8_t AtomRank=0)  ,
(Line, Column, Scope, InlinedAt, ImplicitCode, AtomGroup, AtomRank)   
)

◆ encodeDiscriminator()

std::optional< unsigned > DILocation::encodeDiscriminator ( unsigned  BD,
unsigned  DF,
unsigned  CI 
)
static

Raw encoding of the discriminator.

APIs such as cloneWithDuplicationFactor have certain special case behavior (e.g. treating empty duplication factor as the value '1'). This API, in conjunction with cloneWithDiscriminator, may be used to encode the raw values provided.

BD: base discriminator DF: duplication factor CI: copy index

The return is std::nullopt if the values cannot be encoded in 32 bits - for example, values for BD or DF larger than 12 bits. Otherwise, the return is the encoded value.

Definition at line 413 of file DebugInfoMetadata.cpp.

References llvm::CallingConv::C, decodeDiscriminator(), DF, encodeComponent(), encodingBits(), and I.

Referenced by cloneByMultiplyingDuplicationFactor(), and cloneWithBaseDiscriminator().

◆ getAtomGroup()

uint64_t llvm::DILocation::getAtomGroup ( ) const
inline

Definition at line 2540 of file DebugInfoMetadata.h.

Referenced by cloneWithDiscriminator(), getWithoutAtom(), and inlineDebugLoc().

◆ getAtomRank()

uint8_t llvm::DILocation::getAtomRank ( ) const
inline

Definition at line 2541 of file DebugInfoMetadata.h.

Referenced by cloneWithDiscriminator(), getWithoutAtom(), and inlineDebugLoc().

◆ getBaseDiscriminator()

unsigned llvm::DILocation::getBaseDiscriminator ( ) const
inline

◆ getBaseDiscriminatorBits()

static unsigned llvm::DILocation::getBaseDiscriminatorBits ( )
inlinestatic

Return the bits used for base discriminators.

Definition at line 2715 of file DebugInfoMetadata.h.

References llvm::getBaseFSBitEnd().

Referenced by getBaseDiscriminatorFromDiscriminator().

◆ getBaseDiscriminatorFromDiscriminator()

static unsigned llvm::DILocation::getBaseDiscriminatorFromDiscriminator ( unsigned  D,
bool  IsFSDiscriminator = false 
)
inlinestatic

◆ getCopyIdentifier()

unsigned llvm::DILocation::getCopyIdentifier ( ) const
inline

Returns the copy identifier stored in the discriminator.

Definition at line 2951 of file DebugInfoMetadata.h.

References getCopyIdentifierFromDiscriminator().

Referenced by cloneByMultiplyingDuplicationFactor().

◆ getCopyIdentifierFromDiscriminator()

static unsigned llvm::DILocation::getCopyIdentifierFromDiscriminator ( unsigned  D)
inlinestatic

Returns the copy identifier for a given encoded discriminator D.

Definition at line 2774 of file DebugInfoMetadata.h.

References D, getNextComponentInDiscriminator(), and getUnsignedFromPrefixEncoding().

Referenced by getCopyIdentifier().

◆ getDuplicationFactor()

unsigned llvm::DILocation::getDuplicationFactor ( ) const
inline

Returns the duplication factor stored in the discriminator, or 1 if no duplication factor (or 0) is encoded.

Definition at line 2947 of file DebugInfoMetadata.h.

References getDuplicationFactorFromDiscriminator().

Referenced by cloneByMultiplyingDuplicationFactor().

◆ getDuplicationFactorFromDiscriminator()

static unsigned llvm::DILocation::getDuplicationFactorFromDiscriminator ( unsigned  D)
inlinestatic

Returns the duplication factor for a given encoded discriminator D, or 1 if no value or 0 is encoded.

Definition at line 2763 of file DebugInfoMetadata.h.

References D, llvm::EnableFSDiscriminator, getNextComponentInDiscriminator(), and getUnsignedFromPrefixEncoding().

Referenced by getDuplicationFactor().

◆ getMaskedDiscriminator()

static unsigned llvm::DILocation::getMaskedDiscriminator ( unsigned  D,
unsigned  B 
)
inlinestatic

Return the masked discriminator value for an input discrimnator value D (i.e.

zero out the (B+1)-th and above bits for D (B is 0-base).

Definition at line 2710 of file DebugInfoMetadata.h.

References B, D, and llvm::getN1Bits().

Referenced by getBaseDiscriminatorFromDiscriminator().

◆ getMergedLocation()

DILocation * DILocation::getMergedLocation ( DILocation LocA,
DILocation LocB 
)
static

◆ getMergedLocations()

DILocation * DILocation::getMergedLocations ( ArrayRef< DILocation * >  Locs)
static

Try to combine the vector of locations passed as input in a single one.

This function applies getMergedLocation() repeatedly left-to-right. NB: When merging the locations of instructions, prefer to use DebugLoc::getMergedLocations(), as an instruction's DebugLoc may contain additional metadata that will not be preserved when merging the unwrapped DILocations.

Locs: The locations to be merged.

Definition at line 113 of file DebugInfoMetadata.cpp.

References llvm::drop_begin(), llvm::ArrayRef< T >::empty(), getMergedLocation(), and llvm::ArrayRef< T >::size().

◆ getRawInlinedAt()

Metadata * llvm::DILocation::getRawInlinedAt ( ) const
inline

◆ getRawScope()

Metadata * llvm::DILocation::getRawScope ( ) const
inline

Definition at line 2779 of file DebugInfoMetadata.h.

References llvm::MDNode::getOperand().

◆ getWithoutAtom()

const DILocation * llvm::DILocation::getWithoutAtom ( ) const
inline

◆ isPseudoProbeDiscriminator()

static bool llvm::DILocation::isPseudoProbeDiscriminator ( unsigned  Discriminator)
inlinestatic

◆ replaceOperandWith()

void llvm::DILocation::replaceOperandWith ( unsigned  I,
Metadata New 
)
delete

Friends And Related Function Documentation

◆ LLVMContextImpl

friend class LLVMContextImpl
friend

Definition at line 2507 of file DebugInfoMetadata.h.

◆ MDNode

friend class MDNode
friend

Definition at line 2508 of file DebugInfoMetadata.h.

Member Data Documentation

◆ AtomGroup

unsigned unsigned DILocalScope DILocation bool uint64_t llvm::DILocation::AtomGroup = 0

Definition at line 2562 of file DebugInfoMetadata.h.

◆ AtomRank

Definition at line 2562 of file DebugInfoMetadata.h.

◆ Column

unsigned unsigned llvm::DILocation::Column

Definition at line 2560 of file DebugInfoMetadata.h.

◆ ImplicitCode

unsigned unsigned DILocalScope DILocation bool llvm::DILocation::ImplicitCode = false

Definition at line 2561 of file DebugInfoMetadata.h.

◆ InlinedAt

unsigned unsigned DILocalScope DILocation* llvm::DILocation::InlinedAt = nullptr

Definition at line 2561 of file DebugInfoMetadata.h.

Referenced by getMergedLocation().

◆ Line

unsigned llvm::DILocation::Line

Definition at line 2560 of file DebugInfoMetadata.h.

Referenced by getMergedLocation().

◆ Scope

unsigned unsigned DILocalScope* llvm::DILocation::Scope

Definition at line 2560 of file DebugInfoMetadata.h.

Referenced by cloneWithDiscriminator(), and getMergedLocation().


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