LLVM: include/llvm/IR/DebugProgramInstruction.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47#ifndef LLVM_IR_DEBUGPROGRAMINSTRUCTION_H
48#define LLVM_IR_DEBUGPROGRAMINSTRUCTION_H
49
59
60namespace llvm {
61
73
74
75
76
79
80public:
81public:
83
84
86
87
88
89
90
91
92
94
95
96
97
98
100 operator T *() const { return get(); }
103
104
105
106
107
108 explicit operator bool() const { return Ref; }
109
110
112
114 return Ref == Other.Ref;
115 }
117 return Ref != Other.Ref;
118 }
119};
120
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
140public:
141
143
145
146protected:
149
150public:
153
154
155
156
157 LLVM_ABI void deleteRecord();
161 bool IsForDebug) const;
162 LLVM_ABI bool isIdenticalToWhenDefined(const DbgRecord &R) const;
163
164
165
167 createDebugIntrinsic(Module *M, Instruction *InsertBefore) const;
168
169
170
172
174
176
179
182
185
188
191
195
196 LLVM_ABI void removeFromParent();
197 LLVM_ABI void eraseFromParent();
198
201
202
203
208
209 LLVM_ABI void insertBefore(self_iterator InsertBefore);
210 LLVM_ABI void insertAfter(self_iterator InsertAfter);
211 LLVM_ABI void moveBefore(self_iterator MoveBefore);
212 LLVM_ABI void moveAfter(self_iterator MoveAfter);
213
216
218
221
222protected:
223
224
225
226
228};
229
231 R.print(OS);
232 return OS;
233}
234
235
236
239
240
241
242
244
245public:
247
248
249
250
251
254
258 bool IsForDebug) const;
261
265
266
270};
271
272
273
274
275
276
279
280public:
290
291
292
293
295
296
297
298
299
303
304public:
305
306
309
310
318
319private:
320
321
322
323
327
328public:
329
330
331
332
333
334
335
341
352
367
374
375
376
377
380 std::bidirectional_iterator_tag, Value *> {
382
383 public:
386
389 I = R.I;
390 return *this;
391 }
393 return I == RHS.I;
394 }
409 I = VAM + 1;
410 else
412 return *this;
413 }
416 I = VAM - 1;
417 else
419 return *this;
420 }
421 };
422
426
427
428
429
431
433
434 LLVM_ABI void replaceVariableLocationOp(Value *OldValue, Value *NewValue,
435 bool AllowEmpty = false);
436 LLVM_ABI void replaceVariableLocationOp(unsigned OpIdx, Value *NewValue);
437
438
439
442
443 LLVM_ABI unsigned getNumVariableLocationOps() const;
444
446
447
449
450
451
452
454
455
456
457
461
463
464 LLVM_ABI void setKillLocation();
465 LLVM_ABI bool isKillLocation() const;
466
470
474
475
476
477
478
480
484
485
486
487
491 "Location for a DbgVariableRecord must be either ValueAsMetadata or "
492 "DIArgList");
494 }
495
496 LLVM_ABI std::optional getFragment() const;
497
498
499
502 return *Frag;
504 return {*Sz, 0};
505 return {0, 0};
506 }
507
508
509 LLVM_ABI std::optional<uint64_t> getFragmentSizeInBits() const;
510
514
515
520 Other.Expression, Other.AddressExpression);
521 }
522
523
524
526
542
543 LLVM_ABI void setKillAddress();
544
545
546
547
549
550
551
553
554
555
557 createDebugIntrinsic(Module *M, Instruction *InsertBefore) const;
558
559
560
562
565 bool IsForDebug) const;
566
567
571};
572
573
574static inline auto
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
604public:
606
607
609
610
611
612
613
616
619
620
621
622
625
628
629
632 bool IsForDebug) const;
633
634
639
640
641
643
644
645
648 DbgMarker &Src, bool InsertAtHead);
649
650
652
654
656
657
658
659
660
661
662
663
667 bool InsertAtHead = false);
668
670
671
672
674
675
676
677
678
679
680
681
688};
689
691 Marker.print(OS);
692 return OS;
693}
694
695
696
697
698
699inline iterator_range<simple_ilist::iterator>
701 if (!DebugMarker)
704}
705
707
708}
709
710#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static const Function * getParent(const Value *V)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define DEFINE_ISA_CONVERSION_FUNCTIONS(ty, ref)
#define LLVM_TEMPLATE_ABI
MachineInstr unsigned OpIdx
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
bool isKillAddress(const DbgVariableRecord *DVR)
static SymbolRef::Type getType(const Symbol *Sym)
static Function * getFunction(FunctionType *Ty, const Twine &Name, Module *M)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
This is the common base class for debug info intrinsics.
This represents the llvm.dbg.label instruction.
MDNode * getRawLabel() const
Definition DebugProgramInstruction.h:264
LLVM_ABI DbgLabelInst * createDebugIntrinsic(Module *M, Instruction *InsertBefore) const
static bool classof(const DbgRecord *E)
Support type inquiry through isa, cast, and dyn_cast.
Definition DebugProgramInstruction.h:267
void setLabel(DILabel *NewLabel)
Definition DebugProgramInstruction.h:262
LLVM_ABI DbgLabelRecord * clone() const
static LLVM_ABI DbgLabelRecord * createUnresolvedDbgLabelRecord(MDNode *Label, MDNode *DL)
For use during parsing; creates a DbgLabelRecord from as-of-yet unresolved MDNodes.
DILabel * getLabel() const
Definition DebugProgramInstruction.h:263
Per-instruction record of debug-info.
Definition DebugProgramInstruction.h:603
static iterator_range< simple_ilist< DbgRecord >::iterator > getEmptyDbgRecordRange()
Definition DebugProgramInstruction.h:684
LLVM_ABI void insertDbgRecordAfter(DbgRecord *New, DbgRecord *InsertAfter)
Insert a DbgRecord after a DbgRecord contained within this marker.
LLVM_ABI void removeFromParent()
LLVM_ABI void dump() const
LLVM_ABI void dropOneDbgRecord(DbgRecord *DR)
Erase a single DbgRecord from this marker.
Instruction * MarkedInstr
Link back to the Instruction that owns this marker.
Definition DebugProgramInstruction.h:608
LLVM_ABI void eraseFromParent()
static LLVM_ABI DbgMarker EmptyDbgMarker
We generally act like all llvm Instructions have a range of DbgRecords attached to them,...
Definition DebugProgramInstruction.h:682
LLVM_ABI iterator_range< simple_ilist< DbgRecord >::iterator > getDbgRecordRange()
Produce a range over all the DbgRecords in this Marker.
LLVM_ABI void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on DbgMarker.
LLVM_ABI const BasicBlock * getParent() const
LLVM_ABI iterator_range< simple_ilist< DbgRecord >::iterator > cloneDebugInfoFrom(DbgMarker *From, std::optional< simple_ilist< DbgRecord >::iterator > FromHere, bool InsertAtHead=false)
Clone all DbgMarkers from From into this marker.
LLVM_ABI void insertDbgRecord(DbgRecord *New, bool InsertAtHead)
Insert a DbgRecord into this DbgMarker, at the end of the list.
simple_ilist< DbgRecord > StoredDbgRecords
List of DbgRecords, the non-instruction equivalent of llvm.dbg.
Definition DebugProgramInstruction.h:614
bool empty() const
Definition DebugProgramInstruction.h:615
LLVM_ABI void absorbDebugValues(DbgMarker &Src, bool InsertAtHead)
Transfer any DbgRecords from Src into this DbgMarker.
LLVM_ABI void removeMarker()
Handle the removal of a marker: the position of debug-info has gone away, but the stored debug record...
LLVM_ABI void dropDbgRecords()
Erase all DbgRecords in this DbgMarker.
A typed tracking MDNode reference that does not require a definition for its parameter type.
Definition DebugProgramInstruction.h:77
T & operator*() const
Definition DebugProgramInstruction.h:102
T * get() const
Get the underlying type.
bool operator!=(const DbgRecordParamRef &Other) const
Definition DebugProgramInstruction.h:116
DbgRecordParamRef()=default
T * operator->() const
Definition DebugProgramInstruction.h:101
MDNode * getAsMDNode() const
Return this as a MDNode.
Definition DebugProgramInstruction.h:111
bool operator==(const DbgRecordParamRef &Other) const
Definition DebugProgramInstruction.h:113
Base class for non-instruction debug metadata records that have positions within IR.
Definition DebugProgramInstruction.h:139
DbgRecord(Kind RecordKind, DebugLoc DL)
Definition DebugProgramInstruction.h:151
simple_ilist< DbgRecord >::iterator self_iterator
Definition DebugProgramInstruction.h:219
DebugLoc getDebugLoc() const
Definition DebugProgramInstruction.h:214
Kind RecordKind
Subclass discriminator.
Definition DebugProgramInstruction.h:148
~DbgRecord()=default
Similarly to Value, we avoid paying the cost of a vtable by protecting the dtor and having deleteReco...
DebugLoc DbgLoc
Definition DebugProgramInstruction.h:147
DbgRecord * getNextNode()
Definition DebugProgramInstruction.h:199
simple_ilist< DbgRecord >::const_iterator const_self_iterator
Definition DebugProgramInstruction.h:220
Kind
Subclass discriminator.
Definition DebugProgramInstruction.h:144
@ ValueKind
Definition DebugProgramInstruction.h:144
@ LabelKind
Definition DebugProgramInstruction.h:144
void setDebugLoc(DebugLoc Loc)
Definition DebugProgramInstruction.h:215
DbgMarker * getMarker()
Definition DebugProgramInstruction.h:177
Kind getRecordKind() const
Definition DebugProgramInstruction.h:173
const DbgMarker * getMarker() const
Definition DebugProgramInstruction.h:178
DbgMarker * Marker
Marker that this DbgRecord is linked into.
Definition DebugProgramInstruction.h:142
void setMarker(DbgMarker *M)
Definition DebugProgramInstruction.h:175
DbgRecord * getPrevNode()
Definition DebugProgramInstruction.h:200
This is the common base class for debug info intrinsics for variables.
location_op_iterator(ValueAsMetadata **MultiIter)
Definition DebugProgramInstruction.h:385
location_op_iterator & operator--()
Definition DebugProgramInstruction.h:414
Value * operator*()
Definition DebugProgramInstruction.h:401
location_op_iterator(ValueAsMetadata *SingleIter)
Definition DebugProgramInstruction.h:384
bool operator==(const location_op_iterator &RHS) const
Definition DebugProgramInstruction.h:392
location_op_iterator & operator++()
Definition DebugProgramInstruction.h:407
location_op_iterator & operator=(const location_op_iterator &R)
Definition DebugProgramInstruction.h:388
const Value * operator*() const
Definition DebugProgramInstruction.h:395
location_op_iterator(const location_op_iterator &R)
Definition DebugProgramInstruction.h:387
Record of a variable value-assignment, aka a non instruction representation of the dbg....
Definition DebugProgramInstruction.h:277
LLVM_ABI std::optional< DbgVariableFragmentInfo > getFragment() const
bool isDbgValue() const
Definition DebugProgramInstruction.h:424
bool isEquivalentTo(const DbgVariableRecord &Other) const
Definition DebugProgramInstruction.h:511
LocationType getType() const
Definition DebugProgramInstruction.h:462
DbgRecordParamRef< DIExpression > Expression
Definition DebugProgramInstruction.h:301
bool isValueOfVariable() const
Determine if this describes the value of a local variable.
Definition DebugProgramInstruction.h:458
bool hasValidLocation() const
Returns true if this DbgVariableRecord has no empty MDNodes in its location list.
Definition DebugProgramInstruction.h:448
LocationType Type
Classification of the debug-info record that this DbgVariableRecord represents.
Definition DebugProgramInstruction.h:294
MDNode * getRawExpression() const
Definition DebugProgramInstruction.h:473
DbgRecordParamRef< DILocalVariable > Variable
Definition DebugProgramInstruction.h:300
void setAddressExpression(DIExpression *NewExpr)
Definition DebugProgramInstruction.h:537
DbgVariableFragmentInfo getFragmentOrEntireVariable() const
Get the FragmentInfo for the variable if it exists, otherwise return a FragmentInfo that covers the e...
Definition DebugProgramInstruction.h:500
MDNode * getRawAddressExpression() const
Definition DebugProgramInstruction.h:534
LLVM_ABI Value * getVariableLocationOp(unsigned OpIdx) const
bool isAddressOfVariable() const
Does this describe the address of a local variable.
Definition DebugProgramInstruction.h:453
Value * getValue(unsigned OpIdx=0) const
Definition DebugProgramInstruction.h:481
static LLVM_ABI DbgVariableRecord * createDVRDeclareValue(Value *Address, DILocalVariable *DV, DIExpression *Expr, const DILocation *DI)
static LLVM_ABI DbgVariableRecord * createLinkedDVRAssign(Instruction *LinkedInstr, Value *Val, DILocalVariable *Variable, DIExpression *Expression, Value *Address, DIExpression *AddressExpression, const DILocation *DI)
static LLVM_ABI DbgVariableRecord * createDVRAssign(Value *Val, DILocalVariable *Variable, DIExpression *Expression, DIAssignID *AssignID, Value *Address, DIExpression *AddressExpression, const DILocation *DI)
void setRawLocation(Metadata *NewLocation)
Use of this should generally be avoided; instead, replaceVariableLocationOp and addVariableLocationOp...
Definition DebugProgramInstruction.h:488
LLVM_ABI void handleChangedLocation(Metadata *NewLocation)
Handle changes to the location of the Value(s) that we refer to happening "under our feet".
void setVariable(DILocalVariable *NewVar)
Definition DebugProgramInstruction.h:467
bool isDbgAssign() const
Definition DebugProgramInstruction.h:525
void setExpression(DIExpression *NewExpr)
Definition DebugProgramInstruction.h:471
DIExpression * getExpression() const
Definition DebugProgramInstruction.h:472
static LLVM_ABI DbgVariableRecord * createDVRDeclare(Value *Address, DILocalVariable *DV, DIExpression *Expr, const DILocation *DI)
Metadata * getRawAssignID() const
Definition DebugProgramInstruction.h:531
static LLVM_ABI DbgVariableRecord * createDbgVariableRecord(Value *Location, DILocalVariable *DV, DIExpression *Expr, const DILocation *DI)
MDNode * getRawVariable() const
Definition DebugProgramInstruction.h:469
LLVM_ABI std::optional< uint64_t > getFragmentSizeInBits() const
Get the size (in bits) of the variable, or fragment of the variable that is described.
DILocalVariable * getVariable() const
Definition DebugProgramInstruction.h:468
static LLVM_ABI DbgVariableRecord * createUnresolvedDbgVariableRecord(LocationType Type, Metadata *Val, MDNode *Variable, MDNode *Expression, MDNode *AssignID, Metadata *Address, MDNode *AddressExpression, MDNode *DI)
Used to create DbgVariableRecords during parsing, where some metadata references may still be unresol...
bool isDbgDeclareValue() const
Definition DebugProgramInstruction.h:425
static bool classof(const DbgRecord *E)
Support type inquiry through isa, cast, and dyn_cast.
Definition DebugProgramInstruction.h:568
Metadata * getRawLocation() const
Returns the metadata operand for the first location description.
Definition DebugProgramInstruction.h:479
bool isDbgDeclare() const
Definition DebugProgramInstruction.h:423
void setAddress(Value *V)
Definition DebugProgramInstruction.h:541
Metadata * getRawAddress() const
Definition DebugProgramInstruction.h:528
friend class DebugValueUser
Definition DebugProgramInstruction.h:278
LLVM_ABI DbgVariableRecord(const DbgVariableIntrinsic *DVI)
Create a new DbgVariableRecord representing the intrinsic DVI, for example the assignment represented...
LocationType
Definition DebugProgramInstruction.h:281
@ Assign
Definition DebugProgramInstruction.h:284
@ Declare
Definition DebugProgramInstruction.h:282
@ DeclareValue
Definition DebugProgramInstruction.h:285
@ Value
Definition DebugProgramInstruction.h:283
@ End
Marks the end of the concrete types.
Definition DebugProgramInstruction.h:287
@ Any
To indicate all LocationTypes in searches.
Definition DebugProgramInstruction.h:288
bool isIdenticalToWhenDefined(const DbgVariableRecord &Other) const
Definition DebugProgramInstruction.h:516
DbgRecordParamRef< DIExpression > AddressExpression
Definition DebugProgramInstruction.h:302
bool hasArgList() const
Definition DebugProgramInstruction.h:445
DIExpression * getAddressExpression() const
Definition DebugProgramInstruction.h:533
std::array< Metadata *, 3 > DebugValues
void resetDebugValue(size_t Idx, Metadata *DebugValue)
This is an important class for using LLVM in a threaded context.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Manage lifetime of a slot tracker for printing IR.
A Module instance is used to store all the information related to an LLVM module.
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
LLVM Value Representation.
self_iterator getIterator()
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
A simple intrusive list implementation.
ilist_select_iterator_type< OptionsT, false, false > iterator
ilist_select_iterator_type< OptionsT, false, true > const_iterator
struct LLVMOpaqueDbgRecord * LLVMDbgRecordRef
This file defines classes to implement an intrusive doubly linked list class (i.e.
This file defines the ilist_node class template, which is a convenient base class for creating classe...
This is an optimization pass for GlobalISel generic memory operations.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
TypedTrackingMDRef< MDNode > TrackingMDNodeRef
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr, unsigned DynamicVGPRBlockSize=0)
template class LLVM_TEMPLATE_ABI DbgRecordParamRef< DIExpression >
decltype(auto) dyn_cast(const From &Val)
dyn_cast - Return the argument parameter cast to the specified type.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
auto map_range(ContainerTy &&C, FuncTy F)
iterator_range< simple_ilist< DbgRecord >::iterator > getDbgRecordRange(DbgMarker *DebugMarker)
Inline helper to return a range of DbgRecords attached to a marker.
Definition DebugProgramInstruction.h:700
iterator_range< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > make_filter_range(RangeT &&Range, PredicateT Pred)
Convenience function that takes a range of elements and a predicate, and return a new filter_iterator...
bool isa(const From &Val)
isa - Return true if the parameter to the template is an instance of one of the template type argu...
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
decltype(auto) cast(const From &Val)
cast - Return the argument parameter cast to the specified type.
template class LLVM_TEMPLATE_ABI DbgRecordParamRef< DILocalVariable >
static auto filterDbgVars(iterator_range< simple_ilist< DbgRecord >::iterator > R)
Filter the DbgRecord range to DbgVariableRecord types only and downcast.
Definition DebugProgramInstruction.h:575
template class LLVM_TEMPLATE_ABI DbgRecordParamRef< DILabel >