LLVM 17.0.0git
Classes | Typedefs | Functions
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...
 
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 *, SmallSet< 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.
 
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.
 
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.
 
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< AssignmentInfogetAssignmentInfo (const DataLayout &DL, const MemIntrinsic *I)
 
std::optional< AssignmentInfogetAssignmentInfo (const DataLayout &DL, const StoreInst *SI)
 
std::optional< AssignmentInfogetAssignmentInfo (const DataLayout &DL, const AllocaInst *AI)
 

Detailed Description

Assignment Tracking (at).

Typedef Documentation

◆ AssignmentInstRange

A range of instructions.

Definition at line 176 of file DebugInfo.h.

◆ AssignmentMarkerRange

A range of llvm.dbg.assign intrinsics.

Definition at line 209 of file DebugInfo.h.

◆ StorageToVarsMap

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

Function Documentation

◆ deleteAll()

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

Remove all Assignment Tracking related intrinsics and metadata from F.

Definition at line 1791 of file DebugInfo.cpp.

References F, I, and llvm::SmallVectorTemplateBase< T, bool >::push_back().

◆ deleteAssignmentMarkers()

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

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

Definition at line 1764 of file DebugInfo.cpp.

References getAssignmentMarkers().

Referenced by promoteSingleBlockAlloca(), and rewriteSingleStoreAlloca().

◆ getAssignmentInfo() [1/3]

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

Definition at line 1841 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 
)

Definition at line 1822 of file DebugInfo.cpp.

References DL, getAssignmentInfoImpl(), and I.

Referenced by getUntaggedStoreAssignmentInfo(), and trackAssignments().

◆ getAssignmentInfo() [3/3]

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

Definition at line 1834 of file DebugInfo.cpp.

References DL, getAssignmentInfoImpl(), and SI.

◆ getAssignmentInsts() [1/2]

AssignmentInstRange llvm::at::getAssignmentInsts ( const DbgAssignIntrinsic DAI)
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 187 of file DebugInfo.h.

References llvm::DbgAssignIntrinsic::getAssignID(), and getAssignmentInsts().

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

References assert(), llvm::LLVMContextImpl::AssignmentIDToInstrs, llvm::make_range(), and llvm::LLVMContext::pImpl.

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

◆ getAssignmentMarkers() [1/2]

AssignmentMarkerRange llvm::at::getAssignmentMarkers ( const Instruction Inst)
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 216 of file DebugInfo.h.

References getAssignmentMarkers(), llvm::Instruction::getMetadata(), and llvm::make_range().

◆ getAssignmentMarkers() [2/2]

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

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

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

◆ RAUW()

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

◆ trackAssignments()

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