LLVM 19.0.0git
DebugProgramInstruction.h
Go to the documentation of this file.
1//===-- llvm/DebugProgramInstruction.h - Stream of debug info -------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Data structures for storing variable assignment information in LLVM. In the
10// dbg.value design, a dbg.value intrinsic specifies the position in a block
11// a source variable take on an LLVM Value:
12//
13// %foo = add i32 1, %0
14// dbg.value(metadata i32 %foo, ...)
15// %bar = void call @ext(%foo);
16//
17// and all information is stored in the Value / Metadata hierachy defined
18// elsewhere in LLVM. In the "DPValue" design, each instruction /may/ have a
19// connection with a DPMarker, which identifies a position immediately before the
20// instruction, and each DPMarker /may/ then have connections to DPValues which
21// record the variable assignment information. To illustrate:
22//
23// %foo = add i32 1, %0
24// ; foo->DbgMarker == nullptr
25// ;; There are no variable assignments / debug records "in front" of
26// ;; the instruction for %foo, therefore it has no DbgMarker.
27// %bar = void call @ext(%foo)
28// ; bar->DbgMarker = {
29// ; StoredDPValues = {
30// ; DPValue(metadata i32 %foo, ...)
31// ; }
32// ; }
33// ;; There is a debug-info record in front of the %bar instruction,
34// ;; thus it points at a DPMarker object. That DPMarker contains a
35// ;; DPValue in it's ilist, storing the equivalent information to the
36// ;; dbg.value above: the Value, DILocalVariable, etc.
37//
38// This structure separates the two concerns of the position of the debug-info
39// in the function, and the Value that it refers to. It also creates a new
40// "place" in-between the Value / Metadata hierachy where we can customise
41// storage and allocation techniques to better suite debug-info workloads.
42// NB: as of the initial prototype, none of that has actually been attempted
43// yet.
44//
45//===----------------------------------------------------------------------===//
46
47#ifndef LLVM_IR_DEBUGPROGRAMINSTRUCTION_H
48#define LLVM_IR_DEBUGPROGRAMINSTRUCTION_H
49
50#include "llvm/ADT/ilist.h"
51#include "llvm/ADT/ilist_node.h"
52#include "llvm/ADT/iterator.h"
53#include "llvm/IR/DebugLoc.h"
54#include "llvm/IR/Instruction.h"
57
58namespace llvm {
59
60class Instruction;
61class BasicBlock;
62class MDNode;
63class Module;
64class DbgVariableIntrinsic;
65class DIAssignID;
66class DPMarker;
67class DPValue;
68class raw_ostream;
69
70/// Base class for non-instruction debug metadata records that have positions
71/// within IR. Features various methods copied across from the Instruction
72/// class to aid ease-of-use. DbgRecords should always be linked into a
73/// DPMarker's StoredDPValues list. The marker connects a DbgRecord back to
74/// it's position in the BasicBlock.
75///
76/// We need a discriminator for dyn/isa casts. In order to avoid paying for a
77/// vtable for "virtual" functions too, subclasses must add a new discriminator
78/// value (RecordKind) and cases to a few functions in the base class:
79/// deleteRecord
80/// clone
81/// isIdenticalToWhenDefined
82/// isEquivalentTo
83/// both print methods
84class DbgRecord : public ilist_node<DbgRecord> {
85public:
86 /// Marker that this DbgRecord is linked into.
87 DPMarker *Marker = nullptr;
88 /// Subclass discriminator.
89 enum Kind : uint8_t { ValueKind };
90
91protected:
93 Kind RecordKind; ///< Subclass discriminator.
94
95public:
98
99 /// Methods that dispatch to subclass implementations. These need to be
100 /// manually updated when a new subclass is added.
101 ///@{
102 void deleteRecord();
103 DbgRecord *clone() const;
104 void print(raw_ostream &O, bool IsForDebug = false) const;
105 void print(raw_ostream &O, ModuleSlotTracker &MST, bool IsForDebug) const;
106 bool isIdenticalToWhenDefined(const DbgRecord &R) const;
107 bool isEquivalentTo(const DbgRecord &R) const;
108 ///@}
109
110 Kind getRecordKind() const { return RecordKind; }
111
112 void setMarker(DPMarker *M) { Marker = M; }
113
114 DPMarker *getMarker() { return Marker; }
115 const DPMarker *getMarker() const { return Marker; }
116
118 const BasicBlock *getBlock() const;
119
121 const Function *getFunction() const;
122
123 Module *getModule();
124 const Module *getModule() const;
125
127 const LLVMContext &getContext() const;
128
129 const Instruction *getInstruction() const;
130 const BasicBlock *getParent() const;
132
133 void removeFromParent();
134 void eraseFromParent();
135
136 DbgRecord *getNextNode() { return &*std::next(getIterator()); }
137 DbgRecord *getPrevNode() { return &*std::prev(getIterator()); }
138 void insertBefore(DbgRecord *InsertBefore);
139 void insertAfter(DbgRecord *InsertAfter);
140 void moveBefore(DbgRecord *MoveBefore);
141 void moveAfter(DbgRecord *MoveAfter);
142
143 DebugLoc getDebugLoc() const { return DbgLoc; }
144 void setDebugLoc(DebugLoc Loc) { DbgLoc = std::move(Loc); }
145
146 void dump() const;
147
150
151protected:
152 /// Similarly to Value, we avoid paying the cost of a vtable
153 /// by protecting the dtor and having deleteRecord dispatch
154 /// cleanup.
155 /// Use deleteRecord to delete a generic record.
156 ~DbgRecord() = default;
157};
158
159/// Record of a variable value-assignment, aka a non instruction representation
160/// of the dbg.value intrinsic.
161///
162/// This class inherits from DebugValueUser to allow LLVM's metadata facilities
163/// to update our references to metadata beneath our feet.
164class DPValue : public DbgRecord, protected DebugValueUser {
165 friend class DebugValueUser;
166
167public:
168 enum class LocationType : uint8_t {
169 Declare,
170 Value,
171 Assign,
172
173 End, ///< Marks the end of the concrete types.
174 Any, ///< To indicate all LocationTypes in searches.
175 };
176 /// Classification of the debug-info record that this DPValue represents.
177 /// Essentially, "is this a dbg.value or dbg.declare?". dbg.declares are not
178 /// currently supported, but it would be trivial to do so.
179 /// FIXME: We could use spare padding bits from DbgRecord for this.
181
182 // NB: there is no explicit "Value" field in this class, it's effectively the
183 // DebugValueUser superclass instead. The referred to Value can either be a
184 // ValueAsMetadata or a DIArgList.
185
189
190public:
191 /// Create a new DPValue representing the intrinsic \p DVI, for example the
192 /// assignment represented by a dbg.value.
193 DPValue(const DbgVariableIntrinsic *DVI);
194 DPValue(const DPValue &DPV);
195 /// Directly construct a new DPValue representing a dbg.value intrinsic
196 /// assigning \p Location to the DV / Expr / DI variable.
197 DPValue(Metadata *Location, DILocalVariable *DV, DIExpression *Expr,
200 DIAssignID *AssignID, Metadata *Address,
202
205 DIAssignID *AssignID, Value *Address,
207 const DILocation *DI);
208 static DPValue *createLinkedDPVAssign(Instruction *LinkedInstr, Value *Val,
211 Value *Address,
213 const DILocation *DI);
214
215 static DPValue *createDPValue(Value *Location, DILocalVariable *DV,
216 DIExpression *Expr, const DILocation *DI);
217 static DPValue *createDPValue(Value *Location, DILocalVariable *DV,
218 DIExpression *Expr, const DILocation *DI,
219 DPValue &InsertBefore);
221 DIExpression *Expr, const DILocation *DI);
223 DIExpression *Expr, const DILocation *DI,
224 DPValue &InsertBefore);
225
226 /// Iterator for ValueAsMetadata that internally uses direct pointer iteration
227 /// over either a ValueAsMetadata* or a ValueAsMetadata**, dereferencing to the
228 /// ValueAsMetadata .
230 : public iterator_facade_base<location_op_iterator,
231 std::bidirectional_iterator_tag, Value *> {
233
234 public:
235 location_op_iterator(ValueAsMetadata *SingleIter) : I(SingleIter) {}
236 location_op_iterator(ValueAsMetadata **MultiIter) : I(MultiIter) {}
237
240 I = R.I;
241 return *this;
242 }
244 return I == RHS.I;
245 }
246 const Value *operator*() const {
247 ValueAsMetadata *VAM = I.is<ValueAsMetadata *>()
248 ? I.get<ValueAsMetadata *>()
249 : *I.get<ValueAsMetadata **>();
250 return VAM->getValue();
251 };
253 ValueAsMetadata *VAM = I.is<ValueAsMetadata *>()
254 ? I.get<ValueAsMetadata *>()
255 : *I.get<ValueAsMetadata **>();
256 return VAM->getValue();
257 }
259 if (I.is<ValueAsMetadata *>())
260 I = I.get<ValueAsMetadata *>() + 1;
261 else
262 I = I.get<ValueAsMetadata **>() + 1;
263 return *this;
264 }
266 if (I.is<ValueAsMetadata *>())
267 I = I.get<ValueAsMetadata *>() - 1;
268 else
269 I = I.get<ValueAsMetadata **>() - 1;
270 return *this;
271 }
272 };
273
275 bool isDbgValue() { return Type == LocationType::Value; }
276
277 /// Get the locations corresponding to the variable referenced by the debug
278 /// info intrinsic. Depending on the intrinsic, this could be the
279 /// variable's value or its address.
281
282 Value *getVariableLocationOp(unsigned OpIdx) const;
283
284 void replaceVariableLocationOp(Value *OldValue, Value *NewValue,
285 bool AllowEmpty = false);
286 void replaceVariableLocationOp(unsigned OpIdx, Value *NewValue);
287 /// Adding a new location operand will always result in this intrinsic using
288 /// an ArgList, and must always be accompanied by a new expression that uses
289 /// the new operand.
292
293 void setVariable(DILocalVariable *NewVar) { Variable = NewVar; }
294
296
297 unsigned getNumVariableLocationOps() const;
298
299 bool hasArgList() const { return isa<DIArgList>(getRawLocation()); }
300 /// Returns true if this DPValue has no empty MDNodes in its location list.
301 bool hasValidLocation() const { return getVariableLocationOp(0) != nullptr; }
302
303 /// Does this describe the address of a local variable. True for dbg.addr
304 /// and dbg.declare, but not dbg.value, which describes its value.
306 LocationType getType() const { return Type; }
307
308 void setKillLocation();
309 bool isKillLocation() const;
310
312
314
315 /// Returns the metadata operand for the first location description. i.e.,
316 /// dbg intrinsic dbg.value,declare operand and dbg.assign 1st location
317 /// operand (the "value componenet"). Note the operand (singular) may be
318 /// a DIArgList which is a list of values.
319 Metadata *getRawLocation() const { return DebugValues[0]; }
320
321 Value *getValue(unsigned OpIdx = 0) const {
322 return getVariableLocationOp(OpIdx);
323 }
324
325 /// Use of this should generally be avoided; instead,
326 /// replaceVariableLocationOp and addVariableLocationOps should be used where
327 /// possible to avoid creating invalid state.
328 void setRawLocation(Metadata *NewLocation) {
329 assert(
330 (isa<ValueAsMetadata>(NewLocation) || isa<DIArgList>(NewLocation) ||
331 isa<MDNode>(NewLocation)) &&
332 "Location for a DPValue must be either ValueAsMetadata or DIArgList");
333 resetDebugValue(0, NewLocation);
334 }
335
336 /// Get the size (in bits) of the variable, or fragment of the variable that
337 /// is described.
338 std::optional<uint64_t> getFragmentSizeInBits() const;
339
340 bool isEquivalentTo(const DPValue &Other) const {
341 return DbgLoc == Other.DbgLoc && isIdenticalToWhenDefined(Other);
342 }
343 // Matches the definition of the Instruction version, equivalent to above but
344 // without checking DbgLoc.
346 return std::tie(Type, DebugValues, Variable, Expression,
348 std::tie(Other.Type, Other.DebugValues, Other.Variable,
349 Other.Expression, Other.AddressExpression);
350 }
351
352 /// @name DbgAssign Methods
353 /// @{
354 bool isDbgAssign() const { return getType() == LocationType::Assign; }
355
356 Value *getAddress() const;
358 return isDbgAssign() ? DebugValues[1] : DebugValues[0];
359 }
360 Metadata *getRawAssignID() const { return DebugValues[2]; }
361 DIAssignID *getAssignID() const;
365 }
366 void setAssignId(DIAssignID *New);
368 /// Kill the address component.
369 void setKillAddress();
370 /// Check whether this kills the address component. This doesn't take into
371 /// account the position of the intrinsic, therefore a returned value of false
372 /// does not guarentee the address is a valid location for the variable at the
373 /// intrinsic's position in IR.
374 bool isKillAddress() const;
375
376 /// @}
377
378 DPValue *clone() const;
379 /// Convert this DPValue back into a dbg.value intrinsic.
380 /// \p InsertBefore Optional position to insert this intrinsic.
381 /// \returns A new dbg.value intrinsic representiung this DPValue.
383 Instruction *InsertBefore) const;
384
385 /// Handle changes to the location of the Value(s) that we refer to happening
386 /// "under our feet".
387 void handleChangedLocation(Metadata *NewLocation);
388
389 void print(raw_ostream &O, bool IsForDebug = false) const;
390 void print(raw_ostream &ROS, ModuleSlotTracker &MST, bool IsForDebug) const;
391
392 /// Filter the DbgRecord range to DPValue types only and downcast.
393 static inline auto
395 return map_range(
396 make_filter_range(R, [](DbgRecord &E) { return isa<DPValue>(E); }),
397 [](DbgRecord &E) { return std::ref(cast<DPValue>(E)); });
398 }
399
400 /// Support type inquiry through isa, cast, and dyn_cast.
401 static bool classof(const DbgRecord *E) {
402 return E->getRecordKind() == ValueKind;
403 }
404};
405
406/// Per-instruction record of debug-info. If an Instruction is the position of
407/// some debugging information, it points at a DPMarker storing that info. Each
408/// marker points back at the instruction that owns it. Various utilities are
409/// provided for manipulating the DbgRecords contained within this marker.
410///
411/// This class has a rough surface area, because it's needed to preserve the
412/// one arefact that we can't yet eliminate from the intrinsic / dbg.value
413/// debug-info design: the order of records is significant, and duplicates can
414/// exist. Thus, if one has a run of debug-info records such as:
415/// dbg.value(...
416/// %foo = barinst
417/// dbg.value(...
418/// and remove barinst, then the dbg.values must be preserved in the correct
419/// order. Hence, the use of iterators to select positions to insert things
420/// into, or the occasional InsertAtHead parameter indicating that new records
421/// should go at the start of the list.
422///
423/// There are only five or six places in LLVM that truly rely on this ordering,
424/// which we can improve in the future. Additionally, many improvements in the
425/// way that debug-info is stored can be achieved in this class, at a future
426/// date.
427class DPMarker {
428public:
430 /// Link back to the Instruction that owns this marker. Can be null during
431 /// operations that move a marker from one instruction to another.
433
434 /// List of DbgRecords, the non-instruction equivalent of llvm.dbg.*
435 /// intrinsics. There is a one-to-one relationship between each debug
436 /// intrinsic in a block and each DbgRecord once the representation has been
437 /// converted, and the ordering is meaningful in the same way.
439 bool empty() const { return StoredDPValues.empty(); }
440
441 const BasicBlock *getParent() const;
443
444 /// Handle the removal of a marker: the position of debug-info has gone away,
445 /// but the stored debug records should not. Drop them onto the next
446 /// instruction, or otherwise work out what to do with them.
447 void removeMarker();
448 void dump() const;
449
450 void removeFromParent();
451 void eraseFromParent();
452
453 /// Implement operator<< on DPMarker.
454 void print(raw_ostream &O, bool IsForDebug = false) const;
455 void print(raw_ostream &ROS, ModuleSlotTracker &MST, bool IsForDebug) const;
456
457 /// Produce a range over all the DPValues in this Marker.
460 getDbgValueRange() const;
461 /// Transfer any DPValues from \p Src into this DPMarker. If \p InsertAtHead
462 /// is true, place them before existing DPValues, otherwise afterwards.
463 void absorbDebugValues(DPMarker &Src, bool InsertAtHead);
464 /// Transfer the DPValues in \p Range from \p Src into this DPMarker. If
465 /// \p InsertAtHead is true, place them before existing DPValues, otherwise
466 // afterwards.
468 DPMarker &Src, bool InsertAtHead);
469 /// Insert a DPValue into this DPMarker, at the end of the list. If
470 /// \p InsertAtHead is true, at the start.
471 void insertDPValue(DbgRecord *New, bool InsertAtHead);
472 /// Insert a DPValue prior to a DPValue contained within this marker.
473 void insertDPValue(DbgRecord *New, DbgRecord *InsertBefore);
474 /// Insert a DPValue after a DPValue contained within this marker.
475 void insertDPValueAfter(DbgRecord *New, DbgRecord *InsertAfter);
476 /// Clone all DPMarkers from \p From into this marker. There are numerous
477 /// options to customise the source/destination, due to gnarliness, see class
478 /// comment.
479 /// \p FromHere If non-null, copy from FromHere to the end of From's DPValues
480 /// \p InsertAtHead Place the cloned DPValues at the start of StoredDPValues
481 /// \returns Range over all the newly cloned DPValues
484 std::optional<simple_ilist<DbgRecord>::iterator> FromHere,
485 bool InsertAtHead = false);
486 /// Erase all DPValues in this DPMarker.
487 void dropDbgValues();
488 /// Erase a single DbgRecord from this marker. In an ideal future, we would
489 /// never erase an assignment in this way, but it's the equivalent to
490 /// erasing a debug intrinsic from a block.
491 void dropOneDbgValue(DbgRecord *DR);
492
493 /// We generally act like all llvm Instructions have a range of DPValues
494 /// attached to them, but in reality sometimes we don't allocate the DPMarker
495 /// to save time and memory, but still have to return ranges of DPValues. When
496 /// we need to describe such an unallocated DPValue range, use this static
497 /// markers range instead. This will bite us if someone tries to insert a
498 /// DPValue in that range, but they should be using the Official (TM) API for
499 /// that.
505 }
506};
507
508inline raw_ostream &operator<<(raw_ostream &OS, const DPMarker &Marker) {
509 Marker.print(OS);
510 return OS;
511}
512
514 Value.print(OS);
515 return OS;
516}
517
518/// Inline helper to return a range of DPValues attached to a marker. It needs
519/// to be inlined as it's frequently called, but also come after the declaration
520/// of DPMarker. Thus: it's pre-declared by users like Instruction, then an
521/// inlineable body defined here.
522inline iterator_range<simple_ilist<DbgRecord>::iterator>
524 if (!DbgMarker)
526 return DbgMarker->getDbgValueRange();
527}
528
529} // namespace llvm
530
531#endif // LLVM_IR_DEBUGPROGRAMINSTRUCTION_H
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
BlockVerifier::State From
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define I(x, y, z)
Definition: MD5.cpp:58
Machine Check Debug Module
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
raw_pwrite_stream & OS
Value * RHS
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
LLVM Basic Block Representation.
Definition: BasicBlock.h:60
Assignment ID.
DWARF expression.
Debug location.
Per-instruction record of debug-info.
static iterator_range< simple_ilist< DbgRecord >::iterator > getEmptyDPValueRange()
void dropOneDbgValue(DbgRecord *DR)
Erase a single DbgRecord from this marker.
const BasicBlock * getParent() const
void dropDbgValues()
Erase all DPValues in this DPMarker.
void insertDPValue(DbgRecord *New, bool InsertAtHead)
Insert a DPValue into this DPMarker, at the end of the list.
void insertDPValueAfter(DbgRecord *New, DbgRecord *InsertAfter)
Insert a DPValue after a DPValue contained within this marker.
Instruction * MarkedInstr
Link back to the Instruction that owns this marker.
void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on DPMarker.
Definition: AsmWriter.cpp:4859
void absorbDebugValues(DPMarker &Src, bool InsertAtHead)
Transfer any DPValues from Src into this DPMarker.
simple_ilist< DbgRecord > StoredDPValues
List of DbgRecords, the non-instruction equivalent of llvm.dbg.
void dump() const
Definition: AsmWriter.cpp:5154
static DPMarker EmptyDPMarker
We generally act like all llvm Instructions have a range of DPValues attached to them,...
iterator_range< simple_ilist< DbgRecord >::iterator > getDbgValueRange()
Produce a range over all the DPValues in this Marker.
iterator_range< simple_ilist< DbgRecord >::iterator > cloneDebugInfoFrom(DPMarker *From, std::optional< simple_ilist< DbgRecord >::iterator > FromHere, bool InsertAtHead=false)
Clone all DPMarkers from From into this marker.
void removeMarker()
Handle the removal of a marker: the position of debug-info has gone away, but the stored debug record...
Iterator for ValueAsMetadata that internally uses direct pointer iteration over either a ValueAsMetad...
location_op_iterator(ValueAsMetadata *SingleIter)
location_op_iterator & operator=(const location_op_iterator &R)
bool operator==(const location_op_iterator &RHS) const
location_op_iterator(ValueAsMetadata **MultiIter)
location_op_iterator(const location_op_iterator &R)
Record of a variable value-assignment, aka a non instruction representation of the dbg....
LocationType Type
Classification of the debug-info record that this DPValue represents.
bool isIdenticalToWhenDefined(const DPValue &Other) const
Value * getValue(unsigned OpIdx=0) const
bool hasValidLocation() const
Returns true if this DPValue has no empty MDNodes in its location list.
void setAddressExpression(DIExpression *NewExpr)
Value * getAddress() const
DIExpression * AddressExpression
DIExpression * getExpression() const
void addVariableLocationOps(ArrayRef< Value * > NewValues, DIExpression *NewExpr)
Adding a new location operand will always result in this intrinsic using an ArgList,...
static bool classof(const DbgRecord *E)
Support type inquiry through isa, cast, and dyn_cast.
void setAssignId(DIAssignID *New)
void print(raw_ostream &O, bool IsForDebug=false) const
Definition: AsmWriter.cpp:4865
void setVariable(DILocalVariable *NewVar)
void setAddress(Value *V)
bool isEquivalentTo(const DPValue &Other) const
static DPValue * createDPValue(Value *Location, DILocalVariable *DV, DIExpression *Expr, const DILocation *DI)
iterator_range< location_op_iterator > location_ops() const
Get the locations corresponding to the variable referenced by the debug info intrinsic.
static DPValue * createDPVAssign(Value *Val, DILocalVariable *Variable, DIExpression *Expression, DIAssignID *AssignID, Value *Address, DIExpression *AddressExpression, const DILocation *DI)
static DPValue * createDPVDeclare(Value *Address, DILocalVariable *DV, DIExpression *Expr, const DILocation *DI)
void setRawLocation(Metadata *NewLocation)
Use of this should generally be avoided; instead, replaceVariableLocationOp and addVariableLocationOp...
void handleChangedLocation(Metadata *NewLocation)
Handle changes to the location of the Value(s) that we refer to happening "under our feet".
static DPValue * createLinkedDPVAssign(Instruction *LinkedInstr, Value *Val, DILocalVariable *Variable, DIExpression *Expression, Value *Address, DIExpression *AddressExpression, const DILocation *DI)
DIExpression * getAddressExpression() const
unsigned getNumVariableLocationOps() const
LocationType getType() const
void setExpression(DIExpression *NewExpr)
std::optional< uint64_t > getFragmentSizeInBits() const
Get the size (in bits) of the variable, or fragment of the variable that is described.
Metadata * getRawLocation() const
Returns the metadata operand for the first location description.
DPValue * clone() const
void setKillAddress()
Kill the address component.
DILocalVariable * Variable
bool isKillAddress() const
Check whether this kills the address component.
Metadata * getRawAssignID() const
Value * getVariableLocationOp(unsigned OpIdx) const
Metadata * getRawAddress() const
@ End
Marks the end of the concrete types.
@ Any
To indicate all LocationTypes in searches.
DIAssignID * getAssignID() const
DILocalVariable * getVariable() const
DbgVariableIntrinsic * createDebugIntrinsic(Module *M, Instruction *InsertBefore) const
Convert this DPValue back into a dbg.value intrinsic.
static auto filter(iterator_range< simple_ilist< DbgRecord >::iterator > R)
Filter the DbgRecord range to DPValue types only and downcast.
void replaceVariableLocationOp(Value *OldValue, Value *NewValue, bool AllowEmpty=false)
DIExpression * Expression
bool isAddressOfVariable() const
Does this describe the address of a local variable.
Base class for non-instruction debug metadata records that have positions within IR.
void insertAfter(DbgRecord *InsertAfter)
void setMarker(DPMarker *M)
void print(raw_ostream &O, bool IsForDebug=false) const
bool isEquivalentTo(const DbgRecord &R) const
DbgRecord(Kind RecordKind, DebugLoc DL)
simple_ilist< DbgRecord >::iterator self_iterator
DebugLoc getDebugLoc() const
void dump() const
Definition: AsmWriter.cpp:5158
Kind RecordKind
Subclass discriminator.
void deleteRecord()
Methods that dispatch to subclass implementations.
void insertBefore(DbgRecord *InsertBefore)
~DbgRecord()=default
Similarly to Value, we avoid paying the cost of a vtable by protecting the dtor and having deleteReco...
void moveBefore(DbgRecord *MoveBefore)
simple_ilist< DbgRecord >::const_iterator const_self_iterator
Kind
Subclass discriminator.
void setDebugLoc(DebugLoc Loc)
const Instruction * getInstruction() const
DPMarker * Marker
Marker that this DbgRecord is linked into.
void moveAfter(DbgRecord *MoveAfter)
bool isIdenticalToWhenDefined(const DbgRecord &R) const
DbgRecord * clone() const
const DPMarker * getMarker() const
const BasicBlock * getParent() const
This is the common base class for debug info intrinsics for variables.
A debug info location.
Definition: DebugLoc.h:33
Base class for tracking ValueAsMetadata/DIArgLists with user lookups and Owner callbacks outside of V...
Definition: Metadata.h:212
std::array< Metadata *, 3 > DebugValues
Definition: Metadata.h:218
void resetDebugValue(size_t Idx, Metadata *DebugValue)
Definition: Metadata.h:273
Class representing an expression and its matching format.
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
Root of the metadata hierarchy.
Definition: Metadata.h:62
Manage lifetime of a slot tracker for printing IR.
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
Definition: PointerUnion.h:118
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
Value wrapper in the Metadata hierarchy.
Definition: Metadata.h:450
static ValueAsMetadata * get(Value *V)
Definition: Metadata.cpp:492
Value * getValue() const
Definition: Metadata.h:490
LLVM Value Representation.
Definition: Value.h:74
void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on Value.
Definition: AsmWriter.cpp:4907
self_iterator getIterator()
Definition: ilist_node.h:109
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition: iterator.h:80
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
A simple intrusive list implementation.
Definition: simple_ilist.h:81
typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, false, false >::type iterator
Definition: simple_ilist.h:97
typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, false, true >::type const_iterator
Definition: simple_ilist.h:100
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...
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:71
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
iterator_range< simple_ilist< DbgRecord >::iterator > getDbgValueRange(DPMarker *DbgMarker)
Inline helper to return a range of DPValues attached to a marker.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
auto map_range(ContainerTy &&C, FuncTy F)
Definition: STLExtras.h:377
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...
Definition: STLExtras.h:581
@ Other
Any other memory.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:293