Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.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 "DbgRecord" design, each instruction /may/ have a
19// connection with a DbgMarker, which identifies a position immediately before
20// the instruction, and each DbgMarker /may/ then have connections to DbgRecords
21// which record the variable assignment information. To illustrate:
22//
23// %foo = add i32 1, %0
24// ; foo->DebugMarker == nullptr
25// ;; There are no variable assignments / debug records "in front" of
26// ;; the instruction for %foo, therefore it has no DebugMarker.
27// %bar = void call @ext(%foo)
28// ; bar->DebugMarker = {
29// ; StoredDbgRecords = {
30// ; DbgVariableRecord(metadata i32 %foo, ...)
31// ; }
32// ; }
33// ;; There is a debug-info record in front of the %bar instruction,
34// ;; thus it points at a DbgMarker object. That DbgMarker contains a
35// ;; DbgVariableRecord in its ilist, storing the equivalent information
36// ;; to the 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/DbgVariableFragmentInfo.h"
54#include "llvm/IR/DebugLoc.h"
55#include "llvm/IR/Instruction.h"
56#include "llvm/IR/SymbolTableListTraits.h"
57#include "llvm/Support/Casting.h"
58
59namespacellvm {
60
61classInstruction;
62classBasicBlock;
63classMDNode;
64classModule;
65classDbgVariableIntrinsic;
66classDbgInfoIntrinsic;
67classDbgLabelInst;
68classDIAssignID;
69classDbgMarker;
70classDbgVariableRecord;
71classraw_ostream;
72
73/// A typed tracking MDNode reference that does not require a definition for its
74/// parameter type. Necessary to avoid including DebugInfoMetadata.h, which has
75/// a significant impact on compile times if included in this file.
76template <typename T>classDbgRecordParamRef {
77TrackingMDNodeRef Ref;
78
79public:
80public:
81DbgRecordParamRef() =default;
82
83 /// Construct from the templated type.
84DbgRecordParamRef(constT *Param);
85
86 /// Construct from an \a MDNode.
87 ///
88 /// Note: if \c Param does not have the template type, a verifier check will
89 /// fail, and accessors will crash. However, construction from other nodes
90 /// is supported in order to handle forward references when reading textual
91 /// IR.
92explicitDbgRecordParamRef(constMDNode *Param);
93
94 /// Get the underlying type.
95 ///
96 /// \pre !*this or \c isa<T>(getAsMDNode()).
97 /// @{
98T *get()const;
99operatorT *()const {returnget(); }
100T *operator->() const{returnget(); }
101T &operator*() const{return *get(); }
102 /// @}
103
104 /// Check for null.
105 ///
106 /// Check for null in a way that is safe with broken debug info.
107explicitoperatorbool() const{return Ref; }
108
109 /// Return \c this as a \a MDNode.
110MDNode *getAsMDNode() const{return Ref; }
111
112booloperator==(constDbgRecordParamRef &Other) const{
113return Ref ==Other.Ref;
114 }
115booloperator!=(constDbgRecordParamRef &Other) const{
116return Ref !=Other.Ref;
117 }
118};
119
120/// Base class for non-instruction debug metadata records that have positions
121/// within IR. Features various methods copied across from the Instruction
122/// class to aid ease-of-use. DbgRecords should always be linked into a
123/// DbgMarker's StoredDbgRecords list. The marker connects a DbgRecord back to
124/// its position in the BasicBlock.
125///
126/// We need a discriminator for dyn/isa casts. In order to avoid paying for a
127/// vtable for "virtual" functions too, subclasses must add a new discriminator
128/// value (RecordKind) and cases to a few functions in the base class:
129/// deleteRecord
130/// clone
131/// isIdenticalToWhenDefined
132/// both print methods
133/// createDebugIntrinsic
134classDbgRecord :publicilist_node<DbgRecord> {
135public:
136 /// Marker that this DbgRecord is linked into.
137DbgMarker *Marker =nullptr;
138 /// Subclass discriminator.
139enumKind :uint8_t {ValueKind,LabelKind };
140
141protected:
142DebugLocDbgLoc;
143KindRecordKind;///< Subclass discriminator.
144
145public:
146DbgRecord(KindRecordKind,DebugLocDL)
147 :DbgLoc(DL),RecordKind(RecordKind) {}
148
149 /// Methods that dispatch to subclass implementations. These need to be
150 /// manually updated when a new subclass is added.
151 ///@{
152voiddeleteRecord();
153DbgRecord *clone()const;
154voidprint(raw_ostream &O,bool IsForDebug =false)const;
155voidprint(raw_ostream &O,ModuleSlotTracker &MST,bool IsForDebug)const;
156boolisIdenticalToWhenDefined(constDbgRecord &R)const;
157 /// Convert this DbgRecord back into an appropriate llvm.dbg.* intrinsic.
158 /// \p InsertBefore Optional position to insert this intrinsic.
159 /// \returns A new llvm.dbg.* intrinsic representiung this DbgRecord.
160DbgInfoIntrinsic *createDebugIntrinsic(Module *M,
161Instruction *InsertBefore)const;
162 ///@}
163
164 /// Same as isIdenticalToWhenDefined but checks DebugLoc too.
165boolisEquivalentTo(constDbgRecord &R)const;
166
167KindgetRecordKind() const{returnRecordKind; }
168
169voidsetMarker(DbgMarker *M) {Marker = M; }
170
171DbgMarker *getMarker() {returnMarker; }
172constDbgMarker *getMarker() const{returnMarker; }
173
174BasicBlock *getBlock();
175constBasicBlock *getBlock()const;
176
177Function *getFunction();
178constFunction *getFunction()const;
179
180Module *getModule();
181constModule *getModule()const;
182
183LLVMContext &getContext();
184constLLVMContext &getContext()const;
185
186constInstruction *getInstruction()const;
187constBasicBlock *getParent()const;
188BasicBlock *getParent();
189
190voidremoveFromParent();
191voideraseFromParent();
192
193DbgRecord *getNextNode() {return &*std::next(getIterator()); }
194DbgRecord *getPrevNode() {return &*std::prev(getIterator()); }
195
196// Some generic lambdas supporting intrinsic-based debug-info mean we need
197// to support both iterator and instruction position based insertion.
198voidinsertBefore(DbgRecord *InsertBefore);
199voidinsertAfter(DbgRecord *InsertAfter);
200voidmoveBefore(DbgRecord *MoveBefore);
201voidmoveAfter(DbgRecord *MoveAfter);
202
203voidinsertBefore(self_iterator InsertBefore);
204voidinsertAfter(self_iterator InsertAfter);
205voidmoveBefore(self_iterator MoveBefore);
206voidmoveAfter(self_iterator MoveAfter);
207
208DebugLocgetDebugLoc() const{returnDbgLoc; }
209voidsetDebugLoc(DebugLoc Loc) {DbgLoc = std::move(Loc); }
210
211voiddump()const;
212
213usingself_iterator =simple_ilist<DbgRecord>::iterator;
214usingconst_self_iterator =simple_ilist<DbgRecord>::const_iterator;
215
216protected:
217 /// Similarly to Value, we avoid paying the cost of a vtable
218 /// by protecting the dtor and having deleteRecord dispatch
219 /// cleanup.
220 /// Use deleteRecord to delete a generic record.
221~DbgRecord() =default;
222};
223
224inlineraw_ostream &operator<<(raw_ostream &OS,constDbgRecord &R) {
225 R.print(OS);
226returnOS;
227}
228
229/// Records a position in IR for a source label (DILabel). Corresponds to the
230/// llvm.dbg.label intrinsic.
231classDbgLabelRecord :publicDbgRecord {
232DbgRecordParamRef<DILabel> Label;
233
234 /// This constructor intentionally left private, so that it is only called via
235 /// "createUnresolvedDbgLabelRecord", which clearly expresses that it is for
236 /// parsing only.
237DbgLabelRecord(MDNode *Label,MDNode *DL);
238
239public:
240DbgLabelRecord(DILabel *Label,DebugLocDL);
241
242 /// For use during parsing; creates a DbgLabelRecord from as-of-yet unresolved
243 /// MDNodes. Trying to access the resulting DbgLabelRecord's fields before
244 /// they are resolved, or if they resolve to the wrong type, will result in a
245 /// crash.
246staticDbgLabelRecord *createUnresolvedDbgLabelRecord(MDNode *Label,
247MDNode *DL);
248
249DbgLabelRecord *clone()const;
250voidprint(raw_ostream &O,bool IsForDebug =false)const;
251voidprint(raw_ostream &ROS,ModuleSlotTracker &MST,bool IsForDebug)const;
252DbgLabelInst *createDebugIntrinsic(Module *M,
253Instruction *InsertBefore)const;
254
255voidsetLabel(DILabel *NewLabel) { Label = NewLabel; }
256DILabel *getLabel() const{return Label.get(); }
257MDNode *getRawLabel() const{return Label.getAsMDNode(); };
258
259 /// Support type inquiry through isa, cast, and dyn_cast.
260staticboolclassof(constDbgRecord *E) {
261returnE->getRecordKind() ==LabelKind;
262 }
263};
264
265/// Record of a variable value-assignment, aka a non instruction representation
266/// of the dbg.value intrinsic.
267///
268/// This class inherits from DebugValueUser to allow LLVM's metadata facilities
269/// to update our references to metadata beneath our feet.
270classDbgVariableRecord :publicDbgRecord,protectedDebugValueUser {
271friendclassDebugValueUser;
272
273public:
274enum classLocationType :uint8_t {
275Declare,
276Value,
277Assign,
278
279End,///< Marks the end of the concrete types.
280Any,///< To indicate all LocationTypes in searches.
281 };
282 /// Classification of the debug-info record that this DbgVariableRecord
283 /// represents. Essentially, "does this correspond to a dbg.value,
284 /// dbg.declare, or dbg.assign?".
285 /// FIXME: We could use spare padding bits from DbgRecord for this.
286LocationTypeType;
287
288// NB: there is no explicit "Value" field in this class, it's effectively the
289// DebugValueUser superclass instead. The referred to Value can either be a
290// ValueAsMetadata or a DIArgList.
291
292DbgRecordParamRef<DILocalVariable>Variable;
293DbgRecordParamRef<DIExpression>Expression;
294DbgRecordParamRef<DIExpression>AddressExpression;
295
296public:
297 /// Create a new DbgVariableRecord representing the intrinsic \p DVI, for
298 /// example the assignment represented by a dbg.value.
299DbgVariableRecord(constDbgVariableIntrinsic *DVI);
300DbgVariableRecord(constDbgVariableRecord &DVR);
301 /// Directly construct a new DbgVariableRecord representing a dbg.value
302 /// intrinsic assigning \p Location to the DV / Expr / DI variable.
303DbgVariableRecord(Metadata *Location,DILocalVariable *DV,DIExpression *Expr,
304constDILocation *DI,
305LocationTypeType =LocationType::Value);
306DbgVariableRecord(Metadata *Value,DILocalVariable *Variable,
307DIExpression *Expression,DIAssignID *AssignID,
308Metadata *Address,DIExpression *AddressExpression,
309constDILocation *DI);
310
311private:
312 /// Private constructor for creating new instances during parsing only. Only
313 /// called through `createUnresolvedDbgVariableRecord` below, which makes
314 /// clear that this is used for parsing only, and will later return a subclass
315 /// depending on which Type is passed.
316DbgVariableRecord(LocationTypeType,Metadata *Val,MDNode *Variable,
317MDNode *Expression,MDNode *AssignID,Metadata *Address,
318MDNode *AddressExpression,MDNode *DI);
319
320public:
321 /// Used to create DbgVariableRecords during parsing, where some metadata
322 /// references may still be unresolved. Although for some fields a generic
323 /// `Metadata*` argument is accepted for forward type-references, the verifier
324 /// and accessors will reject incorrect types later on. The function is used
325 /// for all types of DbgVariableRecords for simplicity while parsing, but
326 /// asserts if any necessary fields are empty or unused fields are not empty,
327 /// i.e. if the #dbg_assign fields are used for a non-dbg-assign type.
328staticDbgVariableRecord *
329createUnresolvedDbgVariableRecord(LocationTypeType,Metadata *Val,
330MDNode *Variable,MDNode *Expression,
331MDNode *AssignID,Metadata *Address,
332MDNode *AddressExpression,MDNode *DI);
333
334staticDbgVariableRecord *
335createDVRAssign(Value *Val,DILocalVariable *Variable,
336DIExpression *Expression,DIAssignID *AssignID,
337Value *Address,DIExpression *AddressExpression,
338constDILocation *DI);
339staticDbgVariableRecord *
340createLinkedDVRAssign(Instruction *LinkedInstr,Value *Val,
341DILocalVariable *Variable,DIExpression *Expression,
342Value *Address,DIExpression *AddressExpression,
343constDILocation *DI);
344
345staticDbgVariableRecord *createDbgVariableRecord(Value *Location,
346DILocalVariable *DV,
347DIExpression *Expr,
348constDILocation *DI);
349staticDbgVariableRecord *
350createDbgVariableRecord(Value *Location,DILocalVariable *DV,
351DIExpression *Expr,constDILocation *DI,
352DbgVariableRecord &InsertBefore);
353staticDbgVariableRecord *createDVRDeclare(Value *Address,
354DILocalVariable *DV,
355DIExpression *Expr,
356constDILocation *DI);
357staticDbgVariableRecord *
358createDVRDeclare(Value *Address,DILocalVariable *DV,DIExpression *Expr,
359constDILocation *DI,DbgVariableRecord &InsertBefore);
360
361 /// Iterator for ValueAsMetadata that internally uses direct pointer iteration
362 /// over either a ValueAsMetadata* or a ValueAsMetadata**, dereferencing to the
363 /// ValueAsMetadata .
364classlocation_op_iterator
365 :publiciterator_facade_base<location_op_iterator,
366 std::bidirectional_iterator_tag, Value *> {
367PointerUnion<ValueAsMetadata *, ValueAsMetadata **> I;
368
369public:
370location_op_iterator(ValueAsMetadata *SingleIter) :I(SingleIter) {}
371location_op_iterator(ValueAsMetadata **MultiIter) :I(MultiIter) {}
372
373location_op_iterator(constlocation_op_iterator &R) :I(R.I) {}
374location_op_iterator &operator=(constlocation_op_iterator &R) {
375I = R.I;
376return *this;
377 }
378booloperator==(constlocation_op_iterator &RHS) const{
379returnI ==RHS.I;
380 }
381constValue *operator*() const{
382ValueAsMetadata *VAM = isa<ValueAsMetadata *>(I)
383 ? cast<ValueAsMetadata *>(I)
384 : *cast<ValueAsMetadata **>(I);
385return VAM->getValue();
386 };
387Value *operator*() {
388ValueAsMetadata *VAM = isa<ValueAsMetadata *>(I)
389 ? cast<ValueAsMetadata *>(I)
390 : *cast<ValueAsMetadata **>(I);
391return VAM->getValue();
392 }
393location_op_iterator &operator++() {
394if (auto *VAM = dyn_cast<ValueAsMetadata *>(I))
395I = VAM + 1;
396else
397I = cast<ValueAsMetadata **>(I) + 1;
398return *this;
399 }
400location_op_iterator &operator--() {
401if (auto *VAM = dyn_cast<ValueAsMetadata *>(I))
402I = VAM - 1;
403else
404I = cast<ValueAsMetadata **>(I) - 1;
405return *this;
406 }
407 };
408
409boolisDbgDeclare() const{returnType ==LocationType::Declare; }
410boolisDbgValue() const{returnType ==LocationType::Value; }
411
412 /// Get the locations corresponding to the variable referenced by the debug
413 /// info intrinsic. Depending on the intrinsic, this could be the
414 /// variable's value or its address.
415iterator_range<location_op_iterator>location_ops()const;
416
417Value *getVariableLocationOp(unsigned OpIdx)const;
418
419voidreplaceVariableLocationOp(Value *OldValue,Value *NewValue,
420bool AllowEmpty =false);
421voidreplaceVariableLocationOp(unsigned OpIdx,Value *NewValue);
422 /// Adding a new location operand will always result in this intrinsic using
423 /// an ArgList, and must always be accompanied by a new expression that uses
424 /// the new operand.
425voidaddVariableLocationOps(ArrayRef<Value *> NewValues,
426DIExpression *NewExpr);
427
428unsignedgetNumVariableLocationOps()const;
429
430boolhasArgList() const{return isa<DIArgList>(getRawLocation()); }
431 /// Returns true if this DbgVariableRecord has no empty MDNodes in its
432 /// location list.
433boolhasValidLocation() const{returngetVariableLocationOp(0) !=nullptr; }
434
435 /// Does this describe the address of a local variable. True for dbg.addr
436 /// and dbg.declare, but not dbg.value, which describes its value.
437boolisAddressOfVariable() const{returnType ==LocationType::Declare; }
438
439 /// Determine if this describes the value of a local variable. It is false for
440 /// dbg.declare, but true for dbg.value, which describes its value.
441boolisValueOfVariable() const{returnType ==LocationType::Value; }
442
443LocationTypegetType() const{returnType; }
444
445voidsetKillLocation();
446boolisKillLocation()const;
447
448voidsetVariable(DILocalVariable *NewVar) {Variable = NewVar; }
449DILocalVariable *getVariable() const{returnVariable.get(); };
450MDNode *getRawVariable() const{returnVariable.getAsMDNode(); }
451
452voidsetExpression(DIExpression *NewExpr) {Expression =NewExpr; }
453DIExpression *getExpression() const{returnExpression.get(); }
454MDNode *getRawExpression() const{returnExpression.getAsMDNode(); }
455
456 /// Returns the metadata operand for the first location description. i.e.,
457 /// dbg intrinsic dbg.value,declare operand and dbg.assign 1st location
458 /// operand (the "value componenet"). Note the operand (singular) may be
459 /// a DIArgList which is a list of values.
460Metadata *getRawLocation() const{returnDebugValues[0]; }
461
462Value *getValue(unsigned OpIdx = 0) const{
463returngetVariableLocationOp(OpIdx);
464 }
465
466 /// Use of this should generally be avoided; instead,
467 /// replaceVariableLocationOp and addVariableLocationOps should be used where
468 /// possible to avoid creating invalid state.
469voidsetRawLocation(Metadata *NewLocation) {
470assert((isa<ValueAsMetadata>(NewLocation) || isa<DIArgList>(NewLocation) ||
471 isa<MDNode>(NewLocation)) &&
472"Location for a DbgVariableRecord must be either ValueAsMetadata or "
473"DIArgList");
474resetDebugValue(0, NewLocation);
475 }
476
477 std::optional<DbgVariableFragmentInfo>getFragment()const;
478 /// Get the FragmentInfo for the variable if it exists, otherwise return a
479 /// FragmentInfo that covers the entire variable if the variable size is
480 /// known, otherwise return a zero-sized fragment.
481DbgVariableFragmentInfogetFragmentOrEntireVariable() const{
482if (auto Frag =getFragment())
483return *Frag;
484if (auto Sz =getFragmentSizeInBits())
485return {*Sz, 0};
486return {0, 0};
487 }
488 /// Get the size (in bits) of the variable, or fragment of the variable that
489 /// is described.
490 std::optional<uint64_t>getFragmentSizeInBits()const;
491
492boolisEquivalentTo(constDbgVariableRecord &Other) const{
493returnDbgLoc ==Other.DbgLoc &&isIdenticalToWhenDefined(Other);
494 }
495// Matches the definition of the Instruction version, equivalent to above but
496// without checking DbgLoc.
497boolisIdenticalToWhenDefined(constDbgVariableRecord &Other) const{
498return std::tie(Type,DebugValues,Variable,Expression,
499AddressExpression) ==
500 std::tie(Other.Type,Other.DebugValues,Other.Variable,
501Other.Expression,Other.AddressExpression);
502 }
503
504 /// @name DbgAssign Methods
505 /// @{
506boolisDbgAssign() const{returngetType() ==LocationType::Assign; }
507
508Value *getAddress()const;
509Metadata *getRawAddress() const{
510returnisDbgAssign() ?DebugValues[1] :DebugValues[0];
511 }
512Metadata *getRawAssignID() const{returnDebugValues[2]; }
513DIAssignID *getAssignID()const;
514DIExpression *getAddressExpression() const{returnAddressExpression.get(); }
515MDNode *getRawAddressExpression() const{
516returnAddressExpression.getAsMDNode();
517 }
518voidsetAddressExpression(DIExpression *NewExpr) {
519AddressExpression =NewExpr;
520 }
521voidsetAssignId(DIAssignID *New);
522voidsetAddress(Value *V) {resetDebugValue(1,ValueAsMetadata::get(V)); }
523 /// Kill the address component.
524voidsetKillAddress();
525 /// Check whether this kills the address component. This doesn't take into
526 /// account the position of the intrinsic, therefore a returned value of false
527 /// does not guarentee the address is a valid location for the variable at the
528 /// intrinsic's position in IR.
529boolisKillAddress()const;
530
531 /// @}
532
533DbgVariableRecord *clone()const;
534 /// Convert this DbgVariableRecord back into a dbg.value intrinsic.
535 /// \p InsertBefore Optional position to insert this intrinsic.
536 /// \returns A new dbg.value intrinsic representiung this DbgVariableRecord.
537DbgVariableIntrinsic *createDebugIntrinsic(Module *M,
538Instruction *InsertBefore)const;
539
540 /// Handle changes to the location of the Value(s) that we refer to happening
541 /// "under our feet".
542voidhandleChangedLocation(Metadata *NewLocation);
543
544voidprint(raw_ostream &O,bool IsForDebug =false)const;
545voidprint(raw_ostream &ROS,ModuleSlotTracker &MST,bool IsForDebug)const;
546
547 /// Support type inquiry through isa, cast, and dyn_cast.
548staticboolclassof(constDbgRecord *E) {
549returnE->getRecordKind() ==ValueKind;
550 }
551};
552
553/// Filter the DbgRecord range to DbgVariableRecord types only and downcast.
554staticinlineauto
555filterDbgVars(iterator_range<simple_ilist<DbgRecord>::iterator> R) {
556returnmap_range(
557make_filter_range(R,
558 [](DbgRecord &E) {return isa<DbgVariableRecord>(E); }),
559 [](DbgRecord &E) {return std::ref(cast<DbgVariableRecord>(E)); });
560}
561
562/// Per-instruction record of debug-info. If an Instruction is the position of
563/// some debugging information, it points at a DbgMarker storing that info. Each
564/// marker points back at the instruction that owns it. Various utilities are
565/// provided for manipulating the DbgRecords contained within this marker.
566///
567/// This class has a rough surface area, because it's needed to preserve the
568/// one arefact that we can't yet eliminate from the intrinsic / dbg.value
569/// debug-info design: the order of records is significant, and duplicates can
570/// exist. Thus, if one has a run of debug-info records such as:
571/// dbg.value(...
572/// %foo = barinst
573/// dbg.value(...
574/// and remove barinst, then the dbg.values must be preserved in the correct
575/// order. Hence, the use of iterators to select positions to insert things
576/// into, or the occasional InsertAtHead parameter indicating that new records
577/// should go at the start of the list.
578///
579/// There are only five or six places in LLVM that truly rely on this ordering,
580/// which we can improve in the future. Additionally, many improvements in the
581/// way that debug-info is stored can be achieved in this class, at a future
582/// date.
583classDbgMarker {
584public:
585DbgMarker() {}
586 /// Link back to the Instruction that owns this marker. Can be null during
587 /// operations that move a marker from one instruction to another.
588Instruction *MarkedInstr =nullptr;
589
590 /// List of DbgRecords, the non-instruction equivalent of llvm.dbg.*
591 /// intrinsics. There is a one-to-one relationship between each debug
592 /// intrinsic in a block and each DbgRecord once the representation has been
593 /// converted, and the ordering is meaningful in the same way.
594simple_ilist<DbgRecord>StoredDbgRecords;
595boolempty() const{returnStoredDbgRecords.empty(); }
596
597constBasicBlock *getParent()const;
598BasicBlock *getParent();
599
600 /// Handle the removal of a marker: the position of debug-info has gone away,
601 /// but the stored debug records should not. Drop them onto the next
602 /// instruction, or otherwise work out what to do with them.
603voidremoveMarker();
604voiddump()const;
605
606voidremoveFromParent();
607voideraseFromParent();
608
609 /// Implement operator<< on DbgMarker.
610voidprint(raw_ostream &O,bool IsForDebug =false)const;
611voidprint(raw_ostream &ROS,ModuleSlotTracker &MST,bool IsForDebug)const;
612
613 /// Produce a range over all the DbgRecords in this Marker.
614iterator_range<simple_ilist<DbgRecord>::iterator>getDbgRecordRange();
615iterator_range<simple_ilist<DbgRecord>::const_iterator>
616getDbgRecordRange()const;
617 /// Transfer any DbgRecords from \p Src into this DbgMarker. If \p
618 /// InsertAtHead is true, place them before existing DbgRecords, otherwise
619 /// afterwards.
620voidabsorbDebugValues(DbgMarker &Src,bool InsertAtHead);
621 /// Transfer the DbgRecords in \p Range from \p Src into this DbgMarker. If
622 /// \p InsertAtHead is true, place them before existing DbgRecords, otherwise
623// afterwards.
624voidabsorbDebugValues(iterator_range<DbgRecord::self_iterator>Range,
625DbgMarker &Src,bool InsertAtHead);
626 /// Insert a DbgRecord into this DbgMarker, at the end of the list. If
627 /// \p InsertAtHead is true, at the start.
628voidinsertDbgRecord(DbgRecord *New,bool InsertAtHead);
629 /// Insert a DbgRecord prior to a DbgRecord contained within this marker.
630voidinsertDbgRecord(DbgRecord *New,DbgRecord *InsertBefore);
631 /// Insert a DbgRecord after a DbgRecord contained within this marker.
632voidinsertDbgRecordAfter(DbgRecord *New,DbgRecord *InsertAfter);
633 /// Clone all DbgMarkers from \p From into this marker. There are numerous
634 /// options to customise the source/destination, due to gnarliness, see class
635 /// comment.
636 /// \p FromHere If non-null, copy from FromHere to the end of From's
637 /// DbgRecords
638 /// \p InsertAtHead Place the cloned DbgRecords at the start of
639 /// StoredDbgRecords
640 /// \returns Range over all the newly cloned DbgRecords
641iterator_range<simple_ilist<DbgRecord>::iterator>
642cloneDebugInfoFrom(DbgMarker *From,
643 std::optional<simple_ilist<DbgRecord>::iterator> FromHere,
644bool InsertAtHead =false);
645 /// Erase all DbgRecords in this DbgMarker.
646voiddropDbgRecords();
647 /// Erase a single DbgRecord from this marker. In an ideal future, we would
648 /// never erase an assignment in this way, but it's the equivalent to
649 /// erasing a debug intrinsic from a block.
650voiddropOneDbgRecord(DbgRecord *DR);
651
652 /// We generally act like all llvm Instructions have a range of DbgRecords
653 /// attached to them, but in reality sometimes we don't allocate the DbgMarker
654 /// to save time and memory, but still have to return ranges of DbgRecords.
655 /// When we need to describe such an unallocated DbgRecord range, use this
656 /// static markers range instead. This will bite us if someone tries to insert
657 /// a DbgRecord in that range, but they should be using the Official (TM) API
658 /// for that.
659staticDbgMarkerEmptyDbgMarker;
660staticiterator_range<simple_ilist<DbgRecord>::iterator>
661getEmptyDbgRecordRange() {
662returnmake_range(EmptyDbgMarker.StoredDbgRecords.end(),
663EmptyDbgMarker.StoredDbgRecords.end());
664 }
665};
666
667inlineraw_ostream &operator<<(raw_ostream &OS,constDbgMarker &Marker) {
668 Marker.print(OS);
669returnOS;
670}
671
672/// Inline helper to return a range of DbgRecords attached to a marker. It needs
673/// to be inlined as it's frequently called, but also come after the declaration
674/// of DbgMarker. Thus: it's pre-declared by users like Instruction, then an
675/// inlineable body defined here.
676inline iterator_range<simple_ilist<DbgRecord>::iterator>
677getDbgRecordRange(DbgMarker *DebugMarker) {
678if (!DebugMarker)
679returnDbgMarker::getEmptyDbgRecordRange();
680return DebugMarker->getDbgRecordRange();
681}
682
683DEFINE_ISA_CONVERSION_FUNCTIONS(DbgRecord,LLVMDbgRecordRef)
684
685/// Used to temporarily set the debug info format of a function, module, or
686/// basic block for the duration of this object's lifetime, after which the
687/// prior state will be restored.
688template <typenameT> classScopedDbgInfoFormatSetter {
689T &Obj;
690bool OldState;
691
692public:
693ScopedDbgInfoFormatSetter(T &Obj,bool NewState)
694 : Obj(Obj), OldState(Obj.IsNewDbgInfoFormat) {
695 Obj.setIsNewDbgInfoFormat(NewState);
696 }
697~ScopedDbgInfoFormatSetter() { Obj.setIsNewDbgInfoFormat(OldState); }
698};
699
700template <typename T>
701ScopedDbgInfoFormatSetter(T &Obj,
702bool NewState) ->ScopedDbgInfoFormatSetter<T>;
703
704}// namespace llvm
705
706#endif// LLVM_IR_DEBUGPROGRAMINSTRUCTION_H
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition:ARMSLSHardening.cpp:73
From
BlockVerifier::State From
Definition:BlockVerifier.cpp:57
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
DEFINE_ISA_CONVERSION_FUNCTIONS
#define DEFINE_ISA_CONVERSION_FUNCTIONS(ty, ref)
Definition:CBindingWrapping.h:28
Casting.h
DbgVariableFragmentInfo.h
DebugLoc.h
Instruction.h
I
#define I(x, y, z)
Definition:MD5.cpp:58
Module
Machine Check Debug Module
Definition:MachineCheckDebugify.cpp:124
Range
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
OS
raw_pwrite_stream & OS
Definition:SampleProfWriter.cpp:51
SymbolTableListTraits.h
RHS
Value * RHS
Definition:X86PartialReduction.cpp:74
NewExpr
Definition:ItaniumDemangle.h:2103
T
bool
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition:ArrayRef.h:41
llvm::BasicBlock
LLVM Basic Block Representation.
Definition:BasicBlock.h:61
llvm::DIAssignID
Assignment ID.
Definition:DebugInfoMetadata.h:309
llvm::DIExpression
DWARF expression.
Definition:DebugInfoMetadata.h:2763
llvm::DILabel
Label.
Definition:DebugInfoMetadata.h:3551
llvm::DILocalVariable
Local variable.
Definition:DebugInfoMetadata.h:3460
llvm::DILocation
Debug location.
Definition:DebugInfoMetadata.h:1988
llvm::DbgInfoIntrinsic
This is the common base class for debug info intrinsics.
Definition:IntrinsicInst.h:181
llvm::DbgLabelInst
This represents the llvm.dbg.label instruction.
Definition:IntrinsicInst.h:543
llvm::DbgLabelRecord
Records a position in IR for a source label (DILabel).
Definition:DebugProgramInstruction.h:231
llvm::DbgLabelRecord::getRawLabel
MDNode * getRawLabel() const
Definition:DebugProgramInstruction.h:257
llvm::DbgLabelRecord::clone
DbgLabelRecord * clone() const
Definition:DebugProgramInstruction.cpp:398
llvm::DbgLabelRecord::classof
static bool classof(const DbgRecord *E)
Support type inquiry through isa, cast, and dyn_cast.
Definition:DebugProgramInstruction.h:260
llvm::DbgLabelRecord::print
void print(raw_ostream &O, bool IsForDebug=false) const
Definition:AsmWriter.cpp:5022
llvm::DbgLabelRecord::createUnresolvedDbgLabelRecord
static DbgLabelRecord * createUnresolvedDbgLabelRecord(MDNode *Label, MDNode *DL)
For use during parsing; creates a DbgLabelRecord from as-of-yet unresolved MDNodes.
Definition:DebugProgramInstruction.cpp:156
llvm::DbgLabelRecord::setLabel
void setLabel(DILabel *NewLabel)
Definition:DebugProgramInstruction.h:255
llvm::DbgLabelRecord::getLabel
DILabel * getLabel() const
Definition:DebugProgramInstruction.h:256
llvm::DbgLabelRecord::createDebugIntrinsic
DbgLabelInst * createDebugIntrinsic(Module *M, Instruction *InsertBefore) const
Definition:DebugProgramInstruction.cpp:460
llvm::DbgMarker
Per-instruction record of debug-info.
Definition:DebugProgramInstruction.h:583
llvm::DbgMarker::getEmptyDbgRecordRange
static iterator_range< simple_ilist< DbgRecord >::iterator > getEmptyDbgRecordRange()
Definition:DebugProgramInstruction.h:661
llvm::DbgMarker::removeFromParent
void removeFromParent()
Definition:DebugProgramInstruction.cpp:654
llvm::DbgMarker::dump
void dump() const
Definition:AsmWriter.cpp:5308
llvm::DbgMarker::MarkedInstr
Instruction * MarkedInstr
Link back to the Instruction that owns this marker.
Definition:DebugProgramInstruction.h:588
llvm::DbgMarker::cloneDebugInfoFrom
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.
Definition:DebugProgramInstruction.cpp:723
llvm::DbgMarker::insertDbgRecordAfter
void insertDbgRecordAfter(DbgRecord *New, DbgRecord *InsertAfter)
Insert a DbgRecord after a DbgRecord contained within this marker.
Definition:DebugProgramInstruction.cpp:695
llvm::DbgMarker::print
void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on DbgMarker.
Definition:AsmWriter.cpp:4995
llvm::DbgMarker::DbgMarker
DbgMarker()
Definition:DebugProgramInstruction.h:585
llvm::DbgMarker::removeMarker
void removeMarker()
Handle the removal of a marker: the position of debug-info has gone away, but the stored debug record...
Definition:DebugProgramInstruction.cpp:622
llvm::DbgMarker::absorbDebugValues
void absorbDebugValues(DbgMarker &Src, bool InsertAtHead)
Transfer any DbgRecords from Src into this DbgMarker.
Definition:DebugProgramInstruction.cpp:702
llvm::DbgMarker::dropDbgRecords
void dropDbgRecords()
Erase all DbgRecords in this DbgMarker.
Definition:DebugProgramInstruction.cpp:601
llvm::DbgMarker::getDbgRecordRange
iterator_range< simple_ilist< DbgRecord >::iterator > getDbgRecordRange()
Produce a range over all the DbgRecords in this Marker.
Definition:DebugProgramInstruction.cpp:666
llvm::DbgMarker::dropOneDbgRecord
void dropOneDbgRecord(DbgRecord *DR)
Erase a single DbgRecord from this marker.
Definition:DebugProgramInstruction.cpp:610
llvm::DbgMarker::getParent
const BasicBlock * getParent() const
Definition:DebugProgramInstruction.cpp:616
llvm::DbgMarker::StoredDbgRecords
simple_ilist< DbgRecord > StoredDbgRecords
List of DbgRecords, the non-instruction equivalent of llvm.dbg.
Definition:DebugProgramInstruction.h:594
llvm::DbgMarker::eraseFromParent
void eraseFromParent()
Definition:DebugProgramInstruction.cpp:659
llvm::DbgMarker::insertDbgRecord
void insertDbgRecord(DbgRecord *New, bool InsertAtHead)
Insert a DbgRecord into this DbgMarker, at the end of the list.
Definition:DebugProgramInstruction.cpp:684
llvm::DbgMarker::empty
bool empty() const
Definition:DebugProgramInstruction.h:595
llvm::DbgMarker::EmptyDbgMarker
static DbgMarker EmptyDbgMarker
We generally act like all llvm Instructions have a range of DbgRecords attached to them,...
Definition:DebugProgramInstruction.h:659
llvm::DbgRecordParamRef
A typed tracking MDNode reference that does not require a definition for its parameter type.
Definition:DebugProgramInstruction.h:76
llvm::DbgRecordParamRef::operator*
T & operator*() const
Definition:DebugProgramInstruction.h:101
llvm::DbgRecordParamRef::get
T * get() const
Get the underlying type.
Definition:DebugProgramInstruction.cpp:23
llvm::DbgRecordParamRef::operator!=
bool operator!=(const DbgRecordParamRef &Other) const
Definition:DebugProgramInstruction.h:115
llvm::DbgRecordParamRef::DbgRecordParamRef
DbgRecordParamRef()=default
llvm::DbgRecordParamRef::operator->
T * operator->() const
Definition:DebugProgramInstruction.h:100
llvm::DbgRecordParamRef::getAsMDNode
MDNode * getAsMDNode() const
Return this as a MDNode.
Definition:DebugProgramInstruction.h:110
llvm::DbgRecordParamRef::operator==
bool operator==(const DbgRecordParamRef &Other) const
Definition:DebugProgramInstruction.h:112
llvm::DbgRecord
Base class for non-instruction debug metadata records that have positions within IR.
Definition:DebugProgramInstruction.h:134
llvm::DbgRecord::insertAfter
void insertAfter(DbgRecord *InsertAfter)
Definition:DebugProgramInstruction.cpp:543
llvm::DbgRecord::removeFromParent
void removeFromParent()
Definition:DebugProgramInstruction.cpp:674
llvm::DbgRecord::getFunction
Function * getFunction()
Definition:DebugProgramInstruction.cpp:517
llvm::DbgRecord::print
void print(raw_ostream &O, bool IsForDebug=false) const
Definition:DebugProgramInstruction.cpp:91
llvm::DbgRecord::getBlock
BasicBlock * getBlock()
Definition:DebugProgramInstruction.cpp:513
llvm::DbgRecord::isEquivalentTo
bool isEquivalentTo(const DbgRecord &R) const
Same as isIdenticalToWhenDefined but checks DebugLoc too.
Definition:DebugProgramInstruction.cpp:130
llvm::DbgRecord::DbgRecord
DbgRecord(Kind RecordKind, DebugLoc DL)
Definition:DebugProgramInstruction.h:146
llvm::DbgRecord::self_iterator
simple_ilist< DbgRecord >::iterator self_iterator
Definition:DebugProgramInstruction.h:213
llvm::DbgRecord::getDebugLoc
DebugLoc getDebugLoc() const
Definition:DebugProgramInstruction.h:208
llvm::DbgRecord::dump
void dump() const
Definition:AsmWriter.cpp:5315
llvm::DbgRecord::createDebugIntrinsic
DbgInfoIntrinsic * createDebugIntrinsic(Module *M, Instruction *InsertBefore) const
Convert this DbgRecord back into an appropriate llvm.dbg.
Definition:DebugProgramInstruction.cpp:135
llvm::DbgRecord::RecordKind
Kind RecordKind
Subclass discriminator.
Definition:DebugProgramInstruction.h:143
llvm::DbgRecord::deleteRecord
void deleteRecord()
Methods that dispatch to subclass implementations.
Definition:DebugProgramInstruction.cpp:79
llvm::DbgRecord::insertBefore
void insertBefore(DbgRecord *InsertBefore)
Definition:DebugProgramInstruction.cpp:535
llvm::DbgRecord::~DbgRecord
~DbgRecord()=default
Similarly to Value, we avoid paying the cost of a vtable by protecting the dtor and having deleteReco...
llvm::DbgRecord::DbgLoc
DebugLoc DbgLoc
Definition:DebugProgramInstruction.h:142
llvm::DbgRecord::getNextNode
DbgRecord * getNextNode()
Definition:DebugProgramInstruction.h:193
llvm::DbgRecord::eraseFromParent
void eraseFromParent()
Definition:DebugProgramInstruction.cpp:679
llvm::DbgRecord::moveBefore
void moveBefore(DbgRecord *MoveBefore)
Definition:DebugProgramInstruction.cpp:569
llvm::DbgRecord::getModule
Module * getModule()
Definition:DebugProgramInstruction.cpp:523
llvm::DbgRecord::const_self_iterator
simple_ilist< DbgRecord >::const_iterator const_self_iterator
Definition:DebugProgramInstruction.h:214
llvm::DbgRecord::Kind
Kind
Subclass discriminator.
Definition:DebugProgramInstruction.h:139
llvm::DbgRecord::ValueKind
@ ValueKind
Definition:DebugProgramInstruction.h:139
llvm::DbgRecord::LabelKind
@ LabelKind
Definition:DebugProgramInstruction.h:139
llvm::DbgRecord::setDebugLoc
void setDebugLoc(DebugLoc Loc)
Definition:DebugProgramInstruction.h:209
llvm::DbgRecord::getInstruction
const Instruction * getInstruction() const
Definition:DebugProgramInstruction.cpp:503
llvm::DbgRecord::getMarker
DbgMarker * getMarker()
Definition:DebugProgramInstruction.h:171
llvm::DbgRecord::moveAfter
void moveAfter(DbgRecord *MoveAfter)
Definition:DebugProgramInstruction.cpp:575
llvm::DbgRecord::isIdenticalToWhenDefined
bool isIdenticalToWhenDefined(const DbgRecord &R) const
Definition:DebugProgramInstruction.cpp:116
llvm::DbgRecord::getRecordKind
Kind getRecordKind() const
Definition:DebugProgramInstruction.h:167
llvm::DbgRecord::getMarker
const DbgMarker * getMarker() const
Definition:DebugProgramInstruction.h:172
llvm::DbgRecord::Marker
DbgMarker * Marker
Marker that this DbgRecord is linked into.
Definition:DebugProgramInstruction.h:137
llvm::DbgRecord::setMarker
void setMarker(DbgMarker *M)
Definition:DebugProgramInstruction.h:169
llvm::DbgRecord::clone
DbgRecord * clone() const
Definition:DebugProgramInstruction.cpp:384
llvm::DbgRecord::getContext
LLVMContext & getContext()
Definition:DebugProgramInstruction.cpp:529
llvm::DbgRecord::getPrevNode
DbgRecord * getPrevNode()
Definition:DebugProgramInstruction.h:194
llvm::DbgRecord::getParent
const BasicBlock * getParent() const
Definition:DebugProgramInstruction.cpp:507
llvm::DbgVariableIntrinsic
This is the common base class for debug info intrinsics for variables.
Definition:IntrinsicInst.h:308
llvm::DbgVariableRecord::location_op_iterator
Iterator for ValueAsMetadata that internally uses direct pointer iteration over either a ValueAsMetad...
Definition:DebugProgramInstruction.h:366
llvm::DbgVariableRecord::location_op_iterator::location_op_iterator
location_op_iterator(ValueAsMetadata **MultiIter)
Definition:DebugProgramInstruction.h:371
llvm::DbgVariableRecord::location_op_iterator::operator--
location_op_iterator & operator--()
Definition:DebugProgramInstruction.h:400
llvm::DbgVariableRecord::location_op_iterator::operator*
Value * operator*()
Definition:DebugProgramInstruction.h:387
llvm::DbgVariableRecord::location_op_iterator::location_op_iterator
location_op_iterator(ValueAsMetadata *SingleIter)
Definition:DebugProgramInstruction.h:370
llvm::DbgVariableRecord::location_op_iterator::operator==
bool operator==(const location_op_iterator &RHS) const
Definition:DebugProgramInstruction.h:378
llvm::DbgVariableRecord::location_op_iterator::operator++
location_op_iterator & operator++()
Definition:DebugProgramInstruction.h:393
llvm::DbgVariableRecord::location_op_iterator::operator=
location_op_iterator & operator=(const location_op_iterator &R)
Definition:DebugProgramInstruction.h:374
llvm::DbgVariableRecord::location_op_iterator::operator*
const Value * operator*() const
Definition:DebugProgramInstruction.h:381
llvm::DbgVariableRecord::location_op_iterator::location_op_iterator
location_op_iterator(const location_op_iterator &R)
Definition:DebugProgramInstruction.h:373
llvm::DbgVariableRecord
Record of a variable value-assignment, aka a non instruction representation of the dbg....
Definition:DebugProgramInstruction.h:270
llvm::DbgVariableRecord::isDbgValue
bool isDbgValue() const
Definition:DebugProgramInstruction.h:410
llvm::DbgVariableRecord::isEquivalentTo
bool isEquivalentTo(const DbgVariableRecord &Other) const
Definition:DebugProgramInstruction.h:492
llvm::DbgVariableRecord::getType
LocationType getType() const
Definition:DebugProgramInstruction.h:443
llvm::DbgVariableRecord::Expression
DbgRecordParamRef< DIExpression > Expression
Definition:DebugProgramInstruction.h:293
llvm::DbgVariableRecord::isValueOfVariable
bool isValueOfVariable() const
Determine if this describes the value of a local variable.
Definition:DebugProgramInstruction.h:441
llvm::DbgVariableRecord::isKillAddress
bool isKillAddress() const
Check whether this kills the address component.
Definition:DebugProgramInstruction.cpp:498
llvm::DbgVariableRecord::print
void print(raw_ostream &O, bool IsForDebug=false) const
Definition:AsmWriter.cpp:5001
llvm::DbgVariableRecord::hasValidLocation
bool hasValidLocation() const
Returns true if this DbgVariableRecord has no empty MDNodes in its location list.
Definition:DebugProgramInstruction.h:433
llvm::DbgVariableRecord::Type
LocationType Type
Classification of the debug-info record that this DbgVariableRecord represents.
Definition:DebugProgramInstruction.h:286
llvm::DbgVariableRecord::getRawExpression
MDNode * getRawExpression() const
Definition:DebugProgramInstruction.h:454
llvm::DbgVariableRecord::Variable
DbgRecordParamRef< DILocalVariable > Variable
Definition:DebugProgramInstruction.h:292
llvm::DbgVariableRecord::setAddressExpression
void setAddressExpression(DIExpression *NewExpr)
Definition:DebugProgramInstruction.h:518
llvm::DbgVariableRecord::isKillLocation
bool isKillLocation() const
Definition:DebugProgramInstruction.cpp:368
llvm::DbgVariableRecord::getAssignID
DIAssignID * getAssignID() const
Definition:DebugProgramInstruction.cpp:485
llvm::DbgVariableRecord::getFragmentOrEntireVariable
DbgVariableFragmentInfo getFragmentOrEntireVariable() const
Get the FragmentInfo for the variable if it exists, otherwise return a FragmentInfo that covers the e...
Definition:DebugProgramInstruction.h:481
llvm::DbgVariableRecord::getRawAddressExpression
MDNode * getRawAddressExpression() const
Definition:DebugProgramInstruction.h:515
llvm::DbgVariableRecord::isAddressOfVariable
bool isAddressOfVariable() const
Does this describe the address of a local variable.
Definition:DebugProgramInstruction.h:437
llvm::DbgVariableRecord::getFragmentSizeInBits
std::optional< uint64_t > getFragmentSizeInBits() const
Get the size (in bits) of the variable, or fragment of the variable that is described.
Definition:DebugProgramInstruction.cpp:378
llvm::DbgVariableRecord::getValue
Value * getValue(unsigned OpIdx=0) const
Definition:DebugProgramInstruction.h:462
llvm::DbgVariableRecord::clone
DbgVariableRecord * clone() const
Definition:DebugProgramInstruction.cpp:394
llvm::DbgVariableRecord::setKillLocation
void setKillLocation()
Definition:DebugProgramInstruction.cpp:356
llvm::DbgVariableRecord::createUnresolvedDbgVariableRecord
static 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...
Definition:DebugProgramInstruction.cpp:170
llvm::DbgVariableRecord::setRawLocation
void setRawLocation(Metadata *NewLocation)
Use of this should generally be avoided; instead, replaceVariableLocationOp and addVariableLocationOp...
Definition:DebugProgramInstruction.h:469
llvm::DbgVariableRecord::createDbgVariableRecord
static DbgVariableRecord * createDbgVariableRecord(Value *Location, DILocalVariable *DV, DIExpression *Expr, const DILocation *DI)
Definition:DebugProgramInstruction.cpp:179
llvm::DbgVariableRecord::createDVRDeclare
static DbgVariableRecord * createDVRDeclare(Value *Address, DILocalVariable *DV, DIExpression *Expr, const DILocation *DI)
Definition:DebugProgramInstruction.cpp:194
llvm::DbgVariableRecord::setVariable
void setVariable(DILocalVariable *NewVar)
Definition:DebugProgramInstruction.h:448
llvm::DbgVariableRecord::getAddress
Value * getAddress() const
Definition:DebugProgramInstruction.cpp:474
llvm::DbgVariableRecord::isDbgAssign
bool isDbgAssign() const
Definition:DebugProgramInstruction.h:506
llvm::DbgVariableRecord::setExpression
void setExpression(DIExpression *NewExpr)
Definition:DebugProgramInstruction.h:452
llvm::DbgVariableRecord::getExpression
DIExpression * getExpression() const
Definition:DebugProgramInstruction.h:453
llvm::DbgVariableRecord::handleChangedLocation
void handleChangedLocation(Metadata *NewLocation)
Handle changes to the location of the Value(s) that we refer to happening "under our feet".
llvm::DbgVariableRecord::getRawAssignID
Metadata * getRawAssignID() const
Definition:DebugProgramInstruction.h:512
llvm::DbgVariableRecord::getVariableLocationOp
Value * getVariableLocationOp(unsigned OpIdx) const
Definition:DebugProgramInstruction.cpp:263
llvm::DbgVariableRecord::setKillAddress
void setKillAddress()
Kill the address component.
Definition:DebugProgramInstruction.cpp:493
llvm::DbgVariableRecord::getRawVariable
MDNode * getRawVariable() const
Definition:DebugProgramInstruction.h:450
llvm::DbgVariableRecord::getVariable
DILocalVariable * getVariable() const
Definition:DebugProgramInstruction.h:449
llvm::DbgVariableRecord::classof
static bool classof(const DbgRecord *E)
Support type inquiry through isa, cast, and dyn_cast.
Definition:DebugProgramInstruction.h:548
llvm::DbgVariableRecord::addVariableLocationOps
void addVariableLocationOps(ArrayRef< Value * > NewValues, DIExpression *NewExpr)
Adding a new location operand will always result in this intrinsic using an ArgList,...
Definition:DebugProgramInstruction.cpp:340
llvm::DbgVariableRecord::getRawLocation
Metadata * getRawLocation() const
Returns the metadata operand for the first location description.
Definition:DebugProgramInstruction.h:460
llvm::DbgVariableRecord::isDbgDeclare
bool isDbgDeclare() const
Definition:DebugProgramInstruction.h:409
llvm::DbgVariableRecord::setAssignId
void setAssignId(DIAssignID *New)
Definition:DebugProgramInstruction.cpp:489
llvm::DbgVariableRecord::setAddress
void setAddress(Value *V)
Definition:DebugProgramInstruction.h:522
llvm::DbgVariableRecord::createDVRAssign
static DbgVariableRecord * createDVRAssign(Value *Val, DILocalVariable *Variable, DIExpression *Expression, DIAssignID *AssignID, Value *Address, DIExpression *AddressExpression, const DILocation *DI)
Definition:DebugProgramInstruction.cpp:211
llvm::DbgVariableRecord::getNumVariableLocationOps
unsigned getNumVariableLocationOps() const
Definition:DebugProgramInstruction.cpp:257
llvm::DbgVariableRecord::createDebugIntrinsic
DbgVariableIntrinsic * createDebugIntrinsic(Module *M, Instruction *InsertBefore) const
Convert this DbgVariableRecord back into a dbg.value intrinsic.
Definition:DebugProgramInstruction.cpp:403
llvm::DbgVariableRecord::getRawAddress
Metadata * getRawAddress() const
Definition:DebugProgramInstruction.h:509
llvm::DbgVariableRecord::replaceVariableLocationOp
void replaceVariableLocationOp(Value *OldValue, Value *NewValue, bool AllowEmpty=false)
Definition:DebugProgramInstruction.cpp:286
llvm::DbgVariableRecord::LocationType
LocationType
Definition:DebugProgramInstruction.h:274
llvm::DbgVariableRecord::LocationType::Assign
@ Assign
llvm::DbgVariableRecord::LocationType::Declare
@ Declare
llvm::DbgVariableRecord::LocationType::Value
@ Value
llvm::DbgVariableRecord::LocationType::End
@ End
Marks the end of the concrete types.
llvm::DbgVariableRecord::LocationType::Any
@ Any
To indicate all LocationTypes in searches.
llvm::DbgVariableRecord::getFragment
std::optional< DbgVariableFragmentInfo > getFragment() const
Definition:DebugProgramInstruction.cpp:374
llvm::DbgVariableRecord::createLinkedDVRAssign
static DbgVariableRecord * createLinkedDVRAssign(Instruction *LinkedInstr, Value *Val, DILocalVariable *Variable, DIExpression *Expression, Value *Address, DIExpression *AddressExpression, const DILocation *DI)
Definition:DebugProgramInstruction.cpp:220
llvm::DbgVariableRecord::isIdenticalToWhenDefined
bool isIdenticalToWhenDefined(const DbgVariableRecord &Other) const
Definition:DebugProgramInstruction.h:497
llvm::DbgVariableRecord::AddressExpression
DbgRecordParamRef< DIExpression > AddressExpression
Definition:DebugProgramInstruction.h:294
llvm::DbgVariableRecord::hasArgList
bool hasArgList() const
Definition:DebugProgramInstruction.h:430
llvm::DbgVariableRecord::getAddressExpression
DIExpression * getAddressExpression() const
Definition:DebugProgramInstruction.h:514
llvm::DbgVariableRecord::location_ops
iterator_range< location_op_iterator > location_ops() const
Get the locations corresponding to the variable referenced by the debug info intrinsic.
Definition:DebugProgramInstruction.cpp:234
llvm::DebugLoc
A debug info location.
Definition:DebugLoc.h:33
llvm::DebugValueUser
Base class for tracking ValueAsMetadata/DIArgLists with user lookups and Owner callbacks outside of V...
Definition:Metadata.h:216
llvm::DebugValueUser::DebugValues
std::array< Metadata *, 3 > DebugValues
Definition:Metadata.h:222
llvm::DebugValueUser::resetDebugValue
void resetDebugValue(size_t Idx, Metadata *DebugValue)
Definition:Metadata.h:277
llvm::Expression
Class representing an expression and its matching format.
Definition:FileCheckImpl.h:189
llvm::Function
Definition:Function.h:63
llvm::Instruction
Definition:Instruction.h:68
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition:LLVMContext.h:67
llvm::MDNode
Metadata node.
Definition:Metadata.h:1073
llvm::Metadata
Root of the metadata hierarchy.
Definition:Metadata.h:62
llvm::ModuleSlotTracker
Manage lifetime of a slot tracker for printing IR.
Definition:ModuleSlotTracker.h:44
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition:Module.h:65
llvm::PointerUnion
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
Definition:PointerUnion.h:118
llvm::ScopedDbgInfoFormatSetter
Used to temporarily set the debug info format of a function, module, or basic block for the duration ...
Definition:DebugProgramInstruction.h:688
llvm::ScopedDbgInfoFormatSetter::ScopedDbgInfoFormatSetter
ScopedDbgInfoFormatSetter(T &Obj, bool NewState)
Definition:DebugProgramInstruction.h:693
llvm::ScopedDbgInfoFormatSetter::~ScopedDbgInfoFormatSetter
~ScopedDbgInfoFormatSetter()
Definition:DebugProgramInstruction.h:697
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition:Type.h:45
llvm::TypedTrackingMDRef< MDNode >
llvm::ValueAsMetadata
Value wrapper in the Metadata hierarchy.
Definition:Metadata.h:454
llvm::ValueAsMetadata::get
static ValueAsMetadata * get(Value *V)
Definition:Metadata.cpp:501
llvm::ValueAsMetadata::getValue
Value * getValue() const
Definition:Metadata.h:494
llvm::Value
LLVM Value Representation.
Definition:Value.h:74
llvm::ilist_node_impl::getIterator
self_iterator getIterator()
Definition:ilist_node.h:132
llvm::ilist_node
Definition:ilist_node.h:215
llvm::iterator_facade_base
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition:iterator.h:80
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition:iterator_range.h:42
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition:raw_ostream.h:52
llvm::simple_ilist
A simple intrusive list implementation.
Definition:simple_ilist.h:81
llvm::simple_ilist::iterator
typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, false, false >::type iterator
Definition:simple_ilist.h:97
llvm::simple_ilist::const_iterator
typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, false, true >::type const_iterator
Definition:simple_ilist.h:100
uint8_t
LLVMDbgRecordRef
struct LLVMOpaqueDbgRecord * LLVMDbgRecordRef
Definition:Types.h:175
ilist.h
This file defines classes to implement an intrusive doubly linked list class (i.e.
ilist_node.h
This file defines the ilist_node class template, which is a convenient base class for creating classe...
iterator.h
llvm::ISD::BasicBlock
@ BasicBlock
Various leaf nodes.
Definition:ISDOpcodes.h:71
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition:iterator_range.h:77
llvm::map_range
auto map_range(ContainerTy &&C, FuncTy F)
Definition:STLExtras.h:377
llvm::make_filter_range
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:573
llvm::getDbgRecordRange
iterator_range< simple_ilist< DbgRecord >::iterator > getDbgRecordRange(DbgMarker *DebugMarker)
Inline helper to return a range of DbgRecords attached to a marker.
Definition:DebugProgramInstruction.h:677
llvm::CaptureComponents::Address
@ Address
llvm::IRMemLocation::Other
@ Other
Any other memory.
llvm::operator<<
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition:APFixedPoint.h:303
llvm::filterDbgVars
static auto filterDbgVars(iterator_range< simple_ilist< DbgRecord >::iterator > R)
Filter the DbgRecord range to DbgVariableRecord types only and downcast.
Definition:DebugProgramInstruction.h:555
llvm::DbgVariableFragmentInfo
Definition:DbgVariableFragmentInfo.h:18

Generated on Fri Jul 18 2025 09:25:09 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp