LLVM 17.0.0git
|
DWARF expression. More...
#include "llvm/IR/DebugInfoMetadata.h"
Classes | |
class | expr_op_iterator |
An iterator for expression operands. More... | |
class | ExprOperand |
A lightweight wrapper around an expression operand. More... | |
struct | FragmentInfo |
Holds the characteristics of one fragment of a larger variable. More... | |
Public Types | |
enum | SignedOrUnsignedConstant { SignedConstant , UnsignedConstant } |
enum | PrependOps : uint8_t { ApplyOffset = 0 , DerefBefore = 1 << 0 , DerefAfter = 1 << 1 , StackValue = 1 << 2 , EntryValue = 1 << 3 } |
Used for DIExpression::prepend. More... | |
using | element_iterator = ArrayRef< uint64_t >::iterator |
using | ExtOps = std::array< uint64_t, 6 > |
![]() | |
using | op_iterator = const MDOperand * |
using | op_range = iterator_range< op_iterator > |
![]() | |
enum | MetadataKind |
Public Member Functions | |
DEFINE_MDNODE_GET (DIExpression,(ArrayRef< uint64_t > Elements),(Elements)) TempDIExpression clone() const | |
ArrayRef< uint64_t > | getElements () const |
unsigned | getNumElements () const |
uint64_t | getElement (unsigned I) const |
std::optional< SignedOrUnsignedConstant > | isConstant () const |
Determine whether this represents a constant value, if so. | |
uint64_t | getNumLocationOperands () const |
Return the number of unique location operands referred to (via DW_OP_LLVM_arg) in this expression; this is not necessarily the number of instances of DW_OP_LLVM_arg within the expression. | |
element_iterator | elements_begin () const |
element_iterator | elements_end () const |
bool | isValid () const |
bool | startsWithDeref () const |
Return whether the first element a DW_OP_deref. | |
bool | isDeref () const |
Return whether there is exactly one operator and it is a DW_OP_deref;. | |
std::optional< FragmentInfo > | getFragmentInfo () const |
Retrieve the details of this fragment expression. | |
bool | isFragment () const |
Return whether this is a piece of an aggregate variable. | |
bool | isImplicit () const |
Return whether this is an implicit location description. | |
bool | isComplex () const |
Return whether the location is computed on the expression stack, meaning it cannot be a simple register location. | |
bool | isSingleLocationExpression () const |
Return whether the evaluated expression makes use of a single location at the start of the expression, i.e. | |
bool | extractIfOffset (int64_t &Offset) const |
If this is a constant offset, extract it. | |
bool | hasAllLocationOps (unsigned N) const |
Returns true iff this DIExpression contains at least one instance of DW_OP_LLVM_arg, n for all n in [0, N). | |
int | fragmentCmp (const DIExpression *Other) const |
Determine the relative position of the fragments described by this DIExpression and Other . | |
bool | fragmentsOverlap (const DIExpression *Other) const |
Check if fragments overlap between this DIExpression and Other . | |
bool | isEntryValue () const |
Check if the expression consists of exactly one entry value operand. | |
std::pair< DIExpression *, const ConstantInt * > | constantFold (const ConstantInt *CI) |
Try to shorten an expression with an initial constant operand. | |
expr_op_iterator | expr_op_begin () const |
Visit the elements via ExprOperand wrappers. | |
expr_op_iterator | expr_op_end () const |
iterator_range< expr_op_iterator > | expr_ops () const |
![]() | |
MDNode (const MDNode &)=delete | |
void | operator= (const MDNode &)=delete |
void * | operator new (size_t)=delete |
TempMDNode | clone () const |
Create a (temporary) clone of this. | |
LLVMContext & | getContext () const |
void | replaceOperandWith (unsigned I, Metadata *New) |
Replace a specific operand. | |
bool | isResolved () const |
Check if node is fully resolved. | |
bool | isUniqued () const |
bool | isDistinct () const |
bool | isTemporary () const |
void | replaceAllUsesWith (Metadata *MD) |
RAUW a temporary. | |
void | resolveCycles () |
Resolve cycles. | |
void | resolve () |
Resolve a unique, unresolved node. | |
op_iterator | op_begin () const |
op_iterator | op_end () const |
ArrayRef< MDOperand > | operands () const |
const MDOperand & | getOperand (unsigned I) const |
unsigned | getNumOperands () const |
Return number of MDNode operands. | |
bool | isTBAAVtableAccess () const |
Check whether MDNode is a vtable access. | |
void | printTree (raw_ostream &OS, const Module *M=nullptr) const |
Print in tree shape. | |
void | printTree (raw_ostream &OS, ModuleSlotTracker &MST, const Module *M=nullptr) const |
void | dumpTree () const |
User-friendly dump in tree shape. | |
void | dumpTree (const Module *M) const |
![]() | |
unsigned | getMetadataID () const |
void | dump () const |
User-friendly dump. | |
void | dump (const Module *M) const |
void | print (raw_ostream &OS, const Module *M=nullptr, bool IsForDebug=false) const |
Print. | |
void | print (raw_ostream &OS, ModuleSlotTracker &MST, const Module *M=nullptr, bool IsForDebug=false) const |
void | printAsOperand (raw_ostream &OS, const Module *M=nullptr) const |
Print as operand. | |
void | printAsOperand (raw_ostream &OS, ModuleSlotTracker &MST, const Module *M=nullptr) const |
Static Public Member Functions | |
static bool | classof (const Metadata *MD) |
static std::optional< FragmentInfo > | getFragmentInfo (expr_op_iterator Start, expr_op_iterator End) |
Retrieve the details of this fragment expression. | |
static const DIExpression * | convertToUndefExpression (const DIExpression *Expr) |
Removes all elements from Expr that do not apply to an undef debug value, which includes every operator that computes the value/location on the DWARF stack, including any DW_OP_LLVM_arg elements (making the result of this function always a single-location expression) while leaving everything that defines what the computed value applies to, i.e. | |
static const DIExpression * | convertToVariadicExpression (const DIExpression *Expr) |
If Expr is a non-variadic expression (i.e. | |
static std::optional< const DIExpression * > | convertToNonVariadicExpression (const DIExpression *Expr) |
If Expr is a valid single-location expression, i.e. | |
static void | canonicalizeExpressionOps (SmallVectorImpl< uint64_t > &Ops, const DIExpression *Expr, bool IsIndirect) |
Inserts the elements of Expr into Ops modified to a canonical form, which uses DW_OP_LLVM_arg (i.e. | |
static bool | isEqualExpression (const DIExpression *FirstExpr, bool FirstIndirect, const DIExpression *SecondExpr, bool SecondIndirect) |
Determines whether two debug values should produce equivalent DWARF expressions, using their DIExpressions and directness, ignoring the differences between otherwise identical expressions in variadic and non-variadic form and not considering the debug operands. | |
static void | appendOffset (SmallVectorImpl< uint64_t > &Ops, int64_t Offset) |
Append Ops with operations to apply the Offset . | |
static const DIExpression * | extractAddressClass (const DIExpression *Expr, unsigned &AddrClass) |
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>. | |
static DIExpression * | prepend (const DIExpression *Expr, uint8_t Flags, int64_t Offset=0) |
Prepend DIExpr with a deref and offset operation and optionally turn it into a stack value or/and an entry value. | |
static DIExpression * | prependOpcodes (const DIExpression *Expr, SmallVectorImpl< uint64_t > &Ops, bool StackValue=false, bool EntryValue=false) |
Prepend DIExpr with the given opcodes and optionally turn it into a stack value. | |
static DIExpression * | append (const DIExpression *Expr, ArrayRef< uint64_t > Ops) |
Append the opcodes Ops to DIExpr . | |
static DIExpression * | appendToStack (const DIExpression *Expr, ArrayRef< uint64_t > Ops) |
Convert DIExpr into a stack value if it isn't one already by appending DW_OP_deref if needed, and appending Ops to the resulting expression. | |
static DIExpression * | appendOpsToArg (const DIExpression *Expr, ArrayRef< uint64_t > Ops, unsigned ArgNo, bool StackValue=false) |
Create a copy of Expr by appending the given list of Ops to each instance of the operand DW_OP_LLVM_arg, \p ArgNo . | |
static DIExpression * | replaceArg (const DIExpression *Expr, uint64_t OldArg, uint64_t NewArg) |
Create a copy of Expr with each instance of DW_OP_LLVM_arg, \p OldArg replaced with DW_OP_LLVM_arg, \p NewArg , and each instance of DW_OP_LLVM_arg, Arg with DW_OP_LLVM_arg, Arg - 1 for all Arg > OldArg . | |
static std::optional< DIExpression * > | createFragmentExpression (const DIExpression *Expr, unsigned OffsetInBits, unsigned SizeInBits) |
Create a DIExpression to describe one part of an aggregate variable that is fragmented across multiple Values. | |
static int | fragmentCmp (const FragmentInfo &A, const FragmentInfo &B) |
Determine the relative position of the fragments passed in. | |
static ExtOps | getExtOps (unsigned FromSize, unsigned ToSize, bool Signed) |
Returns the ops for a zero- or sign-extension in a DIExpression. | |
static DIExpression * | appendExt (const DIExpression *Expr, unsigned FromSize, unsigned ToSize, bool Signed) |
Append a zero- or sign-extension to Expr . | |
static bool | fragmentsOverlap (const FragmentInfo &A, const FragmentInfo &B) |
Check if fragments overlap between a pair of FragmentInfos. | |
![]() | |
static MDTuple * | get (LLVMContext &Context, ArrayRef< Metadata * > MDs) |
static MDTuple * | getIfExists (LLVMContext &Context, ArrayRef< Metadata * > MDs) |
static MDTuple * | getDistinct (LLVMContext &Context, ArrayRef< Metadata * > MDs) |
static TempMDTuple | getTemporary (LLVMContext &Context, ArrayRef< Metadata * > MDs) |
static void | deleteTemporary (MDNode *N) |
Deallocate a node created by getTemporary. | |
template<class T > | |
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > | replaceWithPermanent (std::unique_ptr< T, TempMDNodeDeleter > N) |
Replace a temporary node with a permanent one. | |
template<class T > | |
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > | replaceWithUniqued (std::unique_ptr< T, TempMDNodeDeleter > N) |
Replace a temporary node with a uniqued one. | |
template<class T > | |
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > | replaceWithDistinct (std::unique_ptr< T, TempMDNodeDeleter > N) |
Replace a temporary node with a distinct one. | |
static bool | classof (const Metadata *MD) |
Methods for support type inquiry through isa, cast, and dyn_cast: | |
static MDNode * | concatenate (MDNode *A, MDNode *B) |
Methods for metadata merging. | |
static MDNode * | intersect (MDNode *A, MDNode *B) |
static MDNode * | getMostGenericTBAA (MDNode *A, MDNode *B) |
static MDNode * | getMostGenericFPMath (MDNode *A, MDNode *B) |
static MDNode * | getMostGenericRange (MDNode *A, MDNode *B) |
static MDNode * | getMostGenericAliasScope (MDNode *A, MDNode *B) |
static MDNode * | getMostGenericAlignmentOrDereferenceable (MDNode *A, MDNode *B) |
static MDNode * | getMergedProfMetadata (MDNode *A, MDNode *B, const Instruction *AInstr, const Instruction *BInstr) |
Merge !prof metadata from two instructions. | |
Friends | |
class | LLVMContextImpl |
class | MDNode |
Additional Inherited Members | |
![]() | |
using | mutable_op_range = iterator_range< MDOperand * > |
![]() | |
enum | StorageType { Uniqued , Distinct , Temporary } |
Active type of storage. More... | |
![]() | |
MDNode (LLVMContext &Context, unsigned ID, StorageType Storage, ArrayRef< Metadata * > Ops1, ArrayRef< Metadata * > Ops2=std::nullopt) | |
~MDNode ()=default | |
void * | operator new (size_t Size, size_t NumOps, StorageType Storage) |
void | operator delete (void *Mem) |
void | operator delete (void *, unsigned) |
Required by std, but never called. | |
void | operator delete (void *, unsigned, bool) |
Required by std, but never called. | |
void | dropAllReferences () |
MDOperand * | mutable_begin () |
MDOperand * | mutable_end () |
mutable_op_range | mutable_operands () |
void | setOperand (unsigned I, Metadata *New) |
Set an operand. | |
unsigned | getNumUnresolved () const |
void | setNumUnresolved (unsigned N) |
void | storeDistinctInContext () |
void | resize (size_t NumOps) |
Resize the node to hold NumOps operands. | |
![]() | |
Metadata (unsigned ID, StorageType Storage) | |
~Metadata ()=default | |
void | handleChangedOperand (void *, Metadata *) |
Default handling of a changed operand, which asserts. | |
![]() | |
template<class T , class StoreT > | |
static T * | storeImpl (T *N, StorageType Storage, StoreT &Store) |
template<class T > | |
static T * | storeImpl (T *N, StorageType Storage) |
![]() | |
unsigned char | Storage: 7 |
Storage flag for non-uniqued, otherwise unowned, metadata. | |
unsigned char | SubclassData1: 1 |
unsigned short | SubclassData16 = 0 |
unsigned | SubclassData32 = 0 |
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.
Definition at line 2627 of file DebugInfoMetadata.h.
using llvm::DIExpression::element_iterator = ArrayRef<uint64_t>::iterator |
Definition at line 2675 of file DebugInfoMetadata.h.
using llvm::DIExpression::ExtOps = std::array<uint64_t, 6> |
Definition at line 2984 of file DebugInfoMetadata.h.
enum llvm::DIExpression::PrependOps : uint8_t |
Used for DIExpression::prepend.
Enumerator | |
---|---|
ApplyOffset | |
DerefBefore | |
DerefAfter | |
StackValue | |
EntryValue |
Definition at line 2903 of file DebugInfoMetadata.h.
Enumerator | |
---|---|
SignedConstant | |
UnsignedConstant |
Definition at line 2660 of file DebugInfoMetadata.h.
|
static |
Append the opcodes Ops
to DIExpr
.
Unlike appendToStack, the returned expression is a stack value only if DIExpr
is a stack value. If DIExpr
describes a fragment, the returned expression will describe the same fragment.
Definition at line 1809 of file DebugInfoMetadata.cpp.
References llvm::SmallVectorImpl< T >::append(), assert(), llvm::ArrayRef< T >::begin(), llvm::dwarf::DW_OP_LLVM_fragment, llvm::ArrayRef< T >::empty(), llvm::ArrayRef< T >::end(), expr_ops(), llvm::MDNode::get(), and llvm::MDNode::getContext().
Referenced by appendToStack(), combineDIExpressions(), llvm::InstrEmitter::EmitDbgInstrRef(), llvm::LowerDbgDeclare(), UpdateDbgValueInst(), llvm::UpgradeIntrinsicCall(), and walkToAllocaAndPrependOffsetDeref().
|
static |
Append a zero- or sign-extension to Expr
.
Converts the expression to a stack value if it isn't one already.
Definition at line 2012 of file DebugInfoMetadata.cpp.
References appendToStack(), getExtOps(), and Signed.
Referenced by llvm::X86InstrInfo::describeLoadedValue(), and llvm::replaceAllDbgUsesWith().
|
static |
Append Ops
with operations to apply the Offset
.
Definition at line 1632 of file DebugInfoMetadata.cpp.
References llvm::Offset, and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by llvm::TargetInstrInfo::describeLoadedValue(), llvm::X86InstrInfo::describeLoadedValue(), llvm::SystemZRegisterInfo::eliminateFrameIndex(), llvm::TargetRegisterInfo::getOffsetOpcodes(), llvm::AArch64RegisterInfo::getOffsetOpcodes(), llvm::RISCVRegisterInfo::getOffsetOpcodes(), getSalvageOpsForBinOp(), getSalvageOpsForGEP(), prepend(), and llvm::SelectionDAG::salvageDebugInfo().
|
static |
Create a copy of Expr
by appending the given list of Ops
to each instance of the operand DW_OP_LLVM_arg, \p ArgNo
.
This is used to modify a specific location used by Expr
, such as when salvaging that location.
Definition at line 1719 of file DebugInfoMetadata.cpp.
References llvm::any_of(), assert(), llvm::ArrayRef< T >::begin(), llvm::dwarf::DW_OP_LLVM_arg, llvm::dwarf::DW_OP_LLVM_fragment, llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::ArrayRef< T >::end(), expr_ops(), llvm::MDNode::get(), llvm::MDNode::getContext(), llvm::SmallVectorImpl< T >::insert(), prependOpcodes(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and StackValue.
Referenced by computeExprForSpill(), llvm::SystemZRegisterInfo::eliminateFrameIndex(), LiveDebugValues::MLocTracker::emitLoc(), salvageDbgAssignAddress(), llvm::SelectionDAG::salvageDebugInfo(), llvm::coro::salvageDebugInfo(), llvm::salvageDebugInfoForDbgValue(), llvm::salvageDebugInfoForDbgValues(), and llvm::SelectionDAGBuilder::salvageUnresolvedDbgValue().
|
static |
Convert DIExpr
into a stack value if it isn't one already by appending DW_OP_deref if needed, and appending Ops
to the resulting expression.
If DIExpr
describes a fragment, the returned expression will describe the same fragment.
Definition at line 1833 of file DebugInfoMetadata.cpp.
References append(), llvm::SmallVectorImpl< T >::append(), assert(), llvm::ArrayRef< T >::back(), llvm::ArrayRef< T >::begin(), llvm::ArrayRef< T >::drop_back(), llvm::dwarf::DW_OP_LLVM_fragment, llvm::ArrayRef< T >::empty(), llvm::ArrayRef< T >::end(), getElements(), getFragmentInfo(), getNumElements(), llvm::none_of(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by appendExt().
|
static |
Inserts the elements of Expr
into Ops
modified to a canonical form, which uses DW_OP_LLVM_arg (i.e.
is a variadic expression) and folds the implied derefence from the IsIndirect
flag into the expression. This allows us to check equivalence between expressions with differing directness or variadicness.
Definition at line 1580 of file DebugInfoMetadata.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::dwarf::DW_OP_LLVM_arg, llvm::dwarf::DW_OP_LLVM_fragment, elements_begin(), elements_end(), expr_ops(), llvm::none_of(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by isEqualExpression().
Definition at line 2781 of file DebugInfoMetadata.h.
References llvm::Metadata::getMetadataID().
std::pair< DIExpression *, const ConstantInt * > DIExpression::constantFold | ( | const ConstantInt * | CI | ) |
Try to shorten an expression with an initial constant operand.
Returns a new expression and constant on success, or the original expression and constant on failure.
Definition at line 1929 of file DebugInfoMetadata.cpp.
References assert(), llvm::dwarf::DW_OP_LLVM_convert, expr_ops(), llvm::MDNode::get(), llvm::ConstantInt::get(), llvm::MDNode::getContext(), llvm::ConstantInt::getValue(), llvm::APInt::sextOrTrunc(), and llvm::APInt::zextOrTrunc().
Referenced by llvm::InstrEmitter::EmitDbgValueFromSingleOp(), and llvm::FastISel::selectIntrinsicCall().
|
static |
If Expr
is a valid single-location expression, i.e.
it refers to only a single debug operand at the start of the expression, then return that expression in a non-variadic form by removing DW_OP_LLVM_arg from the expression if it is present; otherwise returns std::nullopt.
Definition at line 1560 of file DebugInfoMetadata.cpp.
References llvm::dwarf::DW_OP_LLVM_arg, elements_begin(), elements_end(), llvm::MDNode::get(), llvm::MDNode::getContext(), getNumElements(), isSingleLocationExpression(), and llvm::make_range().
Referenced by emitDebugValueComment(), and TransferTracker::recoverAsEntryValue().
|
static |
Removes all elements from Expr
that do not apply to an undef debug value, which includes every operator that computes the value/location on the DWARF stack, including any DW_OP_LLVM_arg elements (making the result of this function always a single-location expression) while leaving everything that defines what the computed value applies to, i.e.
the fragment information.
Definition at line 1537 of file DebugInfoMetadata.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::dwarf::DW_OP_LLVM_fragment, llvm::MDNode::get(), llvm::MDNode::getContext(), getFragmentInfo(), llvm::DIExpression::FragmentInfo::OffsetInBits, and llvm::DIExpression::FragmentInfo::SizeInBits.
Referenced by llvm::InstrEmitter::EmitDbgNoLocation(), and llvm::SelectionDAGBuilder::handleKillDebugValue().
|
static |
If Expr
is a non-variadic expression (i.e.
one that does not contain DW_OP_LLVM_arg), returns Expr
converted to variadic form by adding a leading [DW_OP_LLVM_arg, 0] to the expression; otherwise returns Expr
.
Definition at line 1547 of file DebugInfoMetadata.cpp.
References llvm::any_of(), llvm::SmallVectorImpl< T >::append(), llvm::dwarf::DW_OP_LLVM_arg, elements_begin(), elements_end(), expr_ops(), llvm::MDNode::get(), llvm::MDNode::getContext(), getNumElements(), and llvm::SmallVectorImpl< T >::reserve().
Referenced by llvm::InstrEmitter::EmitDbgInstrRef().
|
static |
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 Expr
. If Expr
already contains a DW_OP_LLVM_fragment
OffsetInBits
is interpreted as an offset into the existing fragment.
OffsetInBits | Offset of the piece in bits. |
SizeInBits | Size of the piece in bits. |
Expr
contains arithmetic operations that would be truncated. Definition at line 1866 of file DebugInfoMetadata.cpp.
References assert(), llvm::dwarf::DW_OP_LLVM_fragment, expr_ops(), llvm::MDNode::get(), llvm::MDNode::getContext(), isImplicit(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by emitDbgAssign(), llvm::SelectionDAGBuilder::handleDebugValue(), shortenAssignment(), llvm::SelectionDAG::transferDbgValues(), and transferSRADebugInfo().
|
inline |
Definition at line 2647 of file DebugInfoMetadata.h.
|
inline |
Definition at line 2677 of file DebugInfoMetadata.h.
References llvm::ArrayRef< T >::begin(), and getElements().
Referenced by canonicalizeExpressionOps(), convertToNonVariadicExpression(), convertToVariadicExpression(), and expr_op_begin().
|
inline |
Definition at line 2678 of file DebugInfoMetadata.h.
References llvm::ArrayRef< T >::end(), and getElements().
Referenced by canonicalizeExpressionOps(), convertToNonVariadicExpression(), convertToVariadicExpression(), and expr_op_end().
|
inline |
Visit the elements via ExprOperand wrappers.
These range iterators visit elements through ExprOperand wrappers. This is not guaranteed to be a valid range unless isValid() gives true
.
true
. Definition at line 2768 of file DebugInfoMetadata.h.
References elements_begin().
Referenced by llvm::DIExpressionCursor::DIExpressionCursor(), expr_ops(), llvm::DbgVariableLocation::extractFromMachineInstruction(), getFragmentInfo(), and isValid().
|
inline |
Definition at line 2771 of file DebugInfoMetadata.h.
References elements_end().
Referenced by llvm::DIExpressionCursor::DIExpressionCursor(), expr_ops(), llvm::DbgVariableLocation::extractFromMachineInstruction(), getFragmentInfo(), and isValid().
|
inline |
Definition at line 2774 of file DebugInfoMetadata.h.
References expr_op_begin(), and expr_op_end().
Referenced by append(), appendOpsToArg(), canonicalizeExpressionOps(), constantFold(), convertToVariadicExpression(), createFragmentExpression(), emitDebugValueComment(), getNumLocationOperands(), hasAllLocationOps(), isComplex(), isImplicit(), isSingleLocationExpression(), prependOpcodes(), and replaceArg().
|
static |
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>.
Definition at line 1683 of file DebugInfoMetadata.cpp.
References llvm::MDNode::get(), and llvm::MDNode::getContext().
Referenced by llvm::DwarfCompileUnit::addLocationAttribute().
bool DIExpression::extractIfOffset | ( | int64_t & | Offset | ) | const |
If this is a constant offset, extract it.
If there is no expression, return true with an offset of zero.
Definition at line 1647 of file DebugInfoMetadata.cpp.
References getNumElements(), and llvm::Offset.
Referenced by llvm::at::calculateFragmentIntersect(), and transferSRADebugInfo().
|
inline |
Determine the relative position of the fragments described by this DIExpression and Other
.
Calls static fragmentCmp implementation.
Definition at line 3001 of file DebugInfoMetadata.h.
References fragmentCmp(), getFragmentInfo(), and llvm::Other.
|
inlinestatic |
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.
Definition at line 2971 of file DebugInfoMetadata.h.
References A, B, r1(), and r2().
Referenced by fragmentCmp(), and fragmentsOverlap().
|
inline |
Check if fragments overlap between this DIExpression and Other
.
Definition at line 3008 of file DebugInfoMetadata.h.
References fragmentCmp(), isFragment(), and llvm::Other.
|
inlinestatic |
Check if fragments overlap between a pair of FragmentInfos.
Definition at line 2995 of file DebugInfoMetadata.h.
References A, B, and fragmentCmp().
Referenced by llvm::SelectionDAGBuilder::dropDanglingDebugInfo(), handleNewDebugValue(), and stashEntryDbgValues().
Definition at line 2655 of file DebugInfoMetadata.h.
Referenced by llvm::DwarfCompileUnit::addLocationAttribute(), isConstant(), isEntryValue(), and startsWithDeref().
Definition at line 2651 of file DebugInfoMetadata.h.
Referenced by appendToStack(), combineDIExpressions(), elements_begin(), elements_end(), and getDerefOffsetInBytes().
|
static |
Returns the ops for a zero- or sign-extension in a DIExpression.
Definition at line 2004 of file DebugInfoMetadata.cpp.
References llvm::dwarf::DW_OP_LLVM_convert, and Signed.
Referenced by appendExt(), getSalvageOpsForTrunc(), and llvm::salvageDebugInfoImpl().
|
inline |
Retrieve the details of this fragment expression.
Definition at line 2820 of file DebugInfoMetadata.h.
References expr_op_begin(), expr_op_end(), and getFragmentInfo().
Referenced by fragmentCmp(), getFragmentInfo(), llvm::DIExpressionCursor::getFragmentInfo(), and isFragment().
|
static |
Retrieve the details of this fragment expression.
Definition at line 1623 of file DebugInfoMetadata.cpp.
References llvm::dwarf::DW_OP_LLVM_fragment, End, I, and Info.
Referenced by llvm::DwarfExpression::addFragmentOffset(), appendToStack(), buildOverlapMapAndRecordDeclares(), convertToUndefExpression(), llvm::DbgVariableIntrinsic::getFragment(), llvm::SelectionDAGBuilder::handleDebugValue(), hasZeroSizedFragment(), salvageDbgAssignAddress(), and shortenAssignment().
|
inline |
Definition at line 2653 of file DebugInfoMetadata.h.
Referenced by appendToStack(), convertToNonVariadicExpression(), convertToVariadicExpression(), emitDebugValueComment(), extractIfOffset(), getDerefOffsetInBytes(), isComplex(), isConstant(), isDeref(), isEntryValue(), TransferTracker::isEntryValueVariable(), isImplicit(), isSingleLocationExpression(), isValid(), llvm::SDDbgValue::print(), llvm::salvageDebugInfoForDbgValue(), llvm::salvageDebugInfoForDbgValues(), and startsWithDeref().
uint64_t DIExpression::getNumLocationOperands | ( | ) | const |
Return the number of unique location operands referred to (via DW_OP_LLVM_arg) in this expression; this is not necessarily the number of instances of DW_OP_LLVM_arg within the expression.
For example, for the expression: (DW_OP_LLVM_arg 0, DW_OP_LLVM_arg 1, DW_OP_plus, DW_OP_LLVM_arg 0, DW_OP_mul) This function would return 2, as there are two unique location operands (0 and 1).
Definition at line 1967 of file DebugInfoMetadata.cpp.
References assert(), llvm::dwarf::DW_OP_LLVM_arg, expr_ops(), and hasAllLocationOps().
Referenced by LiveDebugValues::DbgValueProperties::getLocationOpCount(), llvm::coro::salvageDebugInfo(), llvm::salvageDebugInfoForDbgValues(), and llvm::SelectionDAGBuilder::salvageUnresolvedDbgValue().
Returns true iff this DIExpression contains at least one instance of DW_OP_LLVM_arg, n
for all n in [0, N).
Definition at line 1672 of file DebugInfoMetadata.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::contains(), llvm::dwarf::DW_OP_LLVM_arg, expr_ops(), Idx, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), and N.
Referenced by getNumLocationOperands().
bool DIExpression::isComplex | ( | ) | const |
Return whether the location is computed on the expression stack, meaning it cannot be a simple register location.
Definition at line 1496 of file DebugInfoMetadata.cpp.
References llvm::dwarf::DW_OP_LLVM_arg, llvm::dwarf::DW_OP_LLVM_fragment, llvm::dwarf::DW_OP_LLVM_tag_offset, expr_ops(), getNumElements(), and isValid().
Referenced by LiveDebugValues::MLocTracker::emitLoc(), and UpdateDbgValueInst().
std::optional< DIExpression::SignedOrUnsignedConstant > DIExpression::isConstant | ( | ) | const |
Determine whether this represents a constant value, if so.
Definition at line 1978 of file DebugInfoMetadata.cpp.
References llvm::dwarf::DW_OP_LLVM_fragment, getElement(), getNumElements(), SignedConstant, and UnsignedConstant.
Referenced by llvm::DwarfCompileUnit::addLocationAttribute().
bool DIExpression::isDeref | ( | ) | const |
Return whether there is exactly one operator and it is a DW_OP_deref;.
Definition at line 1350 of file DebugInfoMetadata.cpp.
References getNumElements(), and startsWithDeref().
Referenced by TransferTracker::isEntryValueVariable().
bool DIExpression::isEntryValue | ( | ) | const |
Check if the expression consists of exactly one entry value operand.
(This is the only configuration of entry values that is supported.)
Definition at line 1344 of file DebugInfoMetadata.cpp.
References llvm::dwarf::DW_OP_LLVM_entry_value, getElement(), and getNumElements().
Referenced by llvm::DwarfCompileUnit::addComplexAddress(), finishCallSiteParams(), llvm::MachineInstr::isDebugEntryValue(), llvm::DbgValueLoc::isEntryVal(), processIfEntryValueDbgDeclare(), llvm::coro::salvageDebugInfo(), llvm::FastISel::selectIntrinsicCall(), and llvm::DwarfExpression::setLocation().
|
static |
Determines whether two debug values should produce equivalent DWARF expressions, using their DIExpressions and directness, ignoring the differences between otherwise identical expressions in variadic and non-variadic form and not considering the debug operands.
FirstExpr
is the DIExpression for the first debug value. FirstIndirect
should be true if the first debug value is indirect; in IR this should be true for dbg.declare intrinsics and false for dbg.values, and in MIR this should be true only for DBG_VALUE instructions whose second operand is an immediate value. SecondExpr
and SecondIndirect
have the same meaning as the prior arguments, but apply to the second debug value.
Definition at line 1610 of file DebugInfoMetadata.cpp.
References canonicalizeExpressionOps().
Referenced by llvm::DbgValueLoc::isEquivalent(), llvm::MachineInstr::isEquivalentDbgInstr(), and LiveDebugValues::DbgValueProperties::isJoinable().
|
inline |
Return whether this is a piece of an aggregate variable.
Definition at line 2825 of file DebugInfoMetadata.h.
References getFragmentInfo().
Referenced by llvm::DwarfExpression::addFragmentOffset(), fragmentsOverlap(), and llvm::DbgValueLoc::isFragment().
bool DIExpression::isImplicit | ( | ) | const |
Return whether this is an implicit location description.
Definition at line 1476 of file DebugInfoMetadata.cpp.
References llvm::dwarf::DW_OP_LLVM_tag_offset, expr_ops(), getNumElements(), and isValid().
Referenced by combineDIExpressions(), createFragmentExpression(), and LiveDebugValues::MLocTracker::emitLoc().
bool DIExpression::isSingleLocationExpression | ( | ) | const |
Return whether the evaluated expression makes use of a single location at the start of the expression, i.e.
if it contains only a single DW_OP_LLVM_arg op as its first operand, or if it contains none.
Definition at line 1519 of file DebugInfoMetadata.cpp.
References llvm::dwarf::DW_OP_LLVM_arg, expr_ops(), getNumElements(), and isValid().
Referenced by convertToNonVariadicExpression(), and LiveDebugValues::MLocTracker::emitLoc().
bool DIExpression::isValid | ( | ) | const |
Definition at line 1386 of file DebugInfoMetadata.cpp.
References llvm::dwarf::DW_OP_LLVM_arg, llvm::dwarf::DW_OP_LLVM_convert, llvm::dwarf::DW_OP_LLVM_entry_value, llvm::dwarf::DW_OP_LLVM_fragment, llvm::dwarf::DW_OP_LLVM_implicit_pointer, llvm::dwarf::DW_OP_LLVM_tag_offset, E, expr_op_begin(), expr_op_end(), getNumElements(), and I.
Referenced by llvm::DbgValueLoc::DbgValueLoc(), finishCallSiteParams(), isComplex(), isImplicit(), and isSingleLocationExpression().
|
static |
Prepend DIExpr
with a deref and offset operation and optionally turn it into a stack value or/and an entry value.
Definition at line 1703 of file DebugInfoMetadata.cpp.
References appendOffset(), DerefAfter, DerefBefore, EntryValue, Flags, llvm::Offset, prependOpcodes(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and StackValue.
Referenced by computeExprForSpill(), llvm::TargetInstrInfo::describeLoadedValue(), llvm::MipsInstrInfo::describeLoadedValue(), processDbgDeclare(), TransferTracker::recoverAsEntryValue(), llvm::replaceDbgDeclare(), replaceOneDbgValueForAlloca(), and llvm::coro::salvageDebugInfo().
|
static |
Prepend DIExpr
with the given opcodes and optionally turn it into a stack value.
Definition at line 1776 of file DebugInfoMetadata.cpp.
References assert(), llvm::dwarf::DW_OP_LLVM_entry_value, llvm::dwarf::DW_OP_LLVM_fragment, llvm::SmallVectorBase< Size_T >::empty(), EntryValue, expr_ops(), llvm::MDNode::get(), llvm::MDNode::getContext(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and StackValue.
Referenced by appendOpsToArg(), llvm::TargetInstrInfo::describeLoadedValue(), prepend(), llvm::TargetRegisterInfo::prependOffsetExpression(), llvm::FastISel::selectIntrinsicCall(), TryToShrinkGlobalToBoolean(), and walkToAllocaAndPrependOffsetDeref().
|
static |
Create a copy of Expr
with each instance of DW_OP_LLVM_arg, \p OldArg
replaced with DW_OP_LLVM_arg, \p NewArg
, and each instance of DW_OP_LLVM_arg, Arg
with DW_OP_LLVM_arg, Arg - 1
for all Arg > OldArg
.
This is used when replacing one of the operands of a debug value list with another operand in the same list and deleting the old operand.
Definition at line 1754 of file DebugInfoMetadata.cpp.
References Arg, assert(), llvm::dwarf::DW_OP_LLVM_arg, expr_ops(), llvm::MDNode::get(), llvm::MDNode::getContext(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
bool DIExpression::startsWithDeref | ( | ) | const |
Return whether the first element a DW_OP_deref.
Definition at line 1347 of file DebugInfoMetadata.cpp.
References getElement(), and getNumElements().
Referenced by isDeref(), promoteSingleBlockAlloca(), and rewriteSingleStoreAlloca().
|
friend |
Definition at line 2628 of file DebugInfoMetadata.h.
|
friend |
Definition at line 2629 of file DebugInfoMetadata.h.