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:1355

Inherits from: MDNode

Member Variables

Inherited from Metadata:

protected Storage
protected ImplicitCode
protected SubclassData16 = 0
protected SubclassData32 = 0

Method Overview

Inherited from MDNode:

Inherited from Metadata:

Methods

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

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

Parameters

const llvm::Metadata* MD

llvm::TempDILocation clone() const

Description

Return a (temporary) clone of this.

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

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:1524

Parameters

unsigned int DF

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:1508

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:1502

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:1560

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:1557

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:1518

static unsigned int
getBaseDiscriminatorFromDiscriminator(
    unsigned int D)

Description

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

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

Parameters

unsigned int D

unsigned int getColumn() const

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

inline unsigned int getCopyIdentifier() const

Description

Returns the copy identifier stored in the discriminator.

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

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:1574

Parameters

unsigned int D

llvm::StringRef getDirectory() const

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

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:1499

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:1512

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:1565

Parameters

unsigned int D

llvm::DIFile* getFile() const

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

llvm::StringRef getFilename() const

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

llvm::DILocation* getInlinedAt() const

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

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:1459

unsigned int getLine() const

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

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:1540

Parameters

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

llvm::Metadata* getRawInlinedAt() const

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

llvm::Metadata* getRawScope() const

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

llvm::DILocalScope* getScope() const

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

Optional<llvm::StringRef> getSource() const

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

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:1447

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

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

Parameters

unsigned int I
llvm::Metadata* New

void setImplicitCode(bool ImplicitCode)

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

Parameters

bool ImplicitCode