LLVM 20.0.0git
|
Debug location. More...
#include "llvm/IR/DebugInfoMetadata.h"
Public Member Functions | |
void | replaceOperandWith (unsigned I, Metadata *New)=delete |
DEFINE_MDNODE_GET (DILocation,(unsigned Line, unsigned Column, Metadata *Scope, Metadata *InlinedAt=nullptr, bool ImplicitCode=false),(Line, Column, Scope, InlinedAt, ImplicitCode)) DEFINE_MDNODE_GET(DILocation | |
const DILocation * | cloneWithDiscriminator (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. | |
Metadata * | getRawScope () const |
Metadata * | getRawInlinedAt () const |
Public Member Functions inherited from llvm::MDNode | |
MDNode (const MDNode &)=delete | |
void | operator= (const MDNode &)=delete |
void * | operator new (size_t)=delete |
TempMDNode | clone () const |
Create a (temporary) clone of this. | |
LLVMContext & | getContext () const |
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 |
unsigned | getNumTemporaryUses () const |
void | replaceAllUsesWith (Metadata *MD) |
RAUW a temporary. | |
void | resolveCycles () |
Resolve cycles. | |
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. | |
bool | isTBAAVtableAccess () const |
Check whether MDNode is a vtable access. | |
void | printTree (raw_ostream &OS, const Module *M=nullptr) const |
Print in tree shape. | |
void | printTree (raw_ostream &OS, ModuleSlotTracker &MST, const Module *M=nullptr) const |
void | dumpTree () const |
User-friendly dump in tree shape. | |
void | dumpTree (const Module *M) const |
Public Member Functions inherited from llvm::Metadata | |
unsigned | getMetadataID () const |
void | dump () const |
User-friendly dump. | |
void | dump (const Module *M) const |
void | print (raw_ostream &OS, const Module *M=nullptr, bool IsForDebug=false) const |
Print. | |
void | print (raw_ostream &OS, ModuleSlotTracker &MST, const Module *M=nullptr, bool IsForDebug=false) const |
void | printAsOperand (raw_ostream &OS, const Module *M=nullptr) const |
Print as operand. | |
void | printAsOperand (raw_ostream &OS, ModuleSlotTracker &MST, const Module *M=nullptr) const |
Static Public Member Functions | |
static bool | isPseudoProbeDiscriminator (unsigned Discriminator) |
static DILocation * | getMergedLocation (DILocation *LocA, DILocation *LocB) |
When two instructions are combined into a single instruction we also need to combine the original locations into a single location. | |
static DILocation * | getMergedLocations (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 std::optional< unsigned > | encodeDiscriminator (unsigned BD, unsigned DF, unsigned CI) |
Raw encoding of the discriminator. | |
static 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 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 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 MDNode * | concatenate (MDNode *A, MDNode *B) |
Methods for metadata merging. | |
static MDNode * | intersect (MDNode *A, MDNode *B) |
static MDNode * | getMostGenericTBAA (MDNode *A, MDNode *B) |
static MDNode * | getMostGenericFPMath (MDNode *A, MDNode *B) |
static MDNode * | getMostGenericRange (MDNode *A, MDNode *B) |
static MDNode * | getMostGenericAliasScope (MDNode *A, MDNode *B) |
static MDNode * | getMostGenericAlignmentOrDereferenceable (MDNode *A, MDNode *B) |
static MDNode * | getMergedProfMetadata (MDNode *A, MDNode *B, const Instruction *AInstr, const Instruction *BInstr) |
Merge !prof metadata from two instructions. | |
Public Attributes | |
unsigned | Line |
unsigned unsigned | Column |
unsigned unsigned DILocalScope * | Scope |
unsigned unsigned DILocalScope DILocation * | InlinedAt = nullptr |
unsigned unsigned DILocalScope DILocation bool | ImplicitCode |
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 > |
Public Types inherited from llvm::Metadata | |
enum | MetadataKind |
Protected Types inherited from llvm::MDNode | |
using | mutable_op_range = iterator_range< MDOperand * > |
Protected Types inherited from llvm::Metadata | |
enum | StorageType { Uniqued , Distinct , Temporary } |
Active type of storage. More... | |
Protected Member Functions inherited from llvm::MDNode | |
MDNode (LLVMContext &Context, unsigned ID, StorageType Storage, ArrayRef< Metadata * > Ops1, ArrayRef< Metadata * > Ops2=std::nullopt) | |
~MDNode ()=default | |
void * | operator new (size_t Size, size_t NumOps, StorageType Storage) |
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. | |
void | dropAllReferences () |
MDOperand * | mutable_begin () |
MDOperand * | mutable_end () |
mutable_op_range | mutable_operands () |
void | setOperand (unsigned I, Metadata *New) |
Set an operand. | |
unsigned | getNumUnresolved () const |
void | setNumUnresolved (unsigned N) |
void | storeDistinctInContext () |
void | resize (size_t NumOps) |
Resize the node to hold NumOps operands. | |
Protected Member Functions inherited from llvm::Metadata | |
Metadata (unsigned ID, StorageType Storage) | |
~Metadata ()=default | |
void | handleChangedOperand (void *, Metadata *) |
Default handling of a changed operand, which asserts. | |
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) |
Protected Attributes inherited from llvm::Metadata | |
unsigned char | Storage: 7 |
Storage flag for non-uniqued, otherwise unowned, metadata. | |
unsigned char | SubclassData1: 1 |
unsigned short | SubclassData16 = 0 |
unsigned | SubclassData32 = 0 |
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 1951 of file DebugInfoMetadata.h.
Definition at line 2216 of file DebugInfoMetadata.h.
References llvm::Metadata::getMetadataID().
|
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 2402 of file DebugInfoMetadata.h.
References assert(), cloneWithDiscriminator(), D, DF, llvm::EnableFSDiscriminator, encodeDiscriminator(), getBaseDiscriminator(), getCopyIdentifier(), getDuplicationFactor(), and isPseudoProbeDiscriminator().
Referenced by llvm::VPTransformState::setDebugLocFrom().
|
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 2383 of file DebugInfoMetadata.h.
References cloneWithDiscriminator(), D, decodeDiscriminator(), DF, llvm::EnableFSDiscriminator, encodeDiscriminator(), and getBaseDiscriminator().
Referenced by addDiscriminators().
|
inline |
Returns a new DILocation with updated Discriminator
.
Definition at line 2353 of file DebugInfoMetadata.h.
References llvm::MDNode::get(), llvm::MDNode::getContext(), getScope(), and Scope.
Referenced by cloneByMultiplyingDuplicationFactor(), cloneWithBaseDiscriminator(), and llvm::setProbeDistributionFactor().
|
static |
Raw decoder for values in an encoded discriminator D.
Definition at line 281 of file DebugInfoMetadata.cpp.
References D, DF, getNextComponentInDiscriminator(), and getUnsignedFromPrefixEncoding().
Referenced by cloneWithBaseDiscriminator(), and encodeDiscriminator().
llvm::DILocation::DEFINE_MDNODE_GET | ( | DILocation | , |
(unsigned Line, unsigned Column, Metadata *Scope, Metadata *InlinedAt=nullptr, bool ImplicitCode=false) | , | ||
(Line, Column, Scope, InlinedAt, ImplicitCode) | |||
) |
|
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 248 of file DebugInfoMetadata.cpp.
References llvm::CallingConv::C, decodeDiscriminator(), DF, encodeComponent(), encodingBits(), and I.
Referenced by cloneByMultiplyingDuplicationFactor(), and cloneWithBaseDiscriminator().
|
inline |
Returns the base discriminator stored in the discriminator.
Definition at line 2369 of file DebugInfoMetadata.h.
References llvm::EnableFSDiscriminator, and getBaseDiscriminatorFromDiscriminator().
Referenced by cloneByMultiplyingDuplicationFactor(), cloneWithBaseDiscriminator(), llvm::sampleprof::FunctionSamples::getCallSiteIdentifier(), and llvm::SampleProfileLoaderBaseImpl< FT >::getInstWeightImpl().
|
inlinestatic |
Return the bits used for base discriminators.
Definition at line 2145 of file DebugInfoMetadata.h.
References llvm::getBaseFSBitEnd().
Referenced by getBaseDiscriminatorFromDiscriminator().
|
inlinestatic |
Returns the base discriminator for a given encoded discriminator D
.
Definition at line 2149 of file DebugInfoMetadata.h.
References D, llvm::PseudoProbeDwarfDiscriminator::extractDwarfBaseDiscriminator(), llvm::PseudoProbeDwarfDiscriminator::extractProbeIndex(), getBaseDiscriminatorBits(), getMaskedDiscriminator(), getUnsignedFromPrefixEncoding(), and isPseudoProbeDiscriminator().
Referenced by getBaseDiscriminator().
|
inline |
Returns the copy identifier stored in the discriminator.
Definition at line 2378 of file DebugInfoMetadata.h.
References getCopyIdentifierFromDiscriminator().
Referenced by cloneByMultiplyingDuplicationFactor().
Returns the copy identifier for a given encoded discriminator D
.
Definition at line 2204 of file DebugInfoMetadata.h.
References D, getNextComponentInDiscriminator(), and getUnsignedFromPrefixEncoding().
Referenced by getCopyIdentifier().
|
inline |
Returns the duplication factor stored in the discriminator, or 1 if no duplication factor (or 0) is encoded.
Definition at line 2374 of file DebugInfoMetadata.h.
References getDuplicationFactorFromDiscriminator().
Referenced by cloneByMultiplyingDuplicationFactor().
Returns the duplication factor for a given encoded discriminator D
, or 1 if no value or 0 is encoded.
Definition at line 2193 of file DebugInfoMetadata.h.
References D, llvm::EnableFSDiscriminator, getNextComponentInDiscriminator(), and getUnsignedFromPrefixEncoding().
Referenced by getDuplicationFactor().
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 2140 of file DebugInfoMetadata.h.
References B, D, and llvm::getN1Bits().
Referenced by getBaseDiscriminatorFromDiscriminator().
|
static |
When two instructions are combined into a single instruction we also need to combine the original locations into a single location.
When the locations are the same we can use either location. When they differ, we need a third location which is distinct from either. If they share a common scope, use this scope and compare the line/column pair of the locations with the common scope:
LocA
LocB:
The locations to be merged.
Definition at line 121 of file DebugInfoMetadata.cpp.
References assert(), llvm::CallingConv::C, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::MDNode::get(), llvm::MDNode::getContext(), getSubprogram(), I, InlinedAt, IT, Line, S1, Scope, and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::try_emplace().
Referenced by llvm::Instruction::applyMergedLocation(), combineFPFusedMultiply(), llvm::MachineBasicBlock::findBranchDebugLoc(), getMergedLocations(), mergeDILocations(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), performBlockTailMerging(), performSink(), and llvm::LegalizationArtifactCombiner::tryCombineAnyExt().
|
static |
Try to combine the vector of locations passed as input in a single one.
This function applies getMergedLocation() repeatedly left-to-right.
Locs:
The locations to be merged.
Definition at line 107 of file DebugInfoMetadata.cpp.
References llvm::drop_begin(), llvm::ArrayRef< T >::empty(), getMergedLocation(), and llvm::ArrayRef< T >::size().
Referenced by llvm::promoteLoopAccessesToScalars().
|
inline |
Definition at line 2210 of file DebugInfoMetadata.h.
References llvm::MDNode::getNumOperands(), and llvm::MDNode::getOperand().
|
inline |
Definition at line 2209 of file DebugInfoMetadata.h.
References llvm::MDNode::getOperand().
Definition at line 2084 of file DebugInfoMetadata.h.
Referenced by cloneByMultiplyingDuplicationFactor(), llvm::extractProbeFromDiscriminator(), getBaseDiscriminatorFromDiscriminator(), and llvm::setProbeDistributionFactor().
|
friend |
Definition at line 1952 of file DebugInfoMetadata.h.
|
friend |
Definition at line 1953 of file DebugInfoMetadata.h.
Definition at line 1988 of file DebugInfoMetadata.h.
unsigned unsigned DILocalScope DILocation bool llvm::DILocation::ImplicitCode |
Definition at line 1990 of file DebugInfoMetadata.h.
unsigned unsigned DILocalScope DILocation* llvm::DILocation::InlinedAt = nullptr |
Definition at line 1989 of file DebugInfoMetadata.h.
Referenced by getMergedLocation().
unsigned llvm::DILocation::Line |
Definition at line 1988 of file DebugInfoMetadata.h.
Referenced by getMergedLocation().
unsigned unsigned DILocalScope* llvm::DILocation::Scope |
Definition at line 1988 of file DebugInfoMetadata.h.
Referenced by cloneWithDiscriminator(), and getMergedLocation().