LLVM 20.0.0git
|
Record of a variable value-assignment, aka a non instruction representation of the dbg.value intrinsic. More...
#include "llvm/IR/DebugProgramInstruction.h"
Classes | |
class | location_op_iterator |
Iterator for ValueAsMetadata that internally uses direct pointer iteration over either a ValueAsMetadata* or a ValueAsMetadata**, dereferencing to the ValueAsMetadata . More... | |
Public Types | |
enum class | LocationType : uint8_t { Declare , Value , Assign , End , Any } |
Public Types inherited from llvm::DbgRecord | |
enum | Kind : uint8_t { ValueKind , LabelKind } |
Subclass discriminator. More... | |
using | self_iterator = simple_ilist< DbgRecord >::iterator |
using | const_self_iterator = simple_ilist< DbgRecord >::const_iterator |
Public Attributes | |
LocationType | Type |
Classification of the debug-info record that this DbgVariableRecord represents. | |
DbgRecordParamRef< DILocalVariable > | Variable |
DbgRecordParamRef< DIExpression > | Expression |
DbgRecordParamRef< DIExpression > | AddressExpression |
Public Attributes inherited from llvm::DbgRecord | |
DbgMarker * | Marker = nullptr |
Marker that this DbgRecord is linked into. | |
Friends | |
class | DebugValueUser |
Additional Inherited Members | |
Protected Types inherited from llvm::ilist_node_impl< OptionsT > | |
using | self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, false, false >::type |
using | const_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, false, true >::type |
using | reverse_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, true, false >::type |
using | const_reverse_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, true, true >::type |
Protected Member Functions inherited from llvm::DbgRecord | |
~DbgRecord ()=default | |
Similarly to Value, we avoid paying the cost of a vtable by protecting the dtor and having deleteRecord dispatch cleanup. | |
Protected Member Functions inherited from llvm::ilist_node_impl< OptionsT > | |
ilist_node_impl ()=default | |
Protected Member Functions inherited from llvm::DebugValueUser | |
ArrayRef< Metadata * > | getDebugValues () const |
DbgVariableRecord * | getUser () |
const DbgVariableRecord * | getUser () const |
void | handleChangedValue (void *Old, Metadata *NewDebugValue) |
To be called by ReplaceableMetadataImpl::replaceAllUsesWith, where Old is a pointer to one of the pointers in DebugValues (so should be type Metadata**), and NewDebugValue is the new Metadata* that is replacing *Old. | |
DebugValueUser ()=default | |
DebugValueUser (std::array< Metadata *, 3 > DebugValues) | |
DebugValueUser (DebugValueUser &&X) | |
DebugValueUser (const DebugValueUser &X) | |
DebugValueUser & | operator= (DebugValueUser &&X) |
DebugValueUser & | operator= (const DebugValueUser &X) |
~DebugValueUser () | |
void | resetDebugValues () |
void | resetDebugValue (size_t Idx, Metadata *DebugValue) |
bool | operator== (const DebugValueUser &X) const |
bool | operator!= (const DebugValueUser &X) const |
Protected Attributes inherited from llvm::DbgRecord | |
DebugLoc | DbgLoc |
Kind | RecordKind |
Subclass discriminator. | |
Protected Attributes inherited from llvm::DebugValueUser | |
std::array< Metadata *, 3 > | DebugValues |
Record of a variable value-assignment, aka a non instruction representation of the dbg.value intrinsic.
This class inherits from DebugValueUser to allow LLVM's metadata facilities to update our references to metadata beneath our feet.
Definition at line 262 of file DebugProgramInstruction.h.
|
strong |
Enumerator | |
---|---|
Declare | |
Value | |
Assign | |
End | Marks the end of the concrete types. |
Any | To indicate all LocationTypes in searches. |
Definition at line 266 of file DebugProgramInstruction.h.
llvm::DbgVariableRecord::DbgVariableRecord | ( | const DbgVariableIntrinsic * | DVI | ) |
Create a new DbgVariableRecord representing the intrinsic DVI
, for example the assignment represented by a dbg.value.
Definition at line 31 of file DebugProgramInstruction.cpp.
References llvm::DbgVariableIntrinsic::getRawLocation().
llvm::DbgVariableRecord::DbgVariableRecord | ( | const DbgVariableRecord & | DVR | ) |
Definition at line 58 of file DebugProgramInstruction.cpp.
llvm::DbgVariableRecord::DbgVariableRecord | ( | Metadata * | Location, |
DILocalVariable * | DV, | ||
DIExpression * | Expr, | ||
const DILocation * | DI, | ||
LocationType | Type = LocationType::Value |
||
) |
Directly construct a new DbgVariableRecord representing a dbg.value intrinsic assigning Location
to the DV / Expr / DI variable.
Definition at line 64 of file DebugProgramInstruction.cpp.
llvm::DbgVariableRecord::DbgVariableRecord | ( | Metadata * | Value, |
DILocalVariable * | Variable, | ||
DIExpression * | Expression, | ||
DIAssignID * | AssignID, | ||
Metadata * | Address, | ||
DIExpression * | AddressExpression, | ||
const DILocation * | DI | ||
) |
Definition at line 70 of file DebugProgramInstruction.cpp.
References llvm::Address, and Value.
void llvm::DbgVariableRecord::addVariableLocationOps | ( | ArrayRef< Value * > | NewValues, |
DIExpression * | NewExpr | ||
) |
Adding a new location operand will always result in this intrinsic using an ArgList, and must always be accompanied by a new expression that uses the new operand.
Definition at line 340 of file DebugProgramInstruction.cpp.
References assert(), llvm::DIArgList::get(), llvm::getAsMetadata(), llvm::DbgRecord::getContext(), getNumVariableLocationOps(), getVariableLocationOp(), llvm::is_contained(), location_ops(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), setExpression(), setRawLocation(), and llvm::ArrayRef< T >::size().
Support type inquiry through isa, cast, and dyn_cast.
Definition at line 535 of file DebugProgramInstruction.h.
References E, and llvm::DbgRecord::ValueKind.
DbgVariableRecord * llvm::DbgVariableRecord::clone | ( | ) | const |
Definition at line 394 of file DebugProgramInstruction.cpp.
Referenced by insertDbgVariableRecordsForPHIs().
|
static |
Definition at line 179 of file DebugProgramInstruction.cpp.
References llvm::ValueAsMetadata::get(), and Value.
Referenced by createDbgVariableRecord().
|
static |
Definition at line 186 of file DebugProgramInstruction.cpp.
References createDbgVariableRecord().
DbgVariableIntrinsic * llvm::DbgVariableRecord::createDebugIntrinsic | ( | Module * | M, |
Instruction * | InsertBefore | ||
) | const |
Convert this DbgVariableRecord back into a dbg.value intrinsic.
InsertBefore
Optional position to insert this intrinsic.
Definition at line 403 of file DebugProgramInstruction.cpp.
References Any, assert(), Assign, llvm::CallInst::Create(), Declare, End, llvm::MetadataAsValue::get(), getAddressExpression(), getAssignID(), llvm::MDNode::getContext(), llvm::DbgRecord::getDebugLoc(), llvm::Intrinsic::getDeclaration(), getExpression(), llvm::Function::getFunctionType(), getRawAddress(), getRawLocation(), getType(), getVariable(), llvm::Instruction::insertBefore(), isDbgAssign(), llvm_unreachable, llvm::Instruction::setDebugLoc(), llvm::CallInst::setTailCall(), and Value.
|
static |
Definition at line 211 of file DebugProgramInstruction.cpp.
References llvm::Address, AddressExpression, llvm::ValueAsMetadata::get(), and Variable.
Referenced by createLinkedDVRAssign(), and llvm::DIBuilder::insertDbgAssign().
|
static |
Definition at line 194 of file DebugProgramInstruction.cpp.
References llvm::Address, Declare, and llvm::ValueAsMetadata::get().
Referenced by createDVRDeclare(), and insertNewDbgInst().
|
static |
Definition at line 203 of file DebugProgramInstruction.cpp.
References llvm::Address, and createDVRDeclare().
|
static |
Definition at line 220 of file DebugProgramInstruction.cpp.
References llvm::Address, AddressExpression, assert(), createDVRAssign(), llvm::Instruction::getMetadata(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), and Variable.
Referenced by emitDbgAssign(), and insertNewDbgInst().
|
static |
Used to create DbgVariableRecords during parsing, where some metadata references may still be unresolved.
Although for some fields a generic Metadata*
argument is accepted for forward type-references, the verifier and accessors will reject incorrect types later on. The function is used for all types of DbgVariableRecords for simplicity while parsing, but asserts if any necessary fields are empty or unused fields are not empty, i.e. if the #dbg_assign fields are used for a non-dbg-assign type.
Definition at line 170 of file DebugProgramInstruction.cpp.
References llvm::Address, AddressExpression, and Variable.
Value * llvm::DbgVariableRecord::getAddress | ( | ) | const |
Definition at line 474 of file DebugProgramInstruction.cpp.
References assert(), and getRawAddress().
Referenced by fixupDebugInfoPostExtraction(), getAddress(), isKillAddress(), replaceVariableLocationOp(), and setKillAddress().
|
inline |
Definition at line 501 of file DebugProgramInstruction.h.
References AddressExpression.
Referenced by createDebugIntrinsic(), getAddressExpression(), and llvm::ValueEnumerator::ValueEnumerator().
DIAssignID * llvm::DbgVariableRecord::getAssignID | ( | ) | const |
Definition at line 484 of file DebugProgramInstruction.cpp.
References llvm::DebugValueUser::DebugValues.
Referenced by createDebugIntrinsic(), llvm::at::getAssignmentInsts(), getIDFromMarker(), and llvm::ValueEnumerator::ValueEnumerator().
|
inline |
Definition at line 440 of file DebugProgramInstruction.h.
Referenced by buildOverlapMapAndRecordDeclares(), llvm::ConvertDebugDeclareToDebugValue(), createDebugIntrinsic(), DbgVariableRecordsRemoveRedundantDbgInstrsUsingBackwardScan(), getAddressExpression(), getFragment(), getFragmentSizeInBits(), llvm::FastISel::handleDbgInfo(), insertNewDbgInst(), isKillLocation(), llvm::coro::salvageDebugInfo(), valueCoversEntireFragment(), llvm::ValueEnumerator::ValueEnumerator(), and llvm::SelectionDAGBuilder::visitDbgInfo().
std::optional< DbgVariableFragmentInfo > llvm::DbgVariableRecord::getFragment | ( | ) | const |
Definition at line 374 of file DebugProgramInstruction.cpp.
References getExpression(), and llvm::DIExpression::getFragmentInfo().
Referenced by getFragmentOrEntireVariable().
|
inline |
Get the FragmentInfo for the variable if it exists, otherwise return a FragmentInfo that covers the entire variable if the variable size is known, otherwise return a zero-sized fragment.
Definition at line 468 of file DebugProgramInstruction.h.
References getFragment(), and getFragmentSizeInBits().
std::optional< uint64_t > llvm::DbgVariableRecord::getFragmentSizeInBits | ( | ) | const |
Get the size (in bits) of the variable, or fragment of the variable that is described.
Definition at line 378 of file DebugProgramInstruction.cpp.
References getExpression(), llvm::DIVariable::getSizeInBits(), and getVariable().
Referenced by getFragmentOrEntireVariable().
unsigned llvm::DbgVariableRecord::getNumVariableLocationOps | ( | ) | const |
Definition at line 257 of file DebugProgramInstruction.cpp.
References getRawLocation(), and hasArgList().
Referenced by addVariableLocationOps(), isKillLocation(), replaceVariableLocationOp(), and valueCoversEntireFragment().
|
inline |
Definition at line 496 of file DebugProgramInstruction.h.
References llvm::DebugValueUser::DebugValues, and isDbgAssign().
Referenced by createDebugIntrinsic(), getAddress(), and llvm::ValueEnumerator::ValueEnumerator().
|
inline |
Definition at line 502 of file DebugProgramInstruction.h.
References AddressExpression.
|
inline |
Definition at line 499 of file DebugProgramInstruction.h.
References llvm::DebugValueUser::DebugValues.
|
inline |
Definition at line 441 of file DebugProgramInstruction.h.
|
inline |
Returns the metadata operand for the first location description.
i.e., dbg intrinsic dbg.value,declare operand and dbg.assign 1st location operand (the "value componenet"). Note the operand (singular) may be a DIArgList which is a list of values.
Definition at line 447 of file DebugProgramInstruction.h.
References llvm::DebugValueUser::DebugValues.
Referenced by buildOverlapMapAndRecordDeclares(), createDebugIntrinsic(), getNumVariableLocationOps(), getVariableLocationOp(), hasArgList(), isKillLocation(), location_ops(), and llvm::ValueEnumerator::ValueEnumerator().
|
inline |
Definition at line 437 of file DebugProgramInstruction.h.
References Variable.
|
inline |
Definition at line 430 of file DebugProgramInstruction.h.
References Type.
Referenced by createDebugIntrinsic(), DbgVariableRecordsRemoveRedundantDbgInstrsUsingBackwardScan(), getAddress(), getAddressExpression(), llvm::FastISel::handleDbgInfo(), isDbgAssign(), isKillAddress(), llvm::coro::salvageDebugInfo(), setKillAddress(), and llvm::SelectionDAGBuilder::visitDbgInfo().
Definition at line 449 of file DebugProgramInstruction.h.
References getVariableLocationOp().
Referenced by insertNewDbgInst().
|
inline |
Definition at line 436 of file DebugProgramInstruction.h.
References Variable.
Referenced by llvm::ConvertDebugDeclareToDebugValue(), createDebugIntrinsic(), DbgVariableRecordsRemoveRedundantDbgInstrsUsingBackwardScan(), findVarsWithStackSlot(), fixupDebugInfoPostExtraction(), getAggregateVariable(), getFragmentSizeInBits(), llvm::FastISel::handleDbgInfo(), insertNewDbgInst(), valueCoversEntireFragment(), llvm::ValueEnumerator::ValueEnumerator(), and llvm::SelectionDAGBuilder::visitDbgInfo().
Definition at line 263 of file DebugProgramInstruction.cpp.
References assert(), and getRawLocation().
Referenced by addVariableLocationOps(), getValue(), llvm::FastISel::handleDbgInfo(), hasValidLocation(), replaceVariableLocationOp(), llvm::coro::salvageDebugInfo(), valueCoversEntireFragment(), and llvm::SelectionDAGBuilder::visitDbgInfo().
void llvm::DbgVariableRecord::handleChangedLocation | ( | Metadata * | NewLocation | ) |
Handle changes to the location of the Value(s) that we refer to happening "under our feet".
|
inline |
Definition at line 422 of file DebugProgramInstruction.h.
References getRawLocation().
Referenced by getNumVariableLocationOps(), llvm::FastISel::handleDbgInfo(), isKillLocation(), replaceVariableLocationOp(), and llvm::SelectionDAGBuilder::visitDbgInfo().
|
inline |
Returns true if this DbgVariableRecord has no empty MDNodes in its location list.
Definition at line 425 of file DebugProgramInstruction.h.
References getVariableLocationOp().
|
inline |
Does this describe the address of a local variable.
True for dbg.addr and dbg.declare, but not dbg.value, which describes its value.
Definition at line 429 of file DebugProgramInstruction.h.
References Declare.
Referenced by llvm::ConvertDebugDeclareToDebugValue(), and valueCoversEntireFragment().
|
inline |
Definition at line 493 of file DebugProgramInstruction.h.
References Assign, and getType().
Referenced by CastToDbgAssign(), llvm::ConvertDebugDeclareToDebugValue(), createDebugIntrinsic(), DbgVariableRecordsRemoveRedundantDbgInstrsUsingBackwardScan(), llvm::memtag::DynCastToDbgAssign(), fixupDebugInfoPostExtraction(), llvm::at::getAssignmentInsts(), getIDFromMarker(), getRawAddress(), insertNewDbgInst(), replaceVariableLocationOp(), and llvm::ValueEnumerator::ValueEnumerator().
|
inline |
Definition at line 401 of file DebugProgramInstruction.h.
References Declare.
Referenced by DynCastToDbgDeclare(), insertNewDbgInst(), and llvm::coro::salvageDebugInfo().
|
inline |
Definition at line 402 of file DebugProgramInstruction.h.
References Value.
|
inline |
Definition at line 479 of file DebugProgramInstruction.h.
References llvm::DbgRecord::DbgLoc, isIdenticalToWhenDefined(), and llvm::Other.
|
inline |
Definition at line 484 of file DebugProgramInstruction.h.
References AddressExpression, llvm::DebugValueUser::DebugValues, llvm::Other, and Variable.
Referenced by isEquivalentTo().
bool llvm::DbgVariableRecord::isKillAddress | ( | ) | const |
Check whether this kills the address component.
This doesn't take into account the position of the intrinsic, therefore a returned value of false does not guarentee the address is a valid location for the variable at the intrinsic's position in IR.
Definition at line 497 of file DebugProgramInstruction.cpp.
References Addr, and getAddress().
Referenced by isKillAddress().
bool llvm::DbgVariableRecord::isKillLocation | ( | ) | const |
Definition at line 368 of file DebugProgramInstruction.cpp.
References llvm::any_of(), getExpression(), getNumVariableLocationOps(), getRawLocation(), hasArgList(), llvm::DIExpression::isComplex(), and location_ops().
Referenced by isKillAddress().
iterator_range< DbgVariableRecord::location_op_iterator > llvm::DbgVariableRecord::location_ops | ( | ) | const |
Get the locations corresponding to the variable referenced by the debug info intrinsic.
Depending on the intrinsic, this could be the variable's value or its address.
Definition at line 234 of file DebugProgramInstruction.cpp.
References assert(), and getRawLocation().
Referenced by addVariableLocationOps(), fixupDebugInfoPostExtraction(), insertDbgVariableRecordsForPHIs(), isKillLocation(), replaceVariableLocationOp(), setKillLocation(), and llvm::SelectionDAGBuilder::visitDbgInfo().
void DbgVariableRecord::print | ( | raw_ostream & | O, |
bool | IsForDebug = false |
||
) | const |
Definition at line 4963 of file AsmWriter.cpp.
References getModuleFromDPI(), and print().
Referenced by print().
void DbgVariableRecord::print | ( | raw_ostream & | ROS, |
ModuleSlotTracker & | MST, | ||
bool | IsForDebug | ||
) | const |
Definition at line 4990 of file AsmWriter.cpp.
References F, llvm::ModuleSlotTracker::getMachine(), getModuleFromDPI(), llvm::BasicBlock::getParent(), llvm::DbgMarker::getParent(), llvm::ModuleSlotTracker::incorporateFunction(), llvm::DbgRecord::Marker, and OS.
Definition at line 320 of file DebugProgramInstruction.cpp.
References assert(), llvm::DIArgList::get(), llvm::ValueAsMetadata::get(), llvm::getAsMetadata(), llvm::DbgRecord::getContext(), getNumVariableLocationOps(), getVariableLocationOp(), hasArgList(), Idx, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and setRawLocation().
void llvm::DbgVariableRecord::replaceVariableLocationOp | ( | Value * | OldValue, |
Value * | NewValue, | ||
bool | AllowEmpty = false |
||
) |
Definition at line 286 of file DebugProgramInstruction.cpp.
References assert(), llvm::find(), llvm::DIArgList::get(), llvm::ValueAsMetadata::get(), getAddress(), llvm::getAsMetadata(), llvm::DbgRecord::getContext(), getVariableLocationOp(), hasArgList(), isDbgAssign(), llvm_unreachable, location_ops(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), setAddress(), and setRawLocation().
Referenced by insertDbgVariableRecordsForPHIs(), rewriteDebugUsers(), llvm::coro::salvageDebugInfo(), setKillLocation(), and updateOneDbgValueForAlloca().
|
inline |
Definition at line 509 of file DebugProgramInstruction.h.
References llvm::ValueAsMetadata::get(), and llvm::DebugValueUser::resetDebugValue().
Referenced by replaceVariableLocationOp().
|
inline |
Definition at line 505 of file DebugProgramInstruction.h.
References AddressExpression.
void llvm::DbgVariableRecord::setAssignId | ( | DIAssignID * | New | ) |
Definition at line 488 of file DebugProgramInstruction.cpp.
References llvm::DebugValueUser::resetDebugValue().
|
inline |
Definition at line 439 of file DebugProgramInstruction.h.
Referenced by addVariableLocationOps(), rewriteDebugUsers(), llvm::coro::salvageDebugInfo(), and updateOneDbgValueForAlloca().
void llvm::DbgVariableRecord::setKillAddress | ( | ) |
Kill the address component.
Definition at line 492 of file DebugProgramInstruction.cpp.
References llvm::PoisonValue::get(), llvm::ValueAsMetadata::get(), getAddress(), getType(), and llvm::DebugValueUser::resetDebugValue().
void llvm::DbgVariableRecord::setKillLocation | ( | ) |
Definition at line 356 of file DebugProgramInstruction.cpp.
References llvm::PoisonValue::get(), llvm::SmallPtrSetImpl< PtrType >::insert(), location_ops(), Poison, and replaceVariableLocationOp().
|
inline |
Use of this should generally be avoided; instead, replaceVariableLocationOp and addVariableLocationOps should be used where possible to avoid creating invalid state.
Definition at line 456 of file DebugProgramInstruction.h.
References assert(), and llvm::DebugValueUser::resetDebugValue().
Referenced by addVariableLocationOps(), and replaceVariableLocationOp().
|
inline |
Definition at line 435 of file DebugProgramInstruction.h.
References Variable.
Referenced by fixupDebugInfoPostExtraction().
|
friend |
Definition at line 263 of file DebugProgramInstruction.h.
DbgRecordParamRef<DIExpression> llvm::DbgVariableRecord::AddressExpression |
Definition at line 286 of file DebugProgramInstruction.h.
Referenced by createDVRAssign(), createLinkedDVRAssign(), createUnresolvedDbgVariableRecord(), getAddressExpression(), getRawAddressExpression(), isIdenticalToWhenDefined(), and setAddressExpression().
DbgRecordParamRef<DIExpression> llvm::DbgVariableRecord::Expression |
Definition at line 285 of file DebugProgramInstruction.h.
LocationType llvm::DbgVariableRecord::Type |
Classification of the debug-info record that this DbgVariableRecord represents.
Essentially, "does this correspond to a dbg.value, dbg.declare, or dbg.assign?". FIXME: We could use spare padding bits from DbgRecord for this.
Definition at line 278 of file DebugProgramInstruction.h.
Referenced by getType().
DbgRecordParamRef<DILocalVariable> llvm::DbgVariableRecord::Variable |
Definition at line 284 of file DebugProgramInstruction.h.
Referenced by createDVRAssign(), createLinkedDVRAssign(), createUnresolvedDbgVariableRecord(), getRawVariable(), getVariable(), isIdenticalToWhenDefined(), and setVariable().