LLVM
15.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 . More... | |
Optional< const DILocation * > | cloneWithBaseDiscriminator (unsigned BD) const |
Returns a new DILocation with updated base discriminator BD . More... | |
unsigned | getDuplicationFactor () const |
Returns the duplication factor stored in the discriminator, or 1 if no duplication factor (or 0) is encoded. More... | |
unsigned | getCopyIdentifier () const |
Returns the copy identifier stored in the discriminator. More... | |
unsigned | getBaseDiscriminator () const |
Returns the base discriminator stored in the discriminator. More... | |
Optional< const DILocation * > | cloneByMultiplyingDuplicationFactor (unsigned DF) const |
Returns a new DILocation with duplication factor DF * current duplication factor encoded in the discriminator. More... | |
Metadata * | getRawScope () const |
Metadata * | getRawInlinedAt () const |
![]() | |
MDNode (const MDNode &)=delete | |
void | operator= (const MDNode &)=delete |
void * | operator new (size_t)=delete |
TempMDNode | clone () const |
Create a (temporary) clone of this. More... | |
LLVMContext & | getContext () const |
void | replaceOperandWith (unsigned I, Metadata *New) |
Replace a specific operand. More... | |
bool | isResolved () const |
Check if node is fully resolved. More... | |
bool | isUniqued () const |
bool | isDistinct () const |
bool | isTemporary () const |
void | replaceAllUsesWith (Metadata *MD) |
RAUW a temporary. More... | |
void | resolveCycles () |
Resolve cycles. More... | |
void | resolve () |
Resolve a unique, unresolved node. More... | |
op_iterator | op_begin () const |
op_iterator | op_end () const |
op_range | operands () const |
const MDOperand & | getOperand (unsigned I) const |
unsigned | getNumOperands () const |
Return number of MDNode operands. More... | |
bool | isTBAAVtableAccess () const |
Check whether MDNode is a vtable access. More... | |
void | printTree (raw_ostream &OS, const Module *M=nullptr) const |
Print in tree shape. More... | |
void | printTree (raw_ostream &OS, ModuleSlotTracker &MST, const Module *M=nullptr) const |
void | dumpTree () const |
User-friendly dump in tree shape. More... | |
void | dumpTree (const Module *M) const |
![]() | |
unsigned | getMetadataID () const |
void | dump () const |
User-friendly dump. More... | |
void | dump (const Module *M) const |
void | print (raw_ostream &OS, const Module *M=nullptr, bool IsForDebug=false) const |
Print. More... | |
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. More... | |
void | printAsOperand (raw_ostream &OS, ModuleSlotTracker &MST, const Module *M=nullptr) const |
Static Public Member Functions | |
static bool | isPseudoProbeDiscriminator (unsigned Discriminator) |
static const DILocation * | getMergedLocation (const DILocation *LocA, const DILocation *LocB) |
When two instructions are combined into a single instruction we also need to combine the original locations into a single location. More... | |
static const DILocation * | getMergedLocations (ArrayRef< const DILocation * > Locs) |
Try to combine the vector of locations passed as input in a single one. More... | |
static unsigned | getMaskedDiscriminator (unsigned D, unsigned B) |
Return the masked discriminator value for an input discrimnator value D (i.e. More... | |
static unsigned | getBaseDiscriminatorBits () |
Return the bits used for base discriminators. More... | |
static unsigned | getBaseDiscriminatorFromDiscriminator (unsigned D, bool IsFSDiscriminator=false) |
Returns the base discriminator for a given encoded discriminator D . More... | |
static Optional< unsigned > | encodeDiscriminator (unsigned BD, unsigned DF, unsigned CI) |
Raw encoding of the discriminator. More... | |
static void | decodeDiscriminator (unsigned D, unsigned &BD, unsigned &DF, unsigned &CI) |
Raw decoder for values in an encoded discriminator D. More... | |
static unsigned | getDuplicationFactorFromDiscriminator (unsigned D) |
Returns the duplication factor for a given encoded discriminator D , or 1 if no value or 0 is encoded. More... | |
static unsigned | getCopyIdentifierFromDiscriminator (unsigned D) |
Returns the copy identifier for a given encoded discriminator D . More... | |
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 void | deleteTemporary (MDNode *N) |
Deallocate a node created by getTemporary. More... | |
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. More... | |
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. More... | |
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. More... | |
static bool | classof (const Metadata *MD) |
Methods for support type inquiry through isa, cast, and dyn_cast: More... | |
static MDNode * | concatenate (MDNode *A, MDNode *B) |
Methods for metadata merging. More... | |
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) |
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 | |
![]() | |
using | op_iterator = const MDOperand * |
using | op_range = iterator_range< op_iterator > |
![]() | |
enum | MetadataKind |
![]() | |
using | mutable_op_range = iterator_range< MDOperand * > |
![]() | |
enum | StorageType { Uniqued, Distinct, Temporary } |
Active type of storage. More... | |
![]() | |
MDNode (LLVMContext &Context, unsigned ID, StorageType Storage, ArrayRef< Metadata * > Ops1, ArrayRef< Metadata * > Ops2=None) | |
~MDNode ()=default | |
void * | operator new (size_t Size, unsigned NumOps, StorageType Storage) |
void | operator delete (void *Mem) |
void | operator delete (void *, unsigned) |
Required by std, but never called. More... | |
void | operator delete (void *, unsigned, bool) |
Required by std, but never called. More... | |
void | dropAllReferences () |
MDOperand * | mutable_begin () |
MDOperand * | mutable_end () |
mutable_op_range | mutable_operands () |
void | setOperand (unsigned I, Metadata *New) |
Set an operand. More... | |
unsigned | getNumUnresolved () const |
void | setNumUnresolved (unsigned N) |
void | storeDistinctInContext () |
![]() | |
Metadata (unsigned ID, StorageType Storage) | |
~Metadata ()=default | |
void | handleChangedOperand (void *, Metadata *) |
Default handling of a changed operand, which asserts. More... | |
![]() | |
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. More... | |
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.
Definition at line 1551 of file DebugInfoMetadata.h.
Definition at line 1791 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 None if encoding failed.
Definition at line 2234 of file DebugInfoMetadata.h.
References assert(), cloneWithDiscriminator(), D, DF, llvm::EnableFSDiscriminator, encodeDiscriminator(), getBaseDiscriminator(), getCopyIdentifier(), getDuplicationFactor(), and llvm::None.
Referenced by llvm::InnerLoopVectorizer::setDebugLocFromInst().
|
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 None.
Definition at line 2215 of file DebugInfoMetadata.h.
References cloneWithDiscriminator(), D, decodeDiscriminator(), DF, llvm::EnableFSDiscriminator, encodeDiscriminator(), getBaseDiscriminator(), and llvm::None.
Referenced by addDiscriminators().
|
inline |
Returns a new DILocation with updated Discriminator
.
Definition at line 2185 of file DebugInfoMetadata.h.
References llvm::MDNode::get(), llvm::MDNode::getContext(), getScope(), llvm::DIScope::getScope(), and Scope.
Referenced by cloneByMultiplyingDuplicationFactor(), cloneWithBaseDiscriminator(), and llvm::setProbeDistributionFactor().
|
static |
Raw decoder for values in an encoded discriminator D.
Definition at line 177 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 None 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 143 of file DebugInfoMetadata.cpp.
References decodeDiscriminator(), DF, encodeComponent(), encodingBits(), I, llvm::None, and llvm::MipsISD::Ret.
Referenced by cloneByMultiplyingDuplicationFactor(), and cloneWithBaseDiscriminator().
|
inline |
Returns the base discriminator stored in the discriminator.
Definition at line 2201 of file DebugInfoMetadata.h.
References llvm::EnableFSDiscriminator, and getBaseDiscriminatorFromDiscriminator().
Referenced by cloneByMultiplyingDuplicationFactor(), cloneWithBaseDiscriminator(), llvm::sampleprof::FunctionSamples::getCallSiteIdentifier(), and llvm::SampleProfileLoaderBaseImpl< MachineBasicBlock >::getInstWeightImpl().
|
inlinestatic |
Return the bits used for base discriminators.
Definition at line 1735 of file DebugInfoMetadata.h.
References llvm::getBaseFSBitEnd().
Referenced by getBaseDiscriminatorFromDiscriminator().
|
inlinestatic |
Returns the base discriminator for a given encoded discriminator D
.
Definition at line 1739 of file DebugInfoMetadata.h.
References D, getBaseDiscriminatorBits(), getMaskedDiscriminator(), and getUnsignedFromPrefixEncoding().
Referenced by getBaseDiscriminator().
|
inline |
Returns the copy identifier stored in the discriminator.
Definition at line 2210 of file DebugInfoMetadata.h.
References getCopyIdentifierFromDiscriminator().
Referenced by cloneByMultiplyingDuplicationFactor().
|
inlinestatic |
Returns the copy identifier for a given encoded discriminator D
.
Definition at line 1779 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 2206 of file DebugInfoMetadata.h.
References getDuplicationFactorFromDiscriminator().
Referenced by cloneByMultiplyingDuplicationFactor().
|
inlinestatic |
Returns the duplication factor for a given encoded discriminator D
, or 1 if no value or 0 is encoded.
Definition at line 1768 of file DebugInfoMetadata.h.
References D, llvm::EnableFSDiscriminator, getNextComponentInDiscriminator(), getUnsignedFromPrefixEncoding(), and llvm::MipsISD::Ret.
Referenced by getDuplicationFactor().
|
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 1730 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 have the same file/line but have a different discriminator we could create a location with a new discriminator. If they are from different files/lines the location is ambiguous and can't be represented in a line entry. In this case, if GenerateLocation
is true, we will set the merged debug location as line 0 of the nearest common scope where the two locations are inlined from.
GenerateLocation:
Whether the merged location can be generated when LocA
and LocB
differ.
Definition at line 101 of file DebugInfoMetadata.cpp.
References llvm::MDNode::get(), llvm::SmallPtrSetImpl< PtrType >::insert(), and S.
Referenced by llvm::Instruction::applyMergedLocation(), llvm::MachineBasicBlock::findBranchDebugLoc(), getMergedLocations(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), performBlockTailMerging(), and performSink().
|
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 87 of file DebugInfoMetadata.cpp.
References llvm::drop_begin(), llvm::ArrayRef< T >::empty(), getMergedLocation(), and llvm::ArrayRef< T >::size().
|
inline |
Definition at line 1785 of file DebugInfoMetadata.h.
References llvm::MDNode::getNumOperands(), and llvm::MDNode::getOperand().
|
inline |
Definition at line 1784 of file DebugInfoMetadata.h.
References llvm::MDNode::getOperand().
|
inlinestatic |
Definition at line 1672 of file DebugInfoMetadata.h.
Referenced by llvm::extractProbeFromDiscriminator(), and llvm::setProbeDistributionFactor().
|
delete |
|
friend |
Definition at line 1552 of file DebugInfoMetadata.h.
|
friend |
Definition at line 1553 of file DebugInfoMetadata.h.
unsigned unsigned llvm::DILocation::Column |
Definition at line 1588 of file DebugInfoMetadata.h.
unsigned unsigned DILocalScope DILocation bool llvm::DILocation::ImplicitCode |
Definition at line 1590 of file DebugInfoMetadata.h.
unsigned unsigned DILocalScope DILocation* llvm::DILocation::InlinedAt = nullptr |
Definition at line 1589 of file DebugInfoMetadata.h.
unsigned llvm::DILocation::Line |
Definition at line 1588 of file DebugInfoMetadata.h.
unsigned unsigned DILocalScope* llvm::DILocation::Scope |
Definition at line 1588 of file DebugInfoMetadata.h.
Referenced by cloneWithDiscriminator().