class DIExpression

Declaration

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

Description

DWARF expression. 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.

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

Inherits from: MDNode

Member Variables

Inherited from Metadata:

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

Method Overview

  • public static llvm::DIExpression * append(const llvm::DIExpression * Expr, ArrayRef<uint64_t> Ops)
  • public static llvm::DIExpression * appendExt(const llvm::DIExpression * Expr, unsigned int FromSize, unsigned int ToSize, bool Signed)
  • public static void appendOffset(SmallVectorImpl<uint64_t> & Ops, int64_t Offset)
  • public static llvm::DIExpression * appendToStack(const llvm::DIExpression * Expr, ArrayRef<uint64_t> Ops)
  • public static bool classof(const llvm::Metadata * MD)
  • public llvm::TempDIExpression clone() const
  • public static Optional<llvm::DIExpression *> createFragmentExpression(const llvm::DIExpression * Expr, unsigned int OffsetInBits, unsigned int SizeInBits)
  • public llvm::DIExpression::element_iterator elements_begin() const
  • public llvm::DIExpression::element_iterator elements_end() const
  • public llvm::DIExpression::expr_op_iterator expr_op_begin() const
  • public llvm::DIExpression::expr_op_iterator expr_op_end() const
  • public iterator_range<llvm::DIExpression::expr_op_iterator> expr_ops() const
  • public static const llvm::DIExpression * extractAddressClass(const llvm::DIExpression * Expr, unsigned int & AddrClass)
  • public bool extractIfOffset(int64_t & Offset) const
  • public int fragmentCmp(const llvm::DIExpression * Other) const
  • public static int fragmentCmp(const llvm::DIExpression::FragmentInfo & A, const llvm::DIExpression::FragmentInfo & B)
  • public bool fragmentsOverlap(const llvm::DIExpression * Other) const
  • public static bool fragmentsOverlap(const llvm::DIExpression::FragmentInfo & A, const llvm::DIExpression::FragmentInfo & B)
  • public uint64_t getElement(unsigned int I) const
  • public ArrayRef<uint64_t> getElements() const
  • public static llvm::DIExpression::ExtOps getExtOps(unsigned int FromSize, unsigned int ToSize, bool Signed)
  • public Optional<llvm::DIExpression::FragmentInfo> getFragmentInfo() const
  • public static Optional<llvm::DIExpression::FragmentInfo> getFragmentInfo(llvm::DIExpression::expr_op_iterator Start, llvm::DIExpression::expr_op_iterator End)
  • public unsigned int getNumElements() const
  • public bool isComplex() const
  • public bool isConstant() const
  • public bool isEntryValue() const
  • public bool isFragment() const
  • public bool isImplicit() const
  • public bool isValid() const
  • public static llvm::DIExpression * prepend(const llvm::DIExpression * Expr, uint8_t Flags, int64_t Offset = 0)
  • public static llvm::DIExpression * prependOpcodes(const llvm::DIExpression * Expr, SmallVectorImpl<uint64_t> & Ops, bool StackValue = false, bool EntryValue = false)
  • public bool startsWithDeref() const

Inherited from MDNode:

Inherited from Metadata:

Methods

static llvm::DIExpression* append(
    const llvm::DIExpression* Expr,
    ArrayRef<uint64_t> Ops)

Description

Append the opcodes \p Ops to \p DIExpr. Unlike \ref appendToStack, the returned expression is a stack value only if \p DIExpr is a stack value. If \p DIExpr describes a fragment, the returned expression will describe the same fragment.

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

Parameters

const llvm::DIExpression* Expr
ArrayRef<uint64_t> Ops

static llvm::DIExpression* appendExt(
    const llvm::DIExpression* Expr,
    unsigned int FromSize,
    unsigned int ToSize,
    bool Signed)

Description

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

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

Parameters

const llvm::DIExpression* Expr
unsigned int FromSize
unsigned int ToSize
bool Signed

static void appendOffset(
    SmallVectorImpl<uint64_t>& Ops,
    int64_t Offset)

Description

Append \p Ops with operations to apply the \p Offset.

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

Parameters

SmallVectorImpl<uint64_t>& Ops
int64_t Offset

static llvm::DIExpression* appendToStack(
    const llvm::DIExpression* Expr,
    ArrayRef<uint64_t> Ops)

Description

Convert \p DIExpr into a stack value if it isn't one already by appending DW_OP_deref if needed, and appending \p Ops to the resulting expression. If \p DIExpr describes a fragment, the returned expression will describe the same fragment.

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

Parameters

const llvm::DIExpression* Expr
ArrayRef<uint64_t> Ops

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

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

Parameters

const llvm::Metadata* MD

llvm::TempDIExpression clone() const

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

