Skip to content

Commit 360da83

Browse files
authored
[RemoveDI][NFC] Rename DPValue->DbgRecord in comments and varnames (#84939)
This patch continues the ongoing rename work, replacing DPValue with DbgRecord in comments and the names of variables, both members and fn-local. This is the most labour-intensive part of the rename, as it is where the most decisions have to be made about whether a given comment or variable is referring to DPValues (equivalent to debug variable intrinsics) or DbgRecords (a catch-all for all debug intrinsics); these decisions are not individually difficult, but comprise a fairly large amount of text to review. This patch still largely performs basic string substitutions followed by clang-format; there are almost* no places where, for example, a comment has been expanded or modified to reflect the semantic difference between DPValues and DbgRecords. I don't believe such a change is generally necessary in LLVM, but it may be useful in the docs, and so I'll be submitting docs changes as a separate patch. *In a few places, `dbg.values` was replaced with `debug intrinsics`.
1 parent 69afb9d commit 360da83

24 files changed

+330
-319
lines changed

llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ class IRTranslator : public MachineFunctionPass {
205205
bool translate(const Constant &C, Register Reg);
206206

207207
/// Examine any debug-info attached to the instruction (in the form of
208-
/// DPValues) and translate it.
208+
/// DbgRecords) and translate it.
209209
void translateDbgInfo(const Instruction &Inst,
210210
MachineIRBuilder &MIRBuilder);
211211

llvm/include/llvm/IR/BasicBlock.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
7878
DPMarker *createMarker(InstListType::iterator It);
7979

8080
/// Convert variable location debugging information stored in dbg.value
81-
/// intrinsics into DPMarker / DPValue records. Deletes all dbg.values in
81+
/// intrinsics into DPMarkers / 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

8686
/// Convert variable location debugging information stored in DPMarkers and
87-
/// DPValues into the dbg.value intrinsic representation. Sets
87+
/// DbgRecords into the dbg.value intrinsic representation. Sets
8888
/// IsNewDbgInfoFormat = false.
8989
void convertFromNewDbgValues();
9090

@@ -93,50 +93,50 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
9393
/// if necessary.
9494
void setIsNewDbgInfoFormat(bool NewFlag);
9595

96-
/// Record that the collection of DPValues in \p M "trails" after the last
96+
/// Record that the collection of DbgRecords in \p M "trails" after the last
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).
100100
void setTrailingDbgRecords(DPMarker *M);
101101

102-
/// Fetch the collection of DPValues that "trail" after the last instruction
102+
/// 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.
105105
DPMarker *getTrailingDbgRecords();
106106

107-
/// Delete any trailing DPValues at the end of this block, see
107+
/// 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 DPValues can
114-
/// be inserted there. This will either be nullptr if not present, a DPMarker,
115-
/// or TrailingDPValues if It is end().
113+
/// Return the DPMarker for the position given by \p It, so that DbgRecords
114+
/// can be inserted there. This will either be nullptr if not present, a
115+
/// DPMarker, or TrailingDbgRecords if It is end().
116116
DPMarker *getMarker(InstListType::iterator It);
117117

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

123-
/// Insert a DPValue into a block at the position given by \p I.
123+
/// Insert a DbgRecord into a block at the position given by \p I.
124124
void insertDbgRecordAfter(DbgRecord *DPV, Instruction *I);
125125

126-
/// Insert a DPValue into a block at the position given by \p Here.
126+
/// Insert a DbgRecord into a block at the position given by \p Here.
127127
void insertDbgRecordBefore(DbgRecord *DPV, InstListType::iterator Here);
128128

129-
/// Eject any debug-info trailing at the end of a block. DPValues can
129+
/// Eject any debug-info trailing at the end of a block. DbgRecords can
130130
/// transiently be located "off the end" of a block if the blocks terminator
131131
/// is temporarily removed. Once a terminator is re-inserted this method will
132-
/// move such DPValues back to the right place (ahead of the terminator).
133-
void flushTerminatorDbgValues();
132+
/// move such DbgRecords back to the right place (ahead of the terminator).
133+
void flushTerminatorDbgRecords();
134134

135135
/// In rare circumstances instructions can be speculatively removed from
136136
/// blocks, and then be re-inserted back into that position later. When this
137137
/// happens in RemoveDIs debug-info mode, some special patching-up needs to
138138
/// occur: inserting into the middle of a sequence of dbg.value intrinsics
139-
/// does not have an equivalent with DPValues.
139+
/// does not have an equivalent with DbgRecords.
140140
void reinsertInstInDbgRecords(Instruction *I,
141141
std::optional<DbgRecord::self_iterator> Pos);
142142

@@ -522,7 +522,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
522522
BasicBlock::iterator FromEndIt);
523523

