LLVM 22.0.0git
llvm::at Namespace Reference

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...
struct  VarRecord
 Helper struct for trackAssignments, below. More...

Typedefs

using AssignmentInstRange
 A range of instructions.
using StorageToVarsMap
 Map of backing storage to a set of variables that are stored to it.

Functions

LLVM_ABI AssignmentInstRange getAssignmentInsts (DIAssignID *ID)
 Return a range of instructions (typically just one) that have ID as an attachment.
AssignmentInstRange getAssignmentInsts (const DbgVariableRecord *DVR)
SmallVector< DbgVariableRecord * > getDVRAssignmentMarkers (const Instruction *Inst)
 Return a range of dbg_assign records for which Inst performs the assignment they encode.
LLVM_ABI void deleteAssignmentMarkers (const Instruction *Inst)
 Delete the llvm.dbg.assign intrinsics linked to Inst.
LLVM_ABI void RAUW (DIAssignID *Old, DIAssignID *New)
 Replace all uses (and attachments) of Old with New.
LLVM_ABI void deleteAll (Function *F)
 Remove all Assignment Tracking related intrinsics and metadata from F.
LLVM_ABI bool calculateFragmentIntersect (const DataLayout &DL, const Value *Dest, uint64_t SliceOffsetInBits, uint64_t SliceSizeInBits, const DbgVariableRecord *DVRAssign, std::optional< DIExpression::FragmentInfo > &Result)
 Calculate the fragment of the variable in DAI covered from (Dest + SliceOffsetInBits) to to (Dest + SliceOffsetInBits + SliceSizeInBits)
LLVM_ABI void remapAssignID (DenseMap< DIAssignID *, DIAssignID * > &Map, Instruction &I)
 Replace DIAssignID uses and attachments with IDs from Map.
LLVM_ABI 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.
LLVM_ABI std::optional< AssignmentInfogetAssignmentInfo (const DataLayout &DL, const MemIntrinsic *I)
LLVM_ABI std::optional< AssignmentInfogetAssignmentInfo (const DataLayout &DL, const StoreInst *SI)
LLVM_ABI std::optional< AssignmentInfogetAssignmentInfo (const DataLayout &DL, const AllocaInst *AI)

Detailed Description

Assignment Tracking (at).

Typedef Documentation

◆ AssignmentInstRange

Initial value:

A range of instructions.

Definition at line 184 of file DebugInfo.h.

◆ StorageToVarsMap

Initial value:

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 284 of file DebugInfo.h.

Function Documentation

◆ calculateFragmentIntersect()

bool llvm::at::calculateFragmentIntersect ( const DataLayout & DL,
const Value * Dest,
uint64_t SliceOffsetInBits,
uint64_t SliceSizeInBits,
const DbgVariableRecord * DVRAssign,
std::optional< DIExpression::FragmentInfo > & Result )

Calculate the fragment of the variable in DAI covered from (Dest + SliceOffsetInBits) to to (Dest + SliceOffsetInBits + SliceSizeInBits)

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 1932 of file DebugInfo.cpp.

References llvm::DIExpression::calculateFragmentIntersect(), DL, llvm::DIExpression::extractLeadingOffset(), llvm::DbgVariableRecord::getAddress(), llvm::DbgVariableRecord::getAddressExpression(), llvm::DbgVariableRecord::getFragmentOrEntireVariable(), and llvm::DbgVariableRecord::isKillAddress().

Referenced by buildOverlapMapAndRecordDeclares(), and shortenAssignment().

◆ deleteAll()

void llvm::at::deleteAll ( Function * F)

Remove all Assignment Tracking related intrinsics and metadata from F.

Definition at line 1919 of file DebugInfo.cpp.

References F, llvm::filterDbgVars(), I, and llvm::make_early_inc_range().

◆ deleteAssignmentMarkers()

void llvm::at::deleteAssignmentMarkers ( const Instruction * Inst)

Delete the llvm.dbg.assign intrinsics linked to Inst.

Definition at line 1901 of file DebugInfo.cpp.

References getDVRAssignmentMarkers().

Referenced by hoistConditionalLoadsStores(), promoteSingleBlockAlloca(), and rewriteSingleStoreAlloca().

◆ getAssignmentInfo() [1/3]

std::optional< AssignmentInfo > llvm::at::getAssignmentInfo ( const DataLayout & DL,
const AllocaInst * AI )

Definition at line 2027 of file DebugInfo.cpp.

References DL, llvm::AllocaInst::getAllocatedType(), and getAssignmentInfoImpl().

◆ getAssignmentInfo() [2/3]

std::optional< AssignmentInfo > llvm::at::getAssignmentInfo ( const DataLayout & DL,
const MemIntrinsic * I )

◆ getAssignmentInfo() [3/3]

std::optional< AssignmentInfo > llvm::at::getAssignmentInfo ( const DataLayout & DL,
const StoreInst * SI )

Definition at line 2021 of file DebugInfo.cpp.

References DL, and getAssignmentInfoImpl().

◆ getAssignmentInsts() [1/2]

◆ getAssignmentInsts() [2/2]

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 1889 of file DebugInfo.cpp.

References assert(), and llvm::make_range().

Referenced by getAssignmentInsts(), RAUW(), removeRedundantDbgInstrsUsingBackwardScan(), removeRedundantDbgInstrsUsingForwardScan(), and removeUndefDbgAssignsFromEntryBlock().

◆ getDVRAssignmentMarkers()

SmallVector< DbgVariableRecord * > llvm::at::getDVRAssignmentMarkers ( const Instruction * Inst)
inline

Return a range of dbg_assign records for which Inst performs the assignment they encode.

Definition at line 201 of file DebugInfo.h.

References llvm::cast(), and llvm::Instruction::getMetadata().

Referenced by buildOverlapMapAndRecordDeclares(), collectEscapedLocals(), deleteAssignmentMarkers(), findVarsWithStackSlot(), migrateDebugInfo(), shortenAssignment(), and llvm::InstCombinerImpl::SimplifyAnyMemSet().

◆ RAUW()

void llvm::at::RAUW ( DIAssignID * Old,
DIAssignID * New )

◆ remapAssignID()

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 1966 of file DebugInfo.cpp.

References llvm::cast(), llvm::filterDbgVars(), llvm::MDNode::getContext(), llvm::DIAssignID::getDistinct(), and I.

Referenced by fixupAssignments(), and fixupDebugInfoPostExtraction().

◆ trackAssignments()

void llvm::at::trackAssignments ( Function::iterator Start,
Function::iterator End,
const StorageToVarsMap & Vars,
const DataLayout & DL,
bool DebugPrints = false )