LLVM 22.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 } |
![]() | |
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 |
![]() | |
DbgMarker * | Marker = nullptr |
Marker that this DbgRecord is linked into. | |
Friends | |
class | DebugValueUser |
Additional Inherited Members | |
![]() | |
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 |
![]() | |
~DbgRecord ()=default | |
Similarly to Value, we avoid paying the cost of a vtable by protecting the dtor and having deleteRecord dispatch cleanup. | |
![]() | |
ilist_node_impl ()=default | |
![]() | |
ArrayRef< Metadata * > | getDebugValues () const |
LLVM_ABI DbgVariableRecord * | getUser () |
LLVM_ABI const DbgVariableRecord * | getUser () const |
LLVM_ABI 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 |
![]() | |
DebugLoc | DbgLoc |
Kind | RecordKind |
Subclass discriminator. | |
![]() | |
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 277 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 281 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 32 of file DebugProgramInstruction.cpp.
References llvm::DbgVariableIntrinsic::getRawLocation().
llvm::DbgVariableRecord::DbgVariableRecord | ( | const DbgVariableRecord & | DVR | ) |
Definition at line 59 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 65 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 71 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 341 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 555 of file DebugProgramInstruction.h.
References E.
DbgVariableRecord * llvm::DbgVariableRecord::clone | ( | ) | const |
Definition at line 395 of file DebugProgramInstruction.cpp.
Referenced by llvm::insertDebugValuesForPHIs().
|
static |
Definition at line 180 of file DebugProgramInstruction.cpp.
References llvm::ValueAsMetadata::get(), and Value.
Referenced by createDbgVariableRecord(), llvm::DIBuilder::insertDbgValueIntrinsic(), and insertNewDbgInst().
|
static |
Definition at line 187 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 404 of file DebugProgramInstruction.cpp.
References Any, assert(), Assign, Context, llvm::CallInst::Create(), Declare, End, llvm::MetadataAsValue::get(), getAddressExpression(), getAssignID(), llvm::MDNode::getContext(), llvm::DbgRecord::getDebugLoc(), getExpression(), llvm::Function::getFunctionType(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Intrinsic::getOrInsertDeclaration(), getRawAddress(), getRawLocation(), getType(), getVariable(), llvm::Instruction::insertBefore(), isDbgAssign(), llvm_unreachable, llvm::Instruction::setDebugLoc(), llvm::CallInst::setTailCall(), and Value.
|
static |
Definition at line 212 of file DebugProgramInstruction.cpp.
References llvm::Address, AddressExpression, llvm::ValueAsMetadata::get(), and Variable.
Referenced by createLinkedDVRAssign(), and llvm::DIBuilder::insertDbgAssign().
|
static |
Definition at line 195 of file DebugProgramInstruction.cpp.
References llvm::Address, Declare, and llvm::ValueAsMetadata::get().
Referenced by createDVRDeclare(), llvm::DIBuilder::insertDeclare(), and insertNewDbgInst().
|
static |
Definition at line 204 of file DebugProgramInstruction.cpp.
References llvm::Address, and createDVRDeclare().
|
static |
Definition at line 221 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 171 of file DebugProgramInstruction.cpp.
References llvm::Address, AddressExpression, and Variable.
Referenced by upgradeDbgIntrinsicToDbgRecord().
Value * llvm::DbgVariableRecord::getAddress | ( | ) | const |
Definition at line 475 of file DebugProgramInstruction.cpp.
References assert(), and getRawAddress().
Referenced by llvm::at::calculateFragmentIntersect(), fixupDebugInfoPostExtraction(), isKillAddress(), replaceVariableLocationOp(), and setKillAddress().
|
inline |
Definition at line 520 of file DebugProgramInstruction.h.
References llvm::DbgRecordParamRef< T >::get().
Referenced by llvm::at::calculateFragmentIntersect(), createDebugIntrinsic(), getAddressExpression(), and llvm::ValueEnumerator::ValueEnumerator().
DIAssignID * llvm::DbgVariableRecord::getAssignID | ( | ) | const |
Definition at line 486 of file DebugProgramInstruction.cpp.
References llvm::DebugValueUser::DebugValues.
Referenced by createDebugIntrinsic(), llvm::at::getAssignmentInsts(), getIDFromMarker(), and llvm::ValueEnumerator::ValueEnumerator().
|
inline |
Definition at line 459 of file DebugProgramInstruction.h.
Referenced by buildOverlapMapAndRecordDeclares(), llvm::ConvertDebugDeclareToDebugValue(), createDebugIntrinsic(), getAddressExpression(), getFragment(), getFragmentSizeInBits(), llvm::FastISel::handleDbgInfo(), llvm::InsertDebugValueAtStoreLoc(), insertNewDbgInst(), isKillLocation(), promoteSingleBlockAlloca(), rewriteSingleStoreAlloca(), llvm::coro::salvageDebugInfo(), UpdateDbgValue(), valueCoversEntireFragment(), llvm::ValueEnumerator::ValueEnumerator(), and llvm::SelectionDAGBuilder::visitDbgInfo().
std::optional< DbgVariableFragmentInfo > llvm::DbgVariableRecord::getFragment | ( | ) | const |
Definition at line 375 of file DebugProgramInstruction.cpp.
References getExpression(), and llvm::DIExpression::getFragmentInfo().
|
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 487 of file DebugProgramInstruction.h.
Referenced by llvm::at::calculateFragmentIntersect().
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 379 of file DebugProgramInstruction.cpp.
References getExpression(), llvm::DIVariable::getSizeInBits(), and getVariable().
unsigned llvm::DbgVariableRecord::getNumVariableLocationOps | ( | ) | const |
Definition at line 258 of file DebugProgramInstruction.cpp.
References getRawLocation(), and hasArgList().
Referenced by addVariableLocationOps(), isKillLocation(), replaceVariableLocationOp(), and valueCoversEntireFragment().
|
inline |
Definition at line 515 of file DebugProgramInstruction.h.
Referenced by createDebugIntrinsic(), getAddress(), and llvm::ValueEnumerator::ValueEnumerator().
|
inline |
Definition at line 521 of file DebugProgramInstruction.h.
References llvm::DbgRecordParamRef< T >::getAsMDNode().
|
inline |
Definition at line 518 of file DebugProgramInstruction.h.
|
inline |
Definition at line 460 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 466 of file DebugProgramInstruction.h.
Referenced by buildOverlapMapAndRecordDeclares(), createDebugIntrinsic(), getNumVariableLocationOps(), getVariableLocationOp(), isKillLocation(), location_ops(), and llvm::ValueEnumerator::ValueEnumerator().
|
inline |
Definition at line 456 of file DebugProgramInstruction.h.
References llvm::DbgRecordParamRef< T >::getAsMDNode().
|
inline |
Definition at line 449 of file DebugProgramInstruction.h.
Referenced by createDebugIntrinsic(), getAddressExpression(), llvm::FastISel::handleDbgInfo(), isKillAddress(), llvm::coro::salvageDebugInfo(), setKillAddress(), and llvm::SelectionDAGBuilder::visitDbgInfo().
Definition at line 468 of file DebugProgramInstruction.h.
References OpIdx.
Referenced by insertNewDbgInst().
|
inline |
Definition at line 455 of file DebugProgramInstruction.h.
References llvm::DbgRecordParamRef< T >::get().
Referenced by llvm::ConvertDebugDeclareToDebugValue(), createDebugIntrinsic(), findVarsWithStackSlot(), fixupDebugInfoPostExtraction(), getAggregateVariable(), getFragmentSizeInBits(), llvm::FastISel::handleDbgInfo(), llvm::InsertDebugValueAtStoreLoc(), insertNewDbgInst(), remarkAlloca(), valueCoversEntireFragment(), llvm::ValueEnumerator::ValueEnumerator(), and llvm::SelectionDAGBuilder::visitDbgInfo().
Definition at line 264 of file DebugProgramInstruction.cpp.
References assert(), getRawLocation(), and OpIdx.
Referenced by addVariableLocationOps(), llvm::FastISel::handleDbgInfo(), replaceVariableLocationOp(), llvm::coro::salvageDebugInfo(), valueCoversEntireFragment(), and llvm::SelectionDAGBuilder::visitDbgInfo().
Handle changes to the location of the Value(s) that we refer to happening "under our feet".
|
inline |
Definition at line 436 of file DebugProgramInstruction.h.
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 439 of file DebugProgramInstruction.h.
|
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 443 of file DebugProgramInstruction.h.
Referenced by llvm::ConvertDebugDeclareToDebugValue(), promoteSingleBlockAlloca(), rewriteSingleStoreAlloca(), and valueCoversEntireFragment().
|
inline |
Definition at line 512 of file DebugProgramInstruction.h.
References getType().
Referenced by llvm::ConvertDebugDeclareToDebugValue(), createDebugIntrinsic(), llvm::memtag::DynCastToDbgAssign(), fixupDebugInfoPostExtraction(), llvm::at::getAssignmentInsts(), getIDFromMarker(), insertNewDbgInst(), replaceVariableLocationOp(), and llvm::ValueEnumerator::ValueEnumerator().
|
inline |
Definition at line 415 of file DebugProgramInstruction.h.
Referenced by insertNewDbgInst(), and llvm::coro::salvageDebugInfo().
|
inline |
Definition at line 416 of file DebugProgramInstruction.h.
Referenced by insertNewDbgInst().
|
inline |
Definition at line 498 of file DebugProgramInstruction.h.
References llvm::Other.
|
inline |
Definition at line 503 of file DebugProgramInstruction.h.
References llvm::Other.
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 499 of file DebugProgramInstruction.cpp.
References Addr, and getAddress().
Referenced by llvm::at::calculateFragmentIntersect(), and isKillAddress().
bool llvm::DbgVariableRecord::isKillLocation | ( | ) | const |
Definition at line 369 of file DebugProgramInstruction.cpp.
References llvm::any_of(), getExpression(), getNumVariableLocationOps(), getRawLocation(), hasArgList(), llvm::DIExpression::isComplex(), and location_ops().
Referenced by isKillAddress().
|
inline |
Determine if this describes the value of a local variable.
It is false for dbg.declare, but true for dbg.value, which describes its value.
Definition at line 447 of file DebugProgramInstruction.h.
Referenced by rewriteSingleStoreAlloca().
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 235 of file DebugProgramInstruction.cpp.
References assert(), and getRawLocation().
Referenced by addVariableLocationOps(), fixupDebugInfoPostExtraction(), llvm::insertDebugValuesForPHIs(), isKillLocation(), replaceVariableLocationOp(), setKillLocation(), and llvm::SelectionDAGBuilder::visitDbgInfo().
void DbgVariableRecord::print | ( | raw_ostream & | O, |
bool | IsForDebug = false |
||
) | const |
Definition at line 5162 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 5189 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 321 of file DebugProgramInstruction.cpp.
References assert(), llvm::DIArgList::get(), llvm::ValueAsMetadata::get(), llvm::getAsMetadata(), llvm::DbgRecord::getContext(), getNumVariableLocationOps(), getVariableLocationOp(), hasArgList(), Idx, OpIdx, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and setRawLocation().
void llvm::DbgVariableRecord::replaceVariableLocationOp | ( | Value * | OldValue, |
Value * | NewValue, | ||
bool | AllowEmpty = false |
||
) |
Definition at line 287 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 llvm::insertDebugValuesForPHIs(), rewriteDebugUsers(), llvm::coro::salvageDebugInfo(), setKillLocation(), and updateOneDbgValueForAlloca().
|
inline |
Definition at line 528 of file DebugProgramInstruction.h.
References llvm::ValueAsMetadata::get().
Referenced by replaceVariableLocationOp().
|
inline |
Definition at line 524 of file DebugProgramInstruction.h.
void llvm::DbgVariableRecord::setAssignId | ( | DIAssignID * | New | ) |
Definition at line 490 of file DebugProgramInstruction.cpp.
References llvm::DebugValueUser::resetDebugValue().
|
inline |
Definition at line 458 of file DebugProgramInstruction.h.
Referenced by addVariableLocationOps(), restorePreTransformState(), rewriteDebugUsers(), llvm::coro::salvageDebugInfo(), UpdateDbgValue(), and updateOneDbgValueForAlloca().
void llvm::DbgVariableRecord::setKillAddress | ( | ) |
Kill the address component.
Definition at line 494 of file DebugProgramInstruction.cpp.
References llvm::PoisonValue::get(), llvm::ValueAsMetadata::get(), getAddress(), getType(), and llvm::DebugValueUser::resetDebugValue().
Referenced by insertNewDbgInst().
void llvm::DbgVariableRecord::setKillLocation | ( | ) |
Definition at line 357 of file DebugProgramInstruction.cpp.
References llvm::PoisonValue::get(), llvm::SmallPtrSetImpl< PtrType >::insert(), location_ops(), Poison, and replaceVariableLocationOp().
Referenced by migrateDebugInfo().
|
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 475 of file DebugProgramInstruction.h.
References assert().
Referenced by addVariableLocationOps(), replaceVariableLocationOp(), and restorePreTransformState().
|
inline |
Definition at line 454 of file DebugProgramInstruction.h.
Referenced by fixupDebugInfoPostExtraction().
|
friend |
Definition at line 278 of file DebugProgramInstruction.h.
DbgRecordParamRef<DIExpression> llvm::DbgVariableRecord::AddressExpression |
Definition at line 301 of file DebugProgramInstruction.h.
Referenced by createDVRAssign(), createLinkedDVRAssign(), and createUnresolvedDbgVariableRecord().
DbgRecordParamRef<DIExpression> llvm::DbgVariableRecord::Expression |
Definition at line 300 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 293 of file DebugProgramInstruction.h.
DbgRecordParamRef<DILocalVariable> llvm::DbgVariableRecord::Variable |
Definition at line 299 of file DebugProgramInstruction.h.
Referenced by createDVRAssign(), createLinkedDVRAssign(), createUnresolvedDbgVariableRecord(), and remarkAlloca().