static Optional<llvm::DIExpression*>
createFragmentExpression(
    const llvm::DIExpression* Expr,
    unsigned int OffsetInBits,
    unsigned int SizeInBits)

Description

Create a DIExpression to describe one part of an aggregate variable that is fragmented across multiple Values. The DW_OP_LLVM_fragment operation will be appended to the elements of \c Expr. If \c Expr already contains a \c DW_OP_LLVM_fragment \c OffsetInBits is interpreted as an offset into the existing fragment.

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

Parameters

const llvm::DIExpression* Expr
unsigned int OffsetInBits
Offset of the piece in bits.
unsigned int SizeInBits
Size of the piece in bits.

Returns

Creating a fragment expression may fail if \c Expr contains arithmetic operations that would be truncated.

llvm::DIExpression::element_iterator
elements_begin() const

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

llvm::DIExpression::element_iterator
elements_end() const

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

llvm::DIExpression::expr_op_iterator
expr_op_begin() const

Description

Visit the elements via ExprOperand wrappers. These range iterators visit elements through \a ExprOperand wrappers. This is not guaranteed to be a valid range unless \a isValid() gives \c true.

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

llvm::DIExpression::expr_op_iterator expr_op_end()
    const

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

iterator_range<
    llvm::DIExpression::expr_op_iterator>
expr_ops() const

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

static const llvm::DIExpression*
extractAddressClass(
    const llvm::DIExpression* Expr,
    unsigned int& AddrClass)

Description

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

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

Parameters

const llvm::DIExpression* Expr
unsigned int& AddrClass

bool extractIfOffset(int64_t& Offset) const

Description

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

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

Parameters

int64_t& Offset

int fragmentCmp(
    const llvm::DIExpression* Other) const

Description

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

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

Parameters

const llvm::DIExpression* Other

static int fragmentCmp(
    const llvm::DIExpression::FragmentInfo& A,
    const llvm::DIExpression::FragmentInfo& B)

Description

Determine the relative position of the fragments passed in. Returns -1 if this is entirely before Other, 0 if this and Other overlap, 1 if this is entirely after Other.

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

Parameters

const llvm::DIExpression::FragmentInfo& A
const llvm::DIExpression::FragmentInfo& B

bool fragmentsOverlap(
    const llvm::DIExpression* Other) const

Description

Check if fragments overlap between this DIExpression and \p Other.

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

Parameters

const llvm::DIExpression* Other

static bool fragmentsOverlap(
    const llvm::DIExpression::FragmentInfo& A,
    const llvm::DIExpression::FragmentInfo& B)

Description

Check if fragments overlap between a pair of FragmentInfos.

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

Parameters

const llvm::DIExpression::FragmentInfo& A
const llvm::DIExpression::FragmentInfo& B

uint64_t getElement(unsigned int I) const

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

Parameters

unsigned int I

ArrayRef<uint64_t> getElements() const

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

static llvm::DIExpression::ExtOps getExtOps(
    unsigned int FromSize,
    unsigned int ToSize,
    bool Signed)

Description

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

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

Parameters

unsigned int FromSize
unsigned int ToSize
bool Signed

Optional<llvm::DIExpression::FragmentInfo>
getFragmentInfo() const

Description

Retrieve the details of this fragment expression.

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

static Optional<llvm::DIExpression::FragmentInfo>
getFragmentInfo(
    llvm::DIExpression::expr_op_iterator Start,
    llvm::DIExpression::expr_op_iterator End)

Description

Retrieve the details of this fragment expression.

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

Parameters

llvm::DIExpression::expr_op_iterator Start
llvm::DIExpression::expr_op_iterator End

unsigned int getNumElements() const

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

bool isComplex() const

Description

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

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

bool isConstant() const

Description

Determine whether this represents a standalone constant value.

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

bool isEntryValue() const

Description

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

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

bool isFragment() const

Description

Return whether this is a piece of an aggregate variable.

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

bool isImplicit() const

Description

Return whether this is an implicit location description.

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

bool isValid() const

Description

@ }

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

static llvm::DIExpression* prepend(
    const llvm::DIExpression* Expr,
    uint8_t Flags,
    int64_t Offset = 0)

Description

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

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

Parameters

const llvm::DIExpression* Expr
uint8_t Flags
int64_t Offset = 0

static llvm::DIExpression* prependOpcodes(
    const llvm::DIExpression* Expr,
    SmallVectorImpl<uint64_t>& Ops,
    bool StackValue = false,
    bool EntryValue = false)

Description

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

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

Parameters

const llvm::DIExpression* Expr
SmallVectorImpl<uint64_t>& Ops
bool StackValue = false
bool EntryValue = false

bool startsWithDeref() const

Description

Return whether the first element a DW_OP_deref.

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