16#ifndef LLVM_IR_DEBUGINFO_H
17#define LLVM_IR_DEBUGINFO_H
36class DbgVariableIntrinsic;
37class DbgVariableRecord;
51 SmallVectorImpl<DbgValueInst *> &DbgValues, Value *V,
52 SmallVectorImpl<DbgVariableRecord *> *DbgVariableRecords =
nullptr);
56 SmallVectorImpl<DbgVariableIntrinsic *> &DbgInsts, Value *V,
57 SmallVectorImpl<DbgVariableRecord *> *DbgVariableRecords =
nullptr);
128 void processScope(
DIScope *Scope);
129 void processType(
DIType *DT);
162 return make_range(Scopes.begin(), Scopes.end());
203 "Can't get assignment instructions for non-assign DVR!");
215 typename std::iterator_traits<
216 Value::user_iterator>::iterator_category,
217 DbgAssignIntrinsic *, std::ptrdiff_t,
218 DbgAssignIntrinsic **,
219 DbgAssignIntrinsic *&> {
233 if (
auto *
ID = Inst->
getMetadata(LLVMContext::MD_DIAssignID))
241 if (
auto *
ID = Inst->
getMetadata(LLVMContext::MD_DIAssignID))
242 return cast<DIAssignID>(
ID)->getAllDbgVariableRecordUsers();
267 std::optional<DIExpression::FragmentInfo> &Result);
271 std::optional<DIExpression::FragmentInfo> &Result);
293 return std::tie(
LHS.Var,
LHS.DL) < std::tie(
RHS.Var,
RHS.DL);
296 return std::tie(
LHS.Var,
LHS.DL) == std::tie(
RHS.Var,
RHS.DL);
334 bool DebugPrints =
false);
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file defines DenseMapInfo traits for DenseMap.
This header defines various interfaces for pass management in LLVM.
Machine Check Debug Module
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements a set that has insertion order iteration characteristics.
This file defines the SmallPtrSet class.
This file defines the SmallSet class.
This file defines the SmallVector class.
an instruction to allocate memory on the stack
A container for analyses that lazily runs them and caches their results.
Convert @llvm.dbg.declare intrinsics into sets of @llvm.dbg.assign intrinsics by treating stores to t...
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
A pair of DIGlobalVariable and DIExpression.
Base class for scope-like contexts.
A parsed version of the target data layout string in and methods for querying it.
This represents the llvm.dbg.assign instruction.
DIAssignID * getAssignID() const
Base class for non-instruction debug metadata records that have positions within IR.
This is the common base class for debug info intrinsics for variables.
Record of a variable value-assignment, aka a non instruction representation of the dbg....
DIAssignID * getAssignID() const
Utility to find all debug info in a module.
void processInstruction(const Module &M, const Instruction &I)
Process a single instruction and collect debug info anchors.
unsigned subprogram_count() const
void processModule(const Module &M)
Process entire module and collect debug info anchors.
SmallVectorImpl< DICompileUnit * >::const_iterator compile_unit_iterator
void processVariable(const Module &M, const DILocalVariable *DVI)
Process a DILocalVariable.
unsigned type_count() const
void processSubprogram(DISubprogram *SP)
Process subprogram.
void processLocation(const Module &M, const DILocation *Loc)
Process debug info location.
SmallVectorImpl< DIGlobalVariableExpression * >::const_iterator global_variable_expression_iterator
void reset()
Clear all lists.
SmallVectorImpl< DIScope * >::const_iterator scope_iterator
unsigned global_variable_count() const
iterator_range< global_variable_expression_iterator > global_variables() const
iterator_range< subprogram_iterator > subprograms() const
SmallVectorImpl< DIType * >::const_iterator type_iterator
SmallVectorImpl< DISubprogram * >::const_iterator subprogram_iterator
iterator_range< type_iterator > types() const
iterator_range< scope_iterator > scopes() const
unsigned compile_unit_count() const
iterator_range< compile_unit_iterator > compile_units() const
void processDbgRecord(const Module &M, const DbgRecord &DR)
Process a DbgRecord (e.g, treat a DbgVariableRecord like a DbgVariableIntrinsic).
unsigned scope_count() const
BasicBlockListType::iterator iterator
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
This is the common base class for memset/memcpy/memmove.
A Module instance is used to store all the information related to an LLVM module.
A set of analyses that are preserved following a run of a transformation pass.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
typename SuperClass::const_iterator const_iterator
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An instruction for storing to memory.
LLVM Value Representation.
user_iterator_impl< User > user_iterator
High level: this is an iterator for llvm.dbg.assign intrinsics.
DbgAssignIt(Value::user_iterator It)
DbgAssignIntrinsic * operator*() const
CRTP base class for adapting an iterator to a different type.
A range adaptor for a pair of iterators.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
void deleteAll(Function *F)
Remove all Assignment Tracking related intrinsics and metadata from F.
AssignmentInstRange getAssignmentInsts(DIAssignID *ID)
Return a range of instructions (typically just one) that have ID as an attachment.
AssignmentMarkerRange getAssignmentMarkers(DIAssignID *ID)
Return a range of dbg.assign intrinsics which use \ID as an operand.
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.
void remapAssignID(DenseMap< DIAssignID *, DIAssignID * > &Map, Instruction &I)
Replace DIAssignID uses and attachments with IDs from Map.
SmallVector< DbgVariableRecord * > getDVRAssignmentMarkers(const Instruction *Inst)
void deleteAssignmentMarkers(const Instruction *Inst)
Delete the llvm.dbg.assign intrinsics linked to Inst.
std::optional< AssignmentInfo > getAssignmentInfo(const DataLayout &DL, const MemIntrinsic *I)
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 + S...
void RAUW(DIAssignID *Old, DIAssignID *New)
Replace all uses (and attachments) of Old with New.
This is an optimization pass for GlobalISel generic memory operations.
TinyPtrVector< DbgDeclareInst * > findDbgDeclares(Value *V)
Finds dbg.declare intrinsics declaring local variables as living in the memory that 'V' points to.
bool stripDebugInfo(Function &F)
void findDbgUsers(SmallVectorImpl< DbgVariableIntrinsic * > &DbgInsts, Value *V, SmallVectorImpl< DbgVariableRecord * > *DbgVariableRecords=nullptr)
Finds the debug info intrinsics describing a value.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
void findDbgValues(SmallVectorImpl< DbgValueInst * > &DbgValues, Value *V, SmallVectorImpl< DbgVariableRecord * > *DbgVariableRecords=nullptr)
Finds the llvm.dbg.value intrinsics describing a value.
bool stripNonLineTableDebugInfo(Module &M)
Downgrade the debug info in a module to contain only line table information.
DebugLoc getDebugValueLoc(DbgVariableIntrinsic *DII)
Produce a DebugLoc to use for each dbg.declare that is promoted to a dbg.value.
TinyPtrVector< DbgVariableRecord * > findDVRValues(Value *V)
As above, for DVRValues.
unsigned getDebugMetadataVersionFromModule(const Module &M)
Return Debug Info Metadata Version by checking module flags.
bool StripDebugInfo(Module &M)
Strip debug info in the module if it exists.
bool isAssignmentTrackingEnabled(const Module &M)
Return true if assignment tracking is enabled for module M.
TinyPtrVector< DbgVariableRecord * > findDVRDeclares(Value *V)
As above, for DVRDeclares.
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
void updateLoopMetadataDebugLocations(Instruction &I, function_ref< Metadata *(Metadata *)> Updater)
Update the debug locations contained within the MD_loop metadata attached to the instruction I,...
DISubprogram * getDISubprogram(const MDNode *Scope)
Find subprogram that is enclosing this scope.
static bool isEqual(const at::VarRecord &A, const at::VarRecord &B)
static at::VarRecord getEmptyKey()
static unsigned getHashValue(const at::VarRecord &Var)
static at::VarRecord getTombstoneKey()
An information struct used to provide DenseMap with the various necessary components for a given valu...
A CRTP mix-in to automatically provide informational APIs needed for passes.
Describes properties of a store that has a static size and offset into a some base storage.
AssignmentInfo(const DataLayout &DL, AllocaInst const *Base, uint64_t OffsetInBits, uint64_t SizeInBits)
uint64_t OffsetInBits
Offset into Base.
uint64_t SizeInBits
Number of bits stored.
AllocaInst const * Base
Base storage.
bool StoreToWholeAlloca
SizeInBits equals the size of the base storage.
Helper struct for trackAssignments, below.
VarRecord(DbgVariableRecord *DVR)
VarRecord(DbgVariableIntrinsic *DVI)
friend bool operator==(const VarRecord &LHS, const VarRecord &RHS)
friend bool operator<(const VarRecord &LHS, const VarRecord &RHS)
VarRecord(DILocalVariable *Var, DILocation *DL)