Skip to content

Commit 75dfa58

Browse files
authored
[RemoveDIs][NFC] Rename DPMarker->DbgMarker (#85931)
Another trivial rename patch, the last big one for now, which renamed DPMarkers to DbgMarkers. This required the field `DbgMarker` in `Instruction` to be renamed to `DebugMarker` to avoid a clash, but otherwise was a simple string substitution of `s/DPMarker/DbgMarker` and a manual renaming of `DPM` to `DM` in the few places where that acronym was used for debug markers.
1 parent eb861ac commit 75dfa58

17 files changed

+292
-279
lines changed

llvm/docs/RemoveDIsDebugInfo.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,18 @@ Like so:
8282
|
8383
|
8484
v
85-
+------------+
86-
<-------+ DPMarker |<-------
87-
/ +------------+ \
88-
/ \
89-
/ \
90-
v ^
85+
+-------------+
86+
<-------+ DbgMarker |<-------
87+
/ +-------------+ \
88+
/ \
89+
/ \
90+
v ^
9191
+-------------+ +-------------+ +-------------+
9292
| DbgRecord +--->| DbgRecord +-->| DbgRecord |
9393
+-------------+ +-------------+ +-------------+
9494
```
9595

96-
Each instruction has a pointer to a `DPMarker` (which will become optional), that contains a list of `DbgRecord` objects. No debugging records appear in the instruction list at all. `DbgRecord`s have a parent pointer to their owning `DPMarker`, and each `DPMarker` has a pointer back to it's owning instruction.
96+
Each instruction has a pointer to a `DbgMarker` (which will become optional), that contains a list of `DbgRecord` objects. No debugging records appear in the instruction list at all. `DbgRecord`s have a parent pointer to their owning `DbgMarker`, and each `DbgMarker` has a pointer back to it's owning instruction.
9797

9898
Not shown are the links from DbgRecord to other parts of the `Value`/`Metadata` hierachy: `DbgRecord` subclasses have tracking pointers to the DIMetadata that they use, and `DbgVariableRecord` has references to `Value`s that are stored in a `DebugValueUser` base class. This refers to a `ValueAsMetadata` object referring to `Value`s, via the `TrackingMetadata` facility.
9999

llvm/include/llvm/IR/BasicBlock.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Module;
3939
class PHINode;
4040
class ValueSymbolTable;
4141
class DbgVariableRecord;
42-
class DPMarker;
42+
class DbgMarker;
4343

4444
/// LLVM Basic Block Representation
4545
///
@@ -72,18 +72,18 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
7272
Function *Parent;
7373

7474
public:
75-
/// Attach a DPMarker to the given instruction. Enables the storage of any
75+
/// Attach a DbgMarker to the given instruction. Enables the storage of any
7676
/// debug-info at this position in the program.
77-
DPMarker *createMarker(Instruction *I);
78-
DPMarker *createMarker(InstListType::iterator It);
77+
DbgMarker *createMarker(Instruction *I);
78+
DbgMarker *createMarker(InstListType::iterator It);
7979

8080
/// Convert variable location debugging information stored in dbg.value
81-
/// intrinsics into DPMarkers / DbgRecords. Deletes all dbg.values in
81+
/// intrinsics into DbgMarkers / DbgRecords. Deletes all dbg.values in
8282
/// the process and sets IsNewDbgInfoFormat = true. Only takes effect if
8383
/// the UseNewDbgInfoFormat LLVM command line option is given.
8484
void convertToNewDbgValues();
8585

86-
/// Convert variable location debugging information stored in DPMarkers and
86+
/// Convert variable location debugging information stored in DbgMarkers and
8787
/// DbgRecords into the dbg.value intrinsic representation. Sets
8888
/// IsNewDbgInfoFormat = false.
8989
void convertFromNewDbgValues();
@@ -97,28 +97,28 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
9797
/// instruction of this block. These are equivalent to dbg.value intrinsics
9898
/// that exist at the end of a basic block with no terminator (a transient
9999
/// state that occurs regularly).
100-
void setTrailingDbgRecords(DPMarker *M);
100+
void setTrailingDbgRecords(DbgMarker *M);
101101

102102
/// Fetch the collection of DbgRecords that "trail" after the last instruction
103103
/// of this block, see \ref setTrailingDbgRecords. If there are none, returns
104104
/// nullptr.
105-
DPMarker *getTrailingDbgRecords();
105+
DbgMarker *getTrailingDbgRecords();
106106

107107
/// Delete any trailing DbgRecords at the end of this block, see
108108
/// \ref setTrailingDbgRecords.
109109
void deleteTrailingDbgRecords();
110110

111111
void dumpDbgValues() const;
112112

113-
/// Return the DPMarker for the position given by \p It, so that DbgRecords
113+
/// Return the DbgMarker for the position given by \p It, so that DbgRecords
114114
/// can be inserted there. This will either be nullptr if not present, a
115-
/// DPMarker, or TrailingDbgRecords if It is end().
116-
DPMarker *getMarker(InstListType::iterator It);
115+
/// DbgMarker, or TrailingDbgRecords if It is end().
116+
DbgMarker *getMarker(InstListType::iterator It);
117117

118-
/// Return the DPMarker for the position that comes after \p I. \see
119-
/// BasicBlock::getMarker, this can be nullptr, a DPMarker, or
118+
/// Return the DbgMarker for the position that comes after \p I. \see
119+
/// BasicBlock::getMarker, this can be nullptr, a DbgMarker, or
120120
/// TrailingDbgRecords if there is no next instruction.
121-
DPMarker *getNextMarker(Instruction *I);
121+
DbgMarker *getNextMarker(Instruction *I);
122122

123123
/// Insert a DbgRecord into a block at the position given by \p I.
124124
void insertDbgRecordAfter(DbgRecord *DR, Instruction *I);

llvm/include/llvm/IR/DebugProgramInstruction.h

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@
1616
//
1717
// and all information is stored in the Value / Metadata hierachy defined
1818
// elsewhere in LLVM. In the "DbgRecord" design, each instruction /may/ have a
19-
// connection with a DPMarker, which identifies a position immediately before
20-
// the instruction, and each DPMarker /may/ then have connections to DbgRecords
19+
// connection with a DbgMarker, which identifies a position immediately before
20+
// the instruction, and each DbgMarker /may/ then have connections to DbgRecords
2121
// which record the variable assignment information. To illustrate:
2222
//
2323
// %foo = add i32 1, %0
24-
// ; foo->DbgMarker == nullptr
24+
// ; foo->DebugMarker == nullptr
2525
// ;; There are no variable assignments / debug records "in front" of
26-
// ;; the instruction for %foo, therefore it has no DbgMarker.
26+
// ;; the instruction for %foo, therefore it has no DebugMarker.
2727
// %bar = void call @ext(%foo)
28-
// ; bar->DbgMarker = {
28+
// ; bar->DebugMarker = {
2929
// ; StoredDbgRecords = {
3030
// ; DbgVariableRecord(metadata i32 %foo, ...)
3131
// ; }
3232
// ; }
3333
// ;; There is a debug-info record in front of the %bar instruction,
34-
// ;; thus it points at a DPMarker object. That DPMarker contains a
34+
// ;; thus it points at a DbgMarker object. That DbgMarker contains a
3535
// ;; DbgVariableRecord in it's ilist, storing the equivalent information
3636
// to the
3737
// ;; dbg.value above: the Value, DILocalVariable, etc.
@@ -66,7 +66,7 @@ class DbgVariableIntrinsic;
6666
class DbgInfoIntrinsic;
6767
class DbgLabelInst;
6868
class DIAssignID;
69-
class DPMarker;
69+
class DbgMarker;
7070
class DbgVariableRecord;
7171
class raw_ostream;
7272

@@ -120,7 +120,7 @@ template <typename T> class DbgRecordParamRef {
120120
/// Base class for non-instruction debug metadata records that have positions
121121
/// within IR. Features various methods copied across from the Instruction
122122
/// class to aid ease-of-use. DbgRecords should always be linked into a
123-
/// DPMarker's StoredDbgRecords list. The marker connects a DbgRecord back to
123+
/// DbgMarker's StoredDbgRecords list. The marker connects a DbgRecord back to
124124
/// it's position in the BasicBlock.
125125
///
126126
/// We need a discriminator for dyn/isa casts. In order to avoid paying for a
@@ -134,7 +134,7 @@ template <typename T> class DbgRecordParamRef {
134134
class DbgRecord : public ilist_node<DbgRecord> {
135135
public:
136136
/// Marker that this DbgRecord is linked into.
137-
DPMarker *Marker = nullptr;
137+
DbgMarker *Marker = nullptr;
138138
/// Subclass discriminator.
139139
enum Kind : uint8_t { ValueKind, LabelKind };
140140

@@ -166,10 +166,10 @@ class DbgRecord : public ilist_node<DbgRecord> {
166166

167167
Kind getRecordKind() const { return RecordKind; }
168168

169-
void setMarker(DPMarker *M) { Marker = M; }
169+
void setMarker(DbgMarker *M) { Marker = M; }
170170

171-
DPMarker *getMarker() { return Marker; }
172-
const DPMarker *getMarker() const { return Marker; }
171+
DbgMarker *getMarker() { return Marker; }
172+
const DbgMarker *getMarker() const { return Marker; }
173173

174174
BasicBlock *getBlock();
175175
const BasicBlock *getBlock() const;
@@ -539,7 +539,7 @@ filterDbgVars(iterator_range<simple_ilist<DbgRecord>::iterator> R) {
539539
}
540540

541541
/// Per-instruction record of debug-info. If an Instruction is the position of
542-
/// some debugging information, it points at a DPMarker storing that info. Each
542+
/// some debugging information, it points at a DbgMarker storing that info. Each
543543
/// marker points back at the instruction that owns it. Various utilities are
544544
/// provided for manipulating the DbgRecords contained within this marker.
545545
///
@@ -559,9 +559,9 @@ filterDbgVars(iterator_range<simple_ilist<DbgRecord>::iterator> R) {
559559
/// which we can improve in the future. Additionally, many improvements in the
560560
/// way that debug-info is stored can be achieved in this class, at a future
561561
/// date.
562-
class DPMarker {
562+
class DbgMarker {
563563
public:
564-
DPMarker() {}
564+
DbgMarker() {}
565565
/// Link back to the Instruction that owns this marker. Can be null during
566566
/// operations that move a marker from one instruction to another.
567567
Instruction *MarkedInstr = nullptr;
@@ -585,30 +585,31 @@ class DPMarker {
585585
void removeFromParent();
586586
void eraseFromParent();
587587

588-
/// Implement operator<< on DPMarker.
588+
/// Implement operator<< on DbgMarker.
589589
void print(raw_ostream &O, bool IsForDebug = false) const;
590590
void print(raw_ostream &ROS, ModuleSlotTracker &MST, bool IsForDebug) const;
591591

592592
/// Produce a range over all the DbgRecords in this Marker.
593593
iterator_range<simple_ilist<DbgRecord>::iterator> getDbgRecordRange();
594594
iterator_range<simple_ilist<DbgRecord>::const_iterator>
595595
getDbgRecordRange() const;
596-
/// Transfer any DbgRecords from \p Src into this DPMarker. If \p InsertAtHead
597-
/// is true, place them before existing DbgRecords, otherwise afterwards.
598-
void absorbDebugValues(DPMarker &Src, bool InsertAtHead);
599-
/// Transfer the DbgRecords in \p Range from \p Src into this DPMarker. If
596+
/// Transfer any DbgRecords from \p Src into this DbgMarker. If \p
597+
/// InsertAtHead is true, place them before existing DbgRecords, otherwise
598+
/// afterwards.
599+
void absorbDebugValues(DbgMarker &Src, bool InsertAtHead);
600+
/// Transfer the DbgRecords in \p Range from \p Src into this DbgMarker. If
600601
/// \p InsertAtHead is true, place them before existing DbgRecords, otherwise
601602
// afterwards.
602603
void absorbDebugValues(iterator_range<DbgRecord::self_iterator> Range,
603-
DPMarker &Src, bool InsertAtHead);
604-
/// Insert a DbgRecord into this DPMarker, at the end of the list. If
604+
DbgMarker &Src, bool InsertAtHead);
605+
/// Insert a DbgRecord into this DbgMarker, at the end of the list. If
605606
/// \p InsertAtHead is true, at the start.
606607
void insertDbgRecord(DbgRecord *New, bool InsertAtHead);
607608
/// Insert a DbgRecord prior to a DbgRecord contained within this marker.
608609
void insertDbgRecord(DbgRecord *New, DbgRecord *InsertBefore);
609610
/// Insert a DbgRecord after a DbgRecord contained within this marker.
610611
void insertDbgRecordAfter(DbgRecord *New, DbgRecord *InsertAfter);
611-
/// Clone all DPMarkers from \p From into this marker. There are numerous
612+
/// Clone all DbgMarkers from \p From into this marker. There are numerous
612613
/// options to customise the source/destination, due to gnarliness, see class
613614
/// comment.
614615
/// \p FromHere If non-null, copy from FromHere to the end of From's
@@ -617,45 +618,45 @@ class DPMarker {
617618
/// StoredDbgRecords
618619
/// \returns Range over all the newly cloned DbgRecords
619620
iterator_range<simple_ilist<DbgRecord>::iterator>
620-
cloneDebugInfoFrom(DPMarker *From,
621+
cloneDebugInfoFrom(DbgMarker *From,
621622
std::optional<simple_ilist<DbgRecord>::iterator> FromHere,
622623
bool InsertAtHead = false);
623-
/// Erase all DbgRecords in this DPMarker.
624+
/// Erase all DbgRecords in this DbgMarker.
624625
void dropDbgRecords();
625626
/// Erase a single DbgRecord from this marker. In an ideal future, we would
626627
/// never erase an assignment in this way, but it's the equivalent to
627628
/// erasing a debug intrinsic from a block.
628629
void dropOneDbgRecord(DbgRecord *DR);
629630

630631
/// We generally act like all llvm Instructions have a range of DbgRecords
631-
/// attached to them, but in reality sometimes we don't allocate the DPMarker
632+
/// attached to them, but in reality sometimes we don't allocate the DbgMarker
632633
/// to save time and memory, but still have to return ranges of DbgRecords.
633634
/// When we need to describe such an unallocated DbgRecord range, use this
634635
/// static markers range instead. This will bite us if someone tries to insert
635636
/// a DbgRecord in that range, but they should be using the Official (TM) API
636637
/// for that.
637-
static DPMarker EmptyDPMarker;
638+
static DbgMarker EmptyDbgMarker;
638639
static iterator_range<simple_ilist<DbgRecord>::iterator>
639640
getEmptyDbgRecordRange() {
640-
return make_range(EmptyDPMarker.StoredDbgRecords.end(),
641-
EmptyDPMarker.StoredDbgRecords.end());
641+
return make_range(EmptyDbgMarker.StoredDbgRecords.end(),
642+
EmptyDbgMarker.StoredDbgRecords.end());
642643
}
643644
};
644645

645-
inline raw_ostream &operator<<(raw_ostream &OS, const DPMarker &Marker) {
646+
inline raw_ostream &operator<<(raw_ostream &OS, const DbgMarker &Marker) {
646647
Marker.print(OS);
647648
return OS;
648649
}
649650

650651
/// Inline helper to return a range of DbgRecords attached to a marker. It needs
651652
/// to be inlined as it's frequently called, but also come after the declaration
652-
/// of DPMarker. Thus: it's pre-declared by users like Instruction, then an
653+
/// of DbgMarker. Thus: it's pre-declared by users like Instruction, then an
653654
/// inlineable body defined here.
654655
inline iterator_range<simple_ilist<DbgRecord>::iterator>
655-
getDbgRecordRange(DPMarker *DbgMarker) {
656-
if (!DbgMarker)
657-
return DPMarker::getEmptyDbgRecordRange();
658-
return DbgMarker->getDbgRecordRange();
656+
getDbgRecordRange(DbgMarker *DebugMarker) {
657+
if (!DebugMarker)
658+
return DbgMarker::getEmptyDbgRecordRange();
659+
return DebugMarker->getDbgRecordRange();
659660
}
660661

661662
DEFINE_ISA_CONVERSION_FUNCTIONS(DbgRecord, LLVMDbgRecordRef)

llvm/include/llvm/IR/Instruction.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,20 @@
2929
namespace llvm {
3030

3131
class BasicBlock;
32-
class DPMarker;
32+
class DbgMarker;
3333
class FastMathFlags;
3434
class MDNode;
3535
class Module;
3636
struct AAMDNodes;
37-
class DPMarker;
37+
class DbgMarker;
3838
class DbgRecord;
3939

4040
template <> struct ilist_alloc_traits<Instruction> {
4141
static inline void deleteNode(Instruction *V);
4242
};
4343

44-
iterator_range<simple_ilist<DbgRecord>::iterator> getDbgRecordRange(DPMarker *);
44+
iterator_range<simple_ilist<DbgRecord>::iterator>
45+
getDbgRecordRange(DbgMarker *);
4546

4647
class Instruction : public User,
4748
public ilist_node_with_parent<Instruction, BasicBlock,
@@ -60,7 +61,7 @@ class Instruction : public User,
6061
/// Optional marker recording the position for debugging information that
6162
/// takes effect immediately before this instruction. Null unless there is
6263
/// debugging information present.
63-
DPMarker *DbgMarker = nullptr;
64+
DbgMarker *DebugMarker = nullptr;
6465

6566
/// Clone any debug-info attached to \p From onto this instruction. Used to
6667
/// copy debugging information from one block to another, when copying entire
@@ -81,7 +82,7 @@ class Instruction : public User,
8182

8283
/// Return a range over the DbgRecords attached to this instruction.
8384
iterator_range<simple_ilist<DbgRecord>::iterator> getDbgRecordRange() const {
84-
return llvm::getDbgRecordRange(DbgMarker);
85+
return llvm::getDbgRecordRange(DebugMarker);
8586
}
8687

8788
/// Return an iterator to the position of the "Next" DbgRecord after this

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3569,7 +3569,7 @@ void ModuleBitcodeWriter::writeFunction(
35693569
// Write out non-instruction debug information attached to this
35703570
// instruction. Write it after the instruction so that it's easy to
35713571
// re-attach to the instruction reading the records in.
3572-
for (DbgRecord &DR : I.DbgMarker->getDbgRecordRange()) {
3572+
for (DbgRecord &DR : I.DebugMarker->getDbgRecordRange()) {
35733573
if (DbgLabelRecord *DLR = dyn_cast<DbgLabelRecord>(&DR)) {
35743574
Vals.push_back(VE.getMetadataID(&*DLR->getDebugLoc()));
35753575
Vals.push_back(VE.getMetadataID(DLR->getLabel()));

0 commit comments

Comments
 (0)