524524
/// Perform any debug-info specific maintenence for the given splice
525-
/// activity. In the DPValue debug-info representation, debug-info is not
525+
/// activity. In the DbgRecord debug-info representation, debug-info is not
526526
/// in instructions, and so it does not automatically move from one block
527527
/// to another.
528528
void spliceDebugInfo(BasicBlock::iterator ToIt, BasicBlock *FromBB,

llvm/include/llvm/IR/DebugProgramInstruction.h

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- llvm/DebugProgramInstruction.h - Stream of debug info -------*- C++ -*-===//
1+
//===-- llvm/DebugProgramInstruction.h - Stream of debug info ---*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -15,18 +15,18 @@
1515
// %bar = void call @ext(%foo);
1616
//
1717
// 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:
18+
// 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
21+
// which record the variable assignment information. To illustrate:
2222
//
2323
// %foo = add i32 1, %0
2424
// ; foo->DbgMarker == nullptr
2525
// ;; There are no variable assignments / debug records "in front" of
2626
// ;; the instruction for %foo, therefore it has no DbgMarker.
2727
// %bar = void call @ext(%foo)
2828
// ; bar->DbgMarker = {
29-
// ; StoredDPValues = {
29+
// ; StoredDbgRecords = {
3030
// ; DPValue(metadata i32 %foo, ...)
3131
// ; }
3232
// ; }
@@ -119,7 +119,7 @@ template <typename T> class DbgRecordParamRef {
119119
/// Base class for non-instruction debug metadata records that have positions
120120
/// within IR. Features various methods copied across from the Instruction
121121
/// class to aid ease-of-use. DbgRecords should always be linked into a
122-
/// DPMarker's StoredDPValues list. The marker connects a DbgRecord back to
122+
/// DPMarker's StoredDbgRecords list. The marker connects a DbgRecord back to
123123
/// it's position in the BasicBlock.
124124
///
125125
/// We need a discriminator for dyn/isa casts. In order to avoid paying for a
@@ -557,8 +557,8 @@ class DPMarker {
557557
/// intrinsics. There is a one-to-one relationship between each debug
558558
/// intrinsic in a block and each DbgRecord once the representation has been
559559
/// converted, and the ordering is meaningful in the same way.
560-
simple_ilist<DbgRecord> StoredDPValues;
561-
bool empty() const { return StoredDPValues.empty(); }
560+
simple_ilist<DbgRecord> StoredDbgRecords;
561+
bool empty() const { return StoredDbgRecords.empty(); }
562562

563563
const BasicBlock *getParent() const;
564564
BasicBlock *getParent();
@@ -576,54 +576,56 @@ class DPMarker {
576576
void print(raw_ostream &O, bool IsForDebug = false) const;
577577
void print(raw_ostream &ROS, ModuleSlotTracker &MST, bool IsForDebug) const;
578578

579-
/// Produce a range over all the DPValues in this Marker.
579+
/// Produce a range over all the DbgRecords in this Marker.
580580
iterator_range<simple_ilist<DbgRecord>::iterator> getDbgRecordRange();
581581
iterator_range<simple_ilist<DbgRecord>::const_iterator>
582582
getDbgRecordRange() const;
583-
/// Transfer any DPValues from \p Src into this DPMarker. If \p InsertAtHead
584-
/// is true, place them before existing DPValues, otherwise afterwards.
583+
/// Transfer any DbgRecords from \p Src into this DPMarker. If \p InsertAtHead
584+
/// is true, place them before existing DbgRecords, otherwise afterwards.
585585
void absorbDebugValues(DPMarker &Src, bool InsertAtHead);
586-
/// Transfer the DPValues in \p Range from \p Src into this DPMarker. If
587-
/// \p InsertAtHead is true, place them before existing DPValues, otherwise
586+
/// Transfer the DbgRecords in \p Range from \p Src into this DPMarker. If
587+
/// \p InsertAtHead is true, place them before existing DbgRecords, otherwise
588588
// afterwards.
589589
void absorbDebugValues(iterator_range<DbgRecord::self_iterator> Range,
590590
DPMarker &Src, bool InsertAtHead);
591-
/// Insert a DPValue into this DPMarker, at the end of the list. If
591+
/// Insert a DbgRecord into this DPMarker, at the end of the list. If
592592
/// \p InsertAtHead is true, at the start.
593593
void insertDbgRecord(DbgRecord *New, bool InsertAtHead);
594-
/// Insert a DPValue prior to a DPValue contained within this marker.
594+
/// Insert a DbgRecord prior to a DbgRecord contained within this marker.
595595
void insertDbgRecord(DbgRecord *New, DbgRecord *InsertBefore);
596-
/// Insert a DPValue after a DPValue contained within this marker.
596+
/// Insert a DbgRecord after a DbgRecord contained within this marker.
597597
void insertDbgRecordAfter(DbgRecord *New, DbgRecord *InsertAfter);
598598
/// Clone all DPMarkers from \p From into this marker. There are numerous
599599
/// options to customise the source/destination, due to gnarliness, see class
600600
/// comment.
601-
/// \p FromHere If non-null, copy from FromHere to the end of From's DPValues
602-
/// \p InsertAtHead Place the cloned DPValues at the start of StoredDPValues
603-
/// \returns Range over all the newly cloned DPValues
601+
/// \p FromHere If non-null, copy from FromHere to the end of From's
602+
/// DbgRecords
603+
/// \p InsertAtHead Place the cloned DbgRecords at the start of
604+
/// StoredDbgRecords
605+
/// \returns Range over all the newly cloned DbgRecords
604606
iterator_range<simple_ilist<DbgRecord>::iterator>
605607
cloneDebugInfoFrom(DPMarker *From,
606608
std::optional<simple_ilist<DbgRecord>::iterator> FromHere,
607609
bool InsertAtHead = false);
608-
/// Erase all DPValues in this DPMarker.
610+
/// Erase all DbgRecords in this DPMarker.
609611
void dropDbgRecords();
610612
/// Erase a single DbgRecord from this marker. In an ideal future, we would
611613
/// never erase an assignment in this way, but it's the equivalent to
612614
/// erasing a debug intrinsic from a block.
613615
void dropOneDbgRecord(DbgRecord *DR);
614616

615-
/// We generally act like all llvm Instructions have a range of DPValues
617+
/// We generally act like all llvm Instructions have a range of DbgRecords
616618
/// attached to them, but in reality sometimes we don't allocate the DPMarker
617-
/// to save time and memory, but still have to return ranges of DPValues. When
618-
/// we need to describe such an unallocated DPValue range, use this static
619-
/// markers range instead. This will bite us if someone tries to insert a
620-
/// DPValue in that range, but they should be using the Official (TM) API for
621-
/// that.
619+
/// to save time and memory, but still have to return ranges of DbgRecords.
620+
/// When we need to describe such an unallocated DbgRecord range, use this
621+
/// static markers range instead. This will bite us if someone tries to insert
622+
/// a DbgRecord in that range, but they should be using the Official (TM) API
623+
/// for that.
622624
static DPMarker EmptyDPMarker;
623625
static iterator_range<simple_ilist<DbgRecord>::iterator>
624626
getEmptyDbgRecordRange() {
625-
return make_range(EmptyDPMarker.StoredDPValues.end(),
626-
EmptyDPMarker.StoredDPValues.end());
627+
return make_range(EmptyDPMarker.StoredDbgRecords.end(),
628+
EmptyDPMarker.StoredDbgRecords.end());
627629
}
628630
};
629631

@@ -632,7 +634,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, const DPMarker &Marker) {
632634
return OS;
633635
}
634636

635-
/// Inline helper to return a range of DPValues attached to a marker. It needs
637+
/// Inline helper to return a range of DbgRecords attached to a marker. It needs
636638
/// to be inlined as it's frequently called, but also come after the declaration
637639
/// of DPMarker. Thus: it's pre-declared by users like Instruction, then an
638640
/// inlineable body defined here.

llvm/include/llvm/IR/Instruction.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,47 +64,48 @@ class Instruction : public User,
6464

6565
/// Clone any debug-info attached to \p From onto this instruction. Used to
6666
/// copy debugging information from one block to another, when copying entire
67-
/// blocks. \see DebugProgramInstruction.h , because the ordering of DPValues
68-
/// is still important, fine grain control of which instructions are moved and
69-
/// where they go is necessary.
67+
/// blocks. \see DebugProgramInstruction.h , because the ordering of
68+
/// DbgRecords is still important, fine grain control of which instructions
69+
/// are moved and where they go is necessary.
7070
/// \p From The instruction to clone debug-info from.
71-
/// \p from_here Optional iterator to limit DPValues cloned to be a range from
71+
/// \p from_here Optional iterator to limit DbgRecords cloned to be a range
72+
/// from
7273
/// from_here to end().
73-
/// \p InsertAtHead Whether the cloned DPValues should be placed at the end
74-
/// or the beginning of existing DPValues attached to this.
75-
/// \returns A range over the newly cloned DPValues.
74+
/// \p InsertAtHead Whether the cloned DbgRecords should be placed at the end
75+
/// or the beginning of existing DbgRecords attached to this.
76+
/// \returns A range over the newly cloned DbgRecords.
7677
iterator_range<simple_ilist<DbgRecord>::iterator> cloneDebugInfoFrom(
7778
const Instruction *From,
7879
std::optional<simple_ilist<DbgRecord>::iterator> FromHere = std::nullopt,
7980
bool InsertAtHead = false);
8081

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

86-
/// Return an iterator to the position of the "Next" DPValue after this
87+
/// Return an iterator to the position of the "Next" DbgRecord after this
8788
/// instruction, or std::nullopt. This is the position to pass to
8889
/// BasicBlock::reinsertInstInDbgRecords when re-inserting an instruction.
8990
std::optional<simple_ilist<DbgRecord>::iterator> getDbgReinsertionPosition();
9091

91-
/// Returns true if any DPValues are attached to this instruction.
92+
/// Returns true if any DbgRecords are attached to this instruction.
9293
bool hasDbgRecords() const;
9394

94-
/// Transfer any DPValues on the position \p It onto this instruction,
95-
/// by simply adopting the sequence of DPValues (which is efficient) if
95+
/// Transfer any DbgRecords on the position \p It onto this instruction,
96+
/// by simply adopting the sequence of DbgRecords (which is efficient) if
9697
/// possible, by merging two sequences otherwise.
9798
void adoptDbgRecords(BasicBlock *BB, InstListType::iterator It,
9899
bool InsertAtHead);
99100

100-
/// Erase any DPValues attached to this instruction.
101+
/// Erase any DbgRecords attached to this instruction.
101102
void dropDbgRecords();
102103

103-
/// Erase a single DPValue \p I that is attached to this instruction.
104+
/// Erase a single DbgRecord \p I that is attached to this instruction.
104105
void dropOneDbgRecord(DbgRecord *I);
105106

106107
/// Handle the debug-info implications of this instruction being removed. Any
107-
/// attached DPValues need to "fall" down onto the next instruction.
108+
/// attached DbgRecords need to "fall" down onto the next instruction.
108109
void handleMarkerRemoval();
109110

110111
protected:

llvm/include/llvm/IR/PassManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ class PassManager : public PassInfoMixin<
227227
detail::getAnalysisResult<PassInstrumentationAnalysis>(
228228
AM, IR, std::tuple<ExtraArgTs...>(ExtraArgs...));
229229

230-
// RemoveDIs: if requested, convert debug-info to DPValue representation
230+
// RemoveDIs: if requested, convert debug-info to DbgRecord representation
231231
// for duration of these passes.
232232
bool ShouldConvertDbgInfo = shouldConvertDbgInfo(IR);
233233
if (ShouldConvertDbgInfo)

llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
using namespace llvm;
2020

2121
PreservedAnalyses BitcodeWriterPass::run(Module &M, ModuleAnalysisManager &AM) {
22-
// RemoveDIs: there's no bitcode representation of the DPValue debug-info,
22+
// RemoveDIs: there's no bitcode representation of the DbgRecord debug-info,
2323
// convert to dbg.values before writing out.
2424
bool IsNewDbgInfoFormat = M.IsNewDbgInfoFormat;
2525
if (IsNewDbgInfoFormat)
@@ -56,8 +56,8 @@ namespace {
5656
StringRef getPassName() const override { return "Bitcode Writer"; }
5757

5858
bool runOnModule(Module &M) override {
59-
// RemoveDIs: there's no bitcode representation of the DPValue debug-info,
60-
// convert to dbg.values before writing out.
59+
// RemoveDIs: there's no bitcode representation of the DbgRecord
60+
// debug-info, convert to dbg.values before writing out.
6161
bool IsNewDbgInfoFormat = M.IsNewDbgInfoFormat;
6262
if (IsNewDbgInfoFormat)
6363
M.convertFromNewDbgValues();

0 commit comments

Comments
 (0)