DWARF expression.

Synopsis

Declared in <llvm/IR/DebugInfoMetadata.h>

class DIExpression
    : public MDNode

Description

This is (almost) a DWARF expression that modifies the location of a variable, or the location of a single piece of a variable, or (when using DW_OP_stack_value) is the constant variable value.

TODO: Co‐allocate the expression elements. TODO: Separate from MDNode, or otherwise drop Distinct and Temporary storage types.

Base Classes

Name

Description

MDNode

Metadata node.

Types

Name

Description

ArgOp

A view of a DW_OP_LLVM_arg operation.

ConstuOp

A view of a DW_OP_constu operation.

ConvertOp

A view of a DW_OP_LLVM_convert operation.

EntryValueOp

A view of a DW_OP_LLVM_entry_value operation.

ExprOperand

A lightweight wrapper around an expression operand.

ExtractBitsOp

A view of the DW_OP_LLVM_extract_bits_[sz]ext operations.

FragmentOp

A view of a DW_OP_LLVM_fragment operation.

PlusUconstOp

A view of a DW_OP_plus_uconst operation.

TagOffsetOp

A view of a DW_OP_LLVM_tag_offset operation.

expr_op_iterator

An iterator for expression operands.

Type Aliases

Name

Description

ExtOps

Opcode sequence used to append a zero or sign extension.

FragmentInfo

Fragment describing a bit‐range within a variable.

element_iterator

Iterator over DIExpression element words.

op_iterator

Iterator over this node's operands.

op_range

Range of this node's operands.

Enums

Name

Description

MetadataKind

RTTI identifiers for concrete metadata subclasses.

PrependOps

Flags controlling DIExpression::prepend.

SignedOrUnsignedConstant

Sign information for a constant DIExpression.

Member Functions

Name

Description

operator= [deleted]

Copy assignment is deleted; MDNode is non‐copyable.

clone

Return a (temporary) clone of this.

constantFold

Constant‐fold a leading constant operand in a DIExpression.

dump

dump overloads

dumpTree

dumpTree overloads

elements_begin

Return the elements begin.

elements_end

Return the elements end.

expr_op_begin

Visit the elements via ExprOperand wrappers.

expr_op_end

Return the expr op end.

expr_ops

Return the expr ops.

extractIfOffset

If this is a constant offset, extract it. If there is no expression, return true with an offset of zero.

extractLeadingOffset

Extract a leading constant address offset from an expression.

foldConstantMath

Fold constant math operations in a DIExpression.

fragmentCmp

Determine the relative position of the fragments described by this DIExpression and Other. Calls static fragmentCmp implementation.

fragmentsOverlap

Check if fragments overlap between this DIExpression and Other.

getActiveBits

Return how many bits in this expression still carry an active value.

getContext

Return the LLVM context that owns this node.

getElement

Return the element.

getElements

Return the elements.

getFragmentInfo

Retrieve the details of this fragment expression.

getMetadataID

Return the metadata kind ID for this node.

getNumElements

Return the num elements.

getNumLocationOperands

Return the number of unique DW_OP_LLVM_arg location operands.

getNumOperands

Return number of MDNode operands.

getNumTemporaryUses

Return the number of uses of this temporary metadata node.

getOperand

Return the operand at index I.

getSingleLocationExpressionElements

Return expression elements, skipping a leading DW_OP_LLVM_arg 0.

hasAllLocationOps

Returns true iff this DIExpression contains at least one instance of DW_OP_LLVM_arg, n for all n in [0, N).]

isAlwaysReplaceable

Return true if this node kind is always RAUW‐replaceable (e.g. DIAssignID).

isComplex

Return whether the location is computed on the expression stack, meaning it cannot be a simple register location.

isConstant

Return true if this is constant.

isDeref

Return whether there is exactly one operator and it is a DW_OP_deref;

isDistinct

Return true if this node is distinct (not uniqued).

isEntryValue

Check if the expression consists of exactly one entry value operand. (This is the only configuration of entry values that is supported.)

isFragment

Return whether this is a piece of an aggregate variable.

isImplicit

Return whether this is an implicit location description.

isReplaceable

Return true if this node supports RAUW replacement.

isResolved

Check if node is fully resolved.

isSingleLocationExpression

Return true if this expression uses a single starting location.

isTBAAVtableAccess

