LLVM 20.0.0git
|
Assignment Tracking (at). More...
Classes | |
struct | AssignmentInfo |
Describes properties of a store that has a static size and offset into a some base storage. More... | |
class | DbgAssignIt |
High level: this is an iterator for llvm.dbg.assign intrinsics. More... | |
struct | VarRecord |
Helper struct for trackAssignments, below. More... | |
Typedefs | |
using | AssignmentInstRange = iterator_range< SmallVectorImpl< Instruction * >::iterator > |
A range of instructions. | |
using | AssignmentMarkerRange = iterator_range< DbgAssignIt > |
A range of llvm.dbg.assign intrinsics. | |
using | StorageToVarsMap = DenseMap< const AllocaInst *, SmallSetVector< VarRecord, 2 > > |
Map of backing storage to a set of variables that are stored to it. | |
Functions | |
AssignmentInstRange | getAssignmentInsts (DIAssignID *ID) |
Return a range of instructions (typically just one) that have ID as an attachment. | |
AssignmentInstRange | getAssignmentInsts (const DbgAssignIntrinsic *DAI) |
Return a range of instructions (typically just one) that perform the assignment that DAI encodes. | |
AssignmentInstRange | getAssignmentInsts (const DbgVariableRecord *DVR) |
AssignmentMarkerRange | getAssignmentMarkers (DIAssignID *ID) |
Return a range of dbg.assign intrinsics which use \ID as an operand. | |
AssignmentMarkerRange | getAssignmentMarkers (const Instruction *Inst) |
Return a range of dbg.assign intrinsics for which Inst performs the assignment they encode. | |
SmallVector< DbgVariableRecord * > | getDVRAssignmentMarkers (const Instruction *Inst) |
void | deleteAssignmentMarkers (const Instruction *Inst) |
Delete the llvm.dbg.assign intrinsics linked to Inst . | |
void | RAUW (DIAssignID *Old, DIAssignID *New) |
Replace all uses (and attachments) of Old with New . | |
void | deleteAll (Function *F) |
Remove all Assignment Tracking related intrinsics and metadata from F . | |
bool | calculateFragmentIntersect (const DataLayout &DL, const Value *Dest, uint64_t SliceOffsetInBits, uint64_t SliceSizeInBits, const DbgAssignIntrinsic *DbgAssign, std::optional< DIExpression::FragmentInfo > &Result) |
Calculate the fragment of the variable in DAI covered from (Dest + SliceOffsetInBits) to to (Dest + SliceOffsetInBits + SliceSizeInBits) | |
bool | calculateFragmentIntersect (const DataLayout &DL, const Value *Dest, uint64_t SliceOffsetInBits, uint64_t SliceSizeInBits, const DbgVariableRecord *DVRAssign, std::optional< DIExpression::FragmentInfo > &Result) |
FIXME: Remove this wrapper function and call DIExpression::calculateFragmentIntersect directly. | |
void | remapAssignID (DenseMap< DIAssignID *, DIAssignID * > &Map, Instruction &I) |
Replace DIAssignID uses and attachments with IDs from Map . | |
void | trackAssignments (Function::iterator Start, Function::iterator End, const StorageToVarsMap &Vars, const DataLayout &DL, bool DebugPrints=false) |
Track assignments to Vars between Start and End . | |
std::optional< AssignmentInfo > | getAssignmentInfo (const DataLayout &DL, const MemIntrinsic *I) |
std::optional< AssignmentInfo > | getAssignmentInfo (const DataLayout &DL, const StoreInst *SI) |
std::optional< AssignmentInfo > | getAssignmentInfo (const DataLayout &DL, const AllocaInst *AI) |
Assignment Tracking (at).
using llvm::at::AssignmentInstRange = typedef iterator_range<SmallVectorImpl<Instruction *>::iterator> |
A range of instructions.
Definition at line 186 of file DebugInfo.h.
using llvm::at::AssignmentMarkerRange = typedef iterator_range<DbgAssignIt> |
A range of llvm.dbg.assign intrinsics.
Definition at line 225 of file DebugInfo.h.
using llvm::at::StorageToVarsMap = typedef DenseMap<const AllocaInst *, SmallSetVector<VarRecord, 2> > |
Map of backing storage to a set of variables that are stored to it.
TODO: Backing storage shouldn't be limited to allocas only. Some local variables have their storage allocated by the calling function (addresses passed in with sret & byval parameters).
Definition at line 327 of file DebugInfo.h.
bool llvm::at::calculateFragmentIntersect | ( | const DataLayout & | DL, |
const Value * | Dest, | ||
uint64_t | SliceOffsetInBits, | ||
uint64_t | SliceSizeInBits, | ||
const DbgAssignIntrinsic * | DbgAssign, | ||
std::optional< DIExpression::FragmentInfo > & | Result | ||
) |
Calculate the fragment of the variable in DAI
covered from (Dest + SliceOffsetInBits) to to (Dest + SliceOffsetInBits + SliceSizeInBits)
FIXME: Remove this wrapper function and call DIExpression::calculateFragmentIntersect directly.
Return false if it can't be calculated for any reason. Result is set to nullopt if the intersect equals the variable fragment (or variable size) in DAI.
Result contains a zero-sized fragment if there's no intersect.
Definition at line 1961 of file DebugInfo.cpp.
References calculateFragmentIntersectImpl(), and DL.
Referenced by buildOverlapMapAndRecordDeclares(), and shortenAssignment().
bool llvm::at::calculateFragmentIntersect | ( | const DataLayout & | DL, |
const Value * | Dest, | ||
uint64_t | SliceOffsetInBits, | ||
uint64_t | SliceSizeInBits, | ||
const DbgVariableRecord * | DVRAssign, | ||
std::optional< DIExpression::FragmentInfo > & | Result | ||
) |
FIXME: Remove this wrapper function and call DIExpression::calculateFragmentIntersect directly.
Definition at line 1971 of file DebugInfo.cpp.
References calculateFragmentIntersectImpl(), and DL.
void llvm::at::deleteAll | ( | Function * | F | ) |
Remove all Assignment Tracking related intrinsics and metadata from F
.
Definition at line 1905 of file DebugInfo.cpp.
References F, llvm::filterDbgVars(), I, and llvm::SmallVectorTemplateBase< T, bool >::push_back().
void llvm::at::deleteAssignmentMarkers | ( | const Instruction * | Inst | ) |
Delete the llvm.dbg.assign intrinsics linked to Inst
.
Definition at line 1880 of file DebugInfo.cpp.
References llvm::SmallVectorBase< Size_T >::empty(), getAssignmentMarkers(), getDVRAssignmentMarkers(), and Range.
Referenced by hoistConditionalLoadsStores(), promoteSingleBlockAlloca(), and rewriteSingleStoreAlloca().
std::optional< AssignmentInfo > llvm::at::getAssignmentInfo | ( | const DataLayout & | DL, |
const AllocaInst * | AI | ||
) |
Definition at line 2045 of file DebugInfo.cpp.
References DL, llvm::AllocaInst::getAllocatedType(), and getAssignmentInfoImpl().
std::optional< AssignmentInfo > llvm::at::getAssignmentInfo | ( | const DataLayout & | DL, |
const MemIntrinsic * | I | ||
) |
Definition at line 2027 of file DebugInfo.cpp.
References DL, getAssignmentInfoImpl(), llvm::TypeSize::getFixed(), and I.
Referenced by getUntaggedStoreAssignmentInfo(), and trackAssignments().
std::optional< AssignmentInfo > llvm::at::getAssignmentInfo | ( | const DataLayout & | DL, |
const StoreInst * | SI | ||
) |
Definition at line 2039 of file DebugInfo.cpp.
References DL, and getAssignmentInfoImpl().
|
inline |
Return a range of instructions (typically just one) that perform the assignment that DAI
encodes.
Iterators invalidated by adding or removing DIAssignID metadata to/from any instruction (including by deleting or cloning instructions).
Definition at line 197 of file DebugInfo.h.
References llvm::DbgAssignIntrinsic::getAssignID(), and getAssignmentInsts().
|
inline |
Definition at line 201 of file DebugInfo.h.
References assert(), llvm::DbgVariableRecord::getAssignID(), getAssignmentInsts(), and llvm::DbgVariableRecord::isDbgAssign().
AssignmentInstRange llvm::at::getAssignmentInsts | ( | DIAssignID * | ID | ) |
Return a range of instructions (typically just one) that have ID
as an attachment.
Iterators invalidated by adding or removing DIAssignID metadata to/from any instruction (including by deleting or cloning instructions).
Definition at line 1854 of file DebugInfo.cpp.
References assert(), llvm::LLVMContextImpl::AssignmentIDToInstrs, llvm::make_range(), and llvm::LLVMContext::pImpl.
Referenced by DbgVariableRecordsRemoveRedundantDbgInstrsUsingBackwardScan(), DbgVariableRecordsRemoveRedundantDbgInstrsUsingForwardScan(), DbgVariableRecordsRemoveUndefDbgAssignsFromEntryBlock(), getAssignmentInsts(), RAUW(), removeRedundantDbgInstrsUsingBackwardScan(), removeRedundantDbgInstrsUsingForwardScan(), and removeUndefDbgAssignsFromEntryBlock().
|
inline |
Return a range of dbg.assign intrinsics for which Inst
performs the assignment they encode.
Iterators invalidated by deleting an intrinsic contained in this range.
Definition at line 232 of file DebugInfo.h.
References getAssignmentMarkers(), llvm::Instruction::getMetadata(), and llvm::make_range().
AssignmentMarkerRange llvm::at::getAssignmentMarkers | ( | DIAssignID * | ID | ) |
Return a range of dbg.assign intrinsics which use \ID as an operand.
Iterators invalidated by deleting an intrinsic contained in this range.
Definition at line 1866 of file DebugInfo.cpp.
References assert(), llvm::MetadataAsValue::getIfExists(), and llvm::make_range().
Referenced by buildOverlapMapAndRecordDeclares(), collectEscapedLocals(), deleteAssignmentMarkers(), findVarsWithStackSlot(), getAssignmentMarkers(), migrateDebugInfo(), shortenAssignment(), and llvm::InstCombinerImpl::SimplifyAnyMemSet().
|
inline |
Definition at line 240 of file DebugInfo.h.
References llvm::Instruction::getMetadata().
Referenced by buildOverlapMapAndRecordDeclares(), collectEscapedLocals(), deleteAssignmentMarkers(), findVarsWithStackSlot(), migrateDebugInfo(), shortenAssignment(), and llvm::InstCombinerImpl::SimplifyAnyMemSet().
void llvm::at::RAUW | ( | DIAssignID * | Old, |
DIAssignID * | New | ||
) |
Replace all uses (and attachments) of Old
with New
.
Definition at line 1892 of file DebugInfo.cpp.
References llvm::iterator_range< IteratorT >::begin(), llvm::iterator_range< IteratorT >::end(), getAssignmentInsts(), I, and llvm::MDNode::replaceAllUsesWith().
Referenced by llvm::Instruction::mergeDIAssignID().
void llvm::at::remapAssignID | ( | DenseMap< DIAssignID *, DIAssignID * > & | Map, |
Instruction & | I | ||
) |
Replace DIAssignID uses and attachments with IDs from Map
.
Update inlined instructions' DIAssignID metadata.
If an ID is unmapped a new ID is generated and added to Map
.
We need to do this otherwise a function inlined more than once into the same function will cause DIAssignID to be shared by many instructions.
Definition at line 1982 of file DebugInfo.cpp.
References llvm::filterDbgVars(), llvm::MDNode::getContext(), llvm::DIAssignID::getDistinct(), and I.
Referenced by fixupAssignments(), and fixupDebugInfoPostExtraction().
void llvm::at::trackAssignments | ( | Function::iterator | Start, |
Function::iterator | End, | ||
const StorageToVarsMap & | Vars, | ||
const DataLayout & | DL, | ||
bool | DebugPrints = false |
||
) |
Track assignments to Vars
between Start
and End
.
Definition at line 2112 of file DebugInfo.cpp.
References assert(), DL, emitDbgAssign(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), End, llvm::errs(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::UndefValue::get(), getAssignmentInfo(), llvm::DIAssignID::getDistinct(), llvm::Type::getInt1Ty(), I, Info, LLVM_DEBUG, and MI.
Referenced by trackInlinedStores().