LLVM 22.0.0git
|
Debug location. More...
#include "llvm/IR/DebugInfoMetadata.h"
Static Public Member Functions | |
static bool | isPseudoProbeDiscriminator (unsigned Discriminator) |
static LLVM_ABI DILocation * | getMergedLocation (DILocation *LocA, DILocation *LocB) |
Attempts to merge LocA and LocB into a single location; see DebugLoc::getMergedLocation for more details. | |
static LLVM_ABI 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 LLVM_ABI std::optional< unsigned > | encodeDiscriminator (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 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 * | 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) |
Public Attributes | |
unsigned | Line |
unsigned unsigned | Column |
unsigned unsigned DILocalScope * | Scope |
unsigned unsigned DILocalScope DILocation * | InlinedAt = 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 | |
![]() | |
using | op_iterator = const MDOperand * |
using | op_range = iterator_range< op_iterator > |
![]() | |
enum | MetadataKind |
![]() | |
static constexpr const unsigned | PoisonGeneratingIDs [] |
Metadata IDs that may generate poison. | |
![]() | |
using | mutable_op_range = iterator_range< MDOperand * > |
![]() | |
enum | StorageType { Uniqued , Distinct , Temporary } |
Active type of storage. More... | |
![]() | |
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. | |
![]() | |
Metadata (unsigned ID, StorageType Storage) | |
~Metadata ()=default | |
void | handleChangedOperand (void *, Metadata *) |
Default handling of a changed operand, which asserts. | |
![]() | |
template<class T , class StoreT > | |
static T * | storeImpl (T *N, StorageType Storage, StoreT &Store) |
template<class T > | |
static T * | storeImpl (T *N, StorageType Storage) |
![]() | |
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 2506 of file DebugInfoMetadata.h.
Definition at line 2786 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 2975 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 2956 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 2925 of file DebugInfoMetadata.h.
References llvm::MDNode::get(), getAtomGroup(), getAtomRank(), llvm::MDNode::getContext(), and Scope.
Referenced by cloneByMultiplyingDuplicationFactor(), cloneWithBaseDiscriminator(), and llvm::setProbeDistributionFactor().
|
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().
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) | |||
) |
|
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().
|
inline |
Definition at line 2540 of file DebugInfoMetadata.h.
Referenced by cloneWithDiscriminator(), getWithoutAtom(), and inlineDebugLoc().
|
inline |
Definition at line 2541 of file DebugInfoMetadata.h.
Referenced by cloneWithDiscriminator(), getWithoutAtom(), and inlineDebugLoc().
|
inline |
Returns the base discriminator stored in the discriminator.
Definition at line 2942 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 2715 of file DebugInfoMetadata.h.
References llvm::getBaseFSBitEnd().
Referenced by getBaseDiscriminatorFromDiscriminator().
|
inlinestatic |
Returns the base discriminator for a given encoded discriminator D
.
Definition at line 2719 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 2951 of file DebugInfoMetadata.h.
References getCopyIdentifierFromDiscriminator().
Referenced by cloneByMultiplyingDuplicationFactor().
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().
|
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().
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().
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().
|
static |
Attempts to merge LocA
and LocB
into a single location; see DebugLoc::getMergedLocation for more details.
NB: When merging the locations of instructions, prefer to use DebugLoc::getMergedLocation(), as an instruction's DebugLoc may contain additional metadata that will not be preserved when merging the unwrapped DILocations.
Definition at line 219 of file DebugInfoMetadata.cpp.
References A, assert(), B, llvm::CallingConv::C, cloneAndReplaceParentScope(), 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, llvm::PickMergedSourceLocations(), Scope, and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::try_emplace().
Referenced by combineFPFusedMultiply(), llvm::DebugLoc::getMergedLocation(), and getMergedLocations().
|
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().
|
inline |
Definition at line 2780 of file DebugInfoMetadata.h.
References llvm::MDNode::getNumOperands(), and llvm::MDNode::getOperand().
|
inline |
Definition at line 2779 of file DebugInfoMetadata.h.
References llvm::MDNode::getOperand().
|
inline |
Definition at line 2543 of file DebugInfoMetadata.h.
References llvm::MDNode::get(), getAtomGroup(), getAtomRank(), and llvm::MDNode::getContext().
Referenced by fixupLineNumbers().
Definition at line 2657 of file DebugInfoMetadata.h.
Referenced by cloneByMultiplyingDuplicationFactor(), llvm::extractProbeFromDiscriminator(), getBaseDiscriminatorFromDiscriminator(), and llvm::setProbeDistributionFactor().
|
friend |
Definition at line 2507 of file DebugInfoMetadata.h.
|
friend |
Definition at line 2508 of file DebugInfoMetadata.h.
unsigned unsigned DILocalScope DILocation bool uint64_t llvm::DILocation::AtomGroup = 0 |
Definition at line 2562 of file DebugInfoMetadata.h.
unsigned unsigned DILocalScope DILocation bool uint64_t uint8_t llvm::DILocation::AtomRank |
Definition at line 2562 of file DebugInfoMetadata.h.
Definition at line 2560 of file DebugInfoMetadata.h.
unsigned unsigned DILocalScope DILocation bool llvm::DILocation::ImplicitCode = false |
Definition at line 2561 of file DebugInfoMetadata.h.
unsigned unsigned DILocalScope DILocation* llvm::DILocation::InlinedAt = nullptr |
Definition at line 2561 of file DebugInfoMetadata.h.
Referenced by getMergedLocation().
unsigned llvm::DILocation::Line |
Definition at line 2560 of file DebugInfoMetadata.h.
Referenced by getMergedLocation().
unsigned unsigned DILocalScope* llvm::DILocation::Scope |
Definition at line 2560 of file DebugInfoMetadata.h.
Referenced by cloneWithDiscriminator(), and getMergedLocation().