Check whether MDNode is a vtable access.

isTemporary

Return true if this is a temporary (forward‐declaration) metadata node.

isUniqued

Return true if this node is uniqued in the context.

isValid

Return true if this is valid.

op_begin

Return an iterator to the first operand.

op_end

Return an iterator past the last operand.

operands

Return this node's operands as an array reference.

operator new [deleted]

Ordinary allocation is deleted; use the custom MDNode allocators.

print

print overloads

printAsOperand

printAsOperand overloads

printTree

printTree overloads

replaceAllUsesWith

RAUW a temporary.

replaceOperandWith

Replace a specific operand.

resolve

Resolve a unique, unresolved node.

resolveCycles

Resolve cycles.

startsWithDeref

Return whether the first element a DW_OP_deref.

Static Member Functions

Name

Description

append

Append opcodes to a DIExpression.

appendExt

Append a zero‐ or sign‐extension to Expr. Converts the expression to a stack value if it isn't one already.

appendOffset

Append Ops with operations to apply the Offset.

appendOpsToArg

Append opcodes to each use of a given DW_OP_LLVM_arg.

appendToStack

Append opcodes after ensuring the expression is a stack value.

calculateFragmentIntersect

Computes a fragment, bit‐extract operation if needed, and new constant offset to describe a part of a variable covered by some memory.

canonicalizeExpressionOps

Rewrite expression ops into a canonical variadic form.

classof

Check whether MD is this kind of metadata.

concatenate

Methods for metadata merging. Concatenate metadata nodes A and B.

convertToNonVariadicExpression

Convert a single‐location expression to non‐variadic form.

convertToUndefExpression

Convert an expression into one suitable for an undef debug value.

convertToVariadicExpression

Convert a non‐variadic expression into variadic form.

createFragmentExpression

Create a DIExpression describing one fragment of an aggregate.

deleteTemporary

Deallocate a node created by getTemporary.

extractAddressClass

Checks if the last 4 elements of the expression are DW_OP_constu <DWARF Address Space> DW_OP_swap DW_OP_xderef and extracts the <DWARF Address Space>.

extractLeadingOffset

Extract a leading constant address offset from expression ops.

fragmentCmp

Compare the relative position of two fragments.

fragmentsOverlap

Check if fragments overlap between a pair of FragmentInfos.

fromCaptureComponents

Convert CaptureComponents to !captures metadata. The return value may be nullptr.

get

get overloads

getDistinct

getDistinct overloads

getExtOps

Returns the ops for a zero‐ or sign‐extension in a DIExpression.

getFragmentInfo

Retrieve the details of this fragment expression.

getIfExists

getIfExists overloads

getMergedAllocTokenMetadata

Merge alloc‐token metadata from two instructions.

getMergedCalleeTypeMetadata

Merge callee‐type metadata from two instructions.

getMergedCallsiteMetadata

Merge callsite metadata from two instructions.

getMergedMemProfMetadata

Merge memprof metadata from two instructions.

getMergedProfMetadata

Merge !prof metadata from two instructions. Currently only implemented with direct callsites with branch weights.

getMostGenericAliasScope

Merge alias‐scope metadata, keeping scopes present in both.

getMostGenericAlignmentOrDereferenceable

Merge align/dereferenceable metadata, returning the most generic bound.

getMostGenericFPMath

Merge FP‐math metadata, returning the most generic accuracy.

getMostGenericNoFPClass

Merge !nofpclass metadata by intersecting the allowed FP classes.

getMostGenericNoaliasAddrspace

Merge noalias address‐space metadata, returning the most generic set.

getMostGenericRange

Merge !range metadata by taking the union of the integer intervals.

getMostGenericTBAA

Merge TBAA metadata, returning the most generic common tag.

getTemporary

getTemporary overloads

intersect

Intersect metadata nodes A and B.

isEqualExpression

Return true if two debug values produce equivalent DWARF expressions.

prepend

Prepend DIExpr with a deref and offset operation and optionally turn it into a stack value or/and an entry value.

prependOpcodes

Prepend DIExpr with the given opcodes and optionally turn it into a stack value.

replaceArg

Remap DW_OP_LLVM_arg indices in a DIExpression.

replaceWithDistinct

Replace a temporary node with a distinct one.

replaceWithPermanent

