LLVM  8.0.1
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:
Inheritance graph
[legend]
Collaboration diagram for llvm::DILocation:
Collaboration graph
[legend]

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 DILocationcloneWithDiscriminator (unsigned Discriminator) const
 Returns a new DILocation with updated Discriminator. More...
 
Optional< const DILocation * > setBaseDiscriminator (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 * > cloneWithDuplicationFactor (unsigned DF) const
 Returns a new DILocation with duplication factor DF * current duplication factor encoded in the discriminator. More...
 
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
 
TempMDNode clone () const
 Create a (temporary) clone of this. More...
 
LLVMContextgetContext () 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 MDOperandgetOperand (unsigned I) const
 
unsigned getNumOperands () const
 Return number of MDNode operands. More...
 
bool isTBAAVtableAccess () const
 Check whether MDNode is a vtable access. More...
 

Static Public Member Functions

static const DILocationgetMergedLocation (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 unsigned getBaseDiscriminatorFromDiscriminator (unsigned D)
 Returns the base discriminator for a given encoded discriminator D. More...
 
static Optional< unsignedencodeDiscriminator (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 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 void deleteTemporary (MDNode *N)
 Deallocate a node created by getTemporary. More...
 
template<class T >
static std::enable_if< std::is_base_of< MDNode, T >::value, T * >::type replaceWithPermanent (std::unique_ptr< T, TempMDNodeDeleter > N)
 Replace a temporary node with a permanent one. More...
 
template<class T >
static std::enable_if< std::is_base_of< MDNode, T >::value, T * >::type replaceWithUniqued (std::unique_ptr< T, TempMDNodeDeleter > N)
 Replace a temporary node with a uniqued one. More...
 
template<class T >
static std::enable_if< std::is_base_of< MDNode, T >::value, T * >::type 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 MDNodeconcatenate (MDNode *A, MDNode *B)
 Methods for metadata merging. More...
 
static MDNodeintersect (MDNode *A, MDNode *B)
 
static MDNodegetMostGenericTBAA (MDNode *A, MDNode *B)
 
static MDNodegetMostGenericFPMath (MDNode *A, MDNode *B)
 
static MDNodegetMostGenericRange (MDNode *A, MDNode *B)
 
static MDNodegetMostGenericAliasScope (MDNode *A, MDNode *B)
 
static MDNodegetMostGenericAlignmentOrDereferenceable (MDNode *A, MDNode *B)
 

Public Attributes

unsigned Line
 
unsigned unsigned Column
 
unsigned unsigned DILocalScopeScope
 
unsigned unsigned DILocalScope DILocationInlinedAt = 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 >
 
- 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
 MDNode (LLVMContext &Context, unsigned ID, StorageType Storage, ArrayRef< Metadata *> Ops1, ArrayRef< Metadata *> Ops2=None)
 
 ~MDNode ()=default
 
void * operator new (size_t Size, unsigned NumOps)
 
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 ()
 
MDOperandmutable_begin ()
 
MDOperandmutable_end ()
 
mutable_op_range mutable_operands ()
 
void setOperand (unsigned I, Metadata *New)
 Set an operand. More...
 
void storeDistinctInContext ()
 
- 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.

Definition at line 1401 of file DebugInfoMetadata.h.

Member Function Documentation

◆ classof()

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

Definition at line 1635 of file DebugInfoMetadata.h.

References llvm::Metadata::getMetadataID().

◆ cloneWithDiscriminator()

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

Returns a new DILocation with updated Discriminator.

Definition at line 2014 of file DebugInfoMetadata.h.

References llvm::dyn_cast(), llvm::MDNode::get(), and llvm::DIScope::getScope().

◆ cloneWithDuplicationFactor()

Optional< const DILocation * > llvm::DILocation::cloneWithDuplicationFactor ( 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 None if encoding failed.

Definition at line 2050 of file DebugInfoMetadata.h.

References llvm::None.

Referenced by llvm::InnerLoopVectorizer::setDebugLocFromInst().

◆ 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 150 of file DebugInfoMetadata.cpp.

Referenced by encodeDiscriminator().

◆ DEFINE_MDNODE_GET()

llvm::DILocation::DEFINE_MDNODE_GET ( DILocation  ,
(unsigned Line, unsigned Column, Metadata *Scope, Metadata *InlinedAt=nullptr, bool ImplicitCode=false ,
(Line, Column, Scope, InlinedAt, ImplicitCode  
)

◆ encodeDiscriminator()

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

Raw encoding of the discriminator.

APIs such as setBaseDiscriminator or cloneWithDuplicationFactor have certain side-effects. This API, in conjunction with cloneWithDiscriminator, may be used to encode precisely the 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 118 of file DebugInfoMetadata.cpp.

References llvm::SmallVectorTemplateCommon< T, typename >::begin(), C, decodeDiscriminator(), llvm::SmallVectorTemplateCommon< T, typename >::end(), I, llvm::None, and llvm::MipsISD::Ret.

◆ getBaseDiscriminator()

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

Returns the base discriminator stored in the discriminator.

Definition at line 2030 of file DebugInfoMetadata.h.

Referenced by callsiteIsHot(), llvm::sampleprof::FunctionSamples::findFunctionSamples(), and SortCallTargets().

◆ getBaseDiscriminatorFromDiscriminator()

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

Returns the base discriminator for a given encoded discriminator D.

Definition at line 1593 of file DebugInfoMetadata.h.

◆ getCopyIdentifier()

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

Returns the copy identifier stored in the discriminator.

Definition at line 2038 of file DebugInfoMetadata.h.

◆ getCopyIdentifierFromDiscriminator()

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

Returns the copy identifier for a given encoded discriminator D.

Definition at line 1622 of file DebugInfoMetadata.h.

◆ 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 2034 of file DebugInfoMetadata.h.

◆ 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 1613 of file DebugInfoMetadata.h.

References llvm::MipsISD::Ret.

◆ getMergedLocation()

const DILocation * DILocation::getMergedLocation ( const DILocation LocA,
const DILocation LocB 
)
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 76 of file DebugInfoMetadata.cpp.

References llvm::SmallSet< T, N, C >::count(), llvm::MDNode::get(), llvm::MDNode::getContext(), llvm::DIScope::getScope(), llvm::SmallSet< T, N, C >::insert(), llvm::SmallPtrSetImpl< PtrType >::insert(), and llvm::TypedDINodeRef< T >::resolve().

Referenced by llvm::Instruction::applyMergedLocation(), llvm::MachineBasicBlock::findBranchDebugLoc(), mergeOperations(), performSink(), updateOperand(), and llvm::InstCombiner::visitStoreInst().

◆ getRawInlinedAt()

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

Definition at line 1629 of file DebugInfoMetadata.h.

Referenced by isDINode(), and llvm::MDNodeKeyImpl< DILocation >::isKeyOf().

◆ getRawScope()

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

◆ replaceOperandWith()

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

◆ setBaseDiscriminator()

Optional< const DILocation * > llvm::DILocation::setBaseDiscriminator ( 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 None.

Definition at line 2042 of file DebugInfoMetadata.h.

References llvm::None.

Referenced by addDiscriminators().

Friends And Related Function Documentation

◆ LLVMContextImpl

friend class LLVMContextImpl
friend

Definition at line 1402 of file DebugInfoMetadata.h.

◆ MDNode

friend class MDNode
friend

Definition at line 1403 of file DebugInfoMetadata.h.

Member Data Documentation

◆ Column

unsigned unsigned llvm::DILocation::Column

Definition at line 1471 of file DebugInfoMetadata.h.

◆ ImplicitCode

unsigned unsigned DILocalScope DILocation bool llvm::DILocation::ImplicitCode

Definition at line 1473 of file DebugInfoMetadata.h.

◆ InlinedAt

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

Definition at line 1472 of file DebugInfoMetadata.h.

◆ Line

unsigned llvm::DILocation::Line

Definition at line 1471 of file DebugInfoMetadata.h.

◆ Scope

unsigned unsigned DILocalScope* llvm::DILocation::Scope

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