class DILocation

Declaration

class DILocation : public MDNode { /* full declaration omitted */ };

Description

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

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1557

Inherits from: MDNode

Member Variables

Inherited from Metadata:

protected Storage
protected SubclassData1
protected SubclassData16 = 0
protected SubclassData32 = 0

Method Overview

Inherited from MDNode:

Inherited from Metadata:

Methods

DILocation(llvm::LLVMContext& C,
           llvm::Metadata::StorageType Storage,
           unsigned int Line,
           unsigned int Column,
           ArrayRef<llvm::Metadata*> MDs,
           bool ImplicitCode)

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1561

Parameters

llvm::LLVMContext& C
llvm::Metadata::StorageType Storage
unsigned int Line
unsigned int Column
ArrayRef<llvm::Metadata*> MDs
bool ImplicitCode

static bool classof(const llvm::Metadata* MD)

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1797

Parameters

const llvm::Metadata* MD

llvm::TempDILocation clone() const

Description

Return a (temporary) clone of this.

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1600

inline Optional<const llvm::DILocation*>
cloneByMultiplyingDuplicationFactor(
    unsigned int DF) const

Description

Returns a new DILocation with duplication factor \p DF * current duplication factor encoded in the discriminator. The current duplication factor is as defined by getDuplicationFactor(). Returns None if encoding failed.

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1707

Parameters

unsigned int DF

llvm::TempDILocation cloneImpl() const

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1578

inline Optional<const llvm::DILocation*>
cloneWithBaseDiscriminator(unsigned int BD) const

Description

Returns a new DILocation with updated base discriminator \p 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.

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1690

Parameters

unsigned int BD

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

Description

Returns a new DILocation with updated \p Discriminator.

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1683

Parameters

unsigned int Discriminator

static void decodeDiscriminator(unsigned int D,
                                unsigned int& BD,
                                unsigned int& DF,
                                unsigned int& CI)

Description

Raw decoder for values in an encoded discriminator D.

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1769

Parameters

unsigned int D
unsigned int& BD
unsigned int& DF
unsigned int& CI

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

Description

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. \p BD: base discriminator\p DF: duplication factor\p 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.

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1765

Parameters

unsigned int BD
unsigned int DF
unsigned int CI

inline unsigned int getBaseDiscriminator() const

Description

Returns the base discriminator stored in the discriminator.

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1700

static unsigned int getBaseDiscriminatorBits()

Description

Return the bits used for base discriminators.

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1741

static unsigned int
getBaseDiscriminatorFromDiscriminator(
    unsigned int D,
    bool IsFSDiscriminator = false)

Description

Returns the base discriminator for a given encoded discriminator \p D.

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1745

Parameters

unsigned int D
bool IsFSDiscriminator = false

unsigned int getColumn() const

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1603

inline unsigned int getCopyIdentifier() const

Description

Returns the copy identifier stored in the discriminator.

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1697

static unsigned int
getCopyIdentifierFromDiscriminator(unsigned int D)

Description

Returns the copy identifier for a given encoded discriminator \p D.

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1785

Parameters

unsigned int D

llvm::StringRef getDirectory() const

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1621

inline unsigned int getDiscriminator() const

Description

Get the DWARF discriminator. DWARF discriminators distinguish identical file locations between instructions that are on different basic blocks. There are 3 components stored in discriminator, from lower bits: Base discriminator: assigned by AddDiscriminators pass to identify IRs that are defined by the same source line, but different basic blocks. Duplication factor: assigned by optimizations that will scale down the execution frequency of the original IR. Copy Identifier: assigned by optimizations that clones the IR. Each copy of the IR will be assigned an identifier. Encoding: The above 3 components are encoded into a 32bit unsigned integer in order. If the lowest bit is 1, the current component is empty, and the next component will start in the next bit. Otherwise, the current component is non-empty, and its content starts in the next bit. The value of each components is either 5 bit or 12 bit: if the 7th bit is 0, the bit 2~6 (5 bits) are used to represent the component; if the 7th bit is 1, the bit 2~6 (5 bits) and 8~14 (7 bits) are combined to represent the component. Thus, the number of bits used for a component is either 0 (if it and all the next components are empty); 1 - if it is empty; 7 - if its value is up to and including 0x1f (lsb and msb are both 0); or 14, if its value is up to and including 0x1ff. Note that the last component is also capped at 0x1ff, even in the case when both first components are 0, and we'd technically have 29 bits available. For precise control over the data being encoded in the discriminator, use encodeDiscriminator/decodeDiscriminator.

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1668

inline unsigned int getDuplicationFactor() const

Description

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

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1694

static unsigned int
getDuplicationFactorFromDiscriminator(
    unsigned int D)

Description

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

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1774

Parameters

unsigned int D

llvm::DIFile* getFile() const

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1619

llvm::StringRef getFilename() const

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1620

static llvm::DILocation* getImpl(
    llvm::LLVMContext& Context,
    unsigned int Line,
    unsigned int Column,
    llvm::Metadata* Scope,
    llvm::Metadata* InlinedAt,
    bool ImplicitCode,
    llvm::Metadata::StorageType Storage,
    bool ShouldCreate = true)

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1565

Parameters

llvm::LLVMContext& Context
unsigned int Line
unsigned int Column
llvm::Metadata* Scope
llvm::Metadata* InlinedAt
bool ImplicitCode
llvm::Metadata::StorageType Storage
bool ShouldCreate = true

static llvm::DILocation* getImpl(
    llvm::LLVMContext& Context,
    unsigned int Line,
    unsigned int Column,
    llvm::DILocalScope* Scope,
    llvm::DILocation* InlinedAt,
    bool ImplicitCode,
    llvm::Metadata::StorageType Storage,
    bool ShouldCreate = true)

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1569

Parameters

llvm::LLVMContext& Context
unsigned int Line
unsigned int Column
llvm::DILocalScope* Scope
llvm::DILocation* InlinedAt
bool ImplicitCode
llvm::Metadata::StorageType Storage
bool ShouldCreate = true

llvm::DILocation* getInlinedAt() const

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1606

llvm::DILocalScope* getInlinedAtScope() const

Description

Get the scope where this is inlined. Walk through \a getInlinedAt() and return \a getScope() from the deepest location.

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1628

unsigned int getLine() const

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1602

static unsigned int getMaskedDiscriminator(
    unsigned int D,
    unsigned int B)

Description

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).

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1736

Parameters

unsigned int D
unsigned int B

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

Description

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 \p 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. \p GenerateLocation: Whether the merged location can be generated when\p LocA and \p LocB differ.

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1723

Parameters

const llvm::DILocation* LocA
const llvm::DILocation* LocB

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

Description

Try to combine the vector of locations passed as input in a single one. This function applies getMergedLocation() repeatedly left-to-right. \p Locs: The locations to be merged.

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1731

Parameters

ArrayRef<const llvm::DILocation*> Locs

llvm::Metadata* getRawInlinedAt() const

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1791

llvm::Metadata* getRawScope() const

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1790

llvm::DILocalScope* getScope() const

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1604

Optional<llvm::StringRef> getSource() const

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1622

bool isImplicitCode() const

Description

Check if the location corresponds to an implicit code. When the ImplicitCode flag is true, it means that the Instruction with this DILocation has been added by the front-end but it hasn't been written explicitly by the user (e.g. cleanup stuff in C++ put on a closing bracket). It's useful for code coverage to not show a counter on "empty" lines.

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1616

static inline bool isPseudoProbeDiscriminator(
    unsigned int Discriminator)

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1678

Parameters

unsigned int Discriminator

void replaceOperandWith(unsigned int I,
                        llvm::Metadata* New)

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1587

Parameters

unsigned int I
llvm::Metadata* New

void setImplicitCode(bool ImplicitCode)

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1617

Parameters

bool ImplicitCode

~DILocation()

Declared at: llvm/include/llvm/IR/DebugInfoMetadata.h:1563