Replace a temporary node with a permanent one.

replaceWithUniqued

Replace a temporary node with a uniqued one.

toCaptureComponents

Convert !captures metadata to CaptureComponents. MD may be nullptr.

Static Data Members

Name

Description

PoisonGeneratingIDs

Metadata IDs that may generate poison.

Protected Type Aliases

Name

Description

mutable_op_range

Range type over mutable MDOperand elements.

Protected Enums

Name

Description

StorageType

Active type of storage.

Protected Member Functions

Name

Description

dropAllReferences

Drop all references held by this metadata node.

getNumUnresolved

Return the number of unresolved operands in this node.

handleChangedOperand

Default handling of a changed operand, which asserts.

mutable_begin

Return an iterator to the first mutable operand.

mutable_end

Return an iterator past the last mutable operand.

mutable_operands

Return a mutable range over this node's operands.

operator delete

Delete operators

operator new

Allocate an MDNode with NumOps operand slots and Storage kind.

resize

Resize the node to hold NumOps operands.

setNumUnresolved

Set the number of unresolved operands in this node.

setOperand

Set an operand.

storeDistinctInContext

Register this node as a distinct MDNode owned by the LLVMContext.

Protected Static Member Functions

Name

Description

storeImpl

storeImpl overloads

Protected Data Members

Name

Description

Storage

Storage flag for non‐uniqued, otherwise unowned, metadata.

SubclassData1

One bit of subclass‐specific state packed into the metadata header.

SubclassData16

Sixteen bits of subclass‐specific state packed into the metadata header.

SubclassData32

Thirty‐two bits of subclass‐specific state packed into the metadata header.

Friends

Name

Description

llvm::MDNode

Metadata node.

llvm::LLVMContextImpl

Private implementation details of LLVMContext.

Non-Member Functions

Name

Description

GetUnrollMetadata

Return the named unroll hint metadata operand from loop id LoopID.

MapMetadata

Lookup or compute a mapping for a piece of metadata.

MapMetadata

Version of MapMetadata with type safety for MDNode.

UpgradeTBAANode

Upgrade a scalar TBAA tag to the struct‐path aware TBAA format.

computeKnownBitsFromRangeMetadata

Compute known bits from the range metadata. KnownZero the set of bits that are known to be zero KnownOne the set of bits that are known to be one

extractBranchWeights

Extract branch weights from MD_prof metadata

extractFromBranchWeightMD32

Faster version of extractBranchWeights() that skips checks and must only be called with "branch_weights" metadata nodes. Supports uint32_t.

extractFromBranchWeightMD64

Faster version of extractBranchWeights() that skips checks and must only be called with "branch_weights" metadata nodes. Supports uint64_t.

extractProfTotalWeight

Retrieve the total of all weights from MD_prof data.

findOptionMDForLoopID

Find and return the loop attribute node for the attribute Name in LoopID. Return nullptr if there is no such attribute.

getBranchWeightOffset

Return the offset to the first branch weight data

getConstantRangeFromMetadata

Parse out a conservative ConstantRange from !range metadata.

getDISubprogram

Find subprogram that is enclosing this scope.

getExpressionForConstant

Create a debug‐info expression for a constant.

getNumBranchWeights

Return the number of branch weights stored in ProfileData

hasBranchWeightOrigin

Check if Branch Weight Metadata has an "expected" field from an llvm.expect* intrinsic

isBranchWeightMD

Checks if an MDNode contains Branch Weight Metadata

isExplicitlyUnknownProfileMetadata

Check whether MD is explicitly‐unknown profile metadata.

isValidAsAccessGroup

Return whether an MDNode might represent an access group.

isValueProfileMD

Checks if an MDNode contains value profiling Metadata

makeFollowupLoopID

Create a new loop identifier for a loop created from a loop transformation.

parseDIExpressionBodyAtBeginning

Parse a DIExpression body at the beginning of the given string.

uniteAccessGroups

Compute the union of two access‐group lists.

upgradeInstructionLoopAttachment

Upgrade the loop attachment metadata node.

wrap

Wrap a Metadata pointer as an opaque LLVMMetadataRef.

memprof::getMIBAllocType

Returns the allocation type from an MIB metadata node.

memprof::getMIBStackNode

Returns the stack node from an MIB metadata node.

Created with MrDocs