Skip to content

Commit bdc77d1

Browse files
authored
[RemoveDIs][NFC] Rename DPLabel->DbgLabelRecord (llvm#85918)
This patch renames DPLabel to DbgLabelRecord, in accordance with the ongoing DbgRecord rename. This rename was fairly trivial, since DPLabel isn't as widely used as DPValue and has no real conflicts in either its full or abbreviated name. As usual, the entire replacement was done automatically, with `s/DPLabel/DbgLabelRecord/` and `s/DPL/DLR/`.
1 parent 6c1d445 commit bdc77d1

20 files changed

+97
-89
lines changed

llvm/docs/RemoveDIsDebugInfo.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ We're using a dedicated C++ class called `DbgRecord` to store debug info, with a
6565

6666
https://llvm.org/docs/doxygen/classllvm_1_1DbgRecord.html
6767
https://llvm.org/docs/doxygen/classllvm_1_1DbgVariableRecord.html
68-
https://llvm.org/docs/doxygen/classllvm_1_1DPLabel.html
68+
https://llvm.org/docs/doxygen/classllvm_1_1DbgLabelRecord.html
6969

70-
This allows you to treat a `DbgVariableRecord` as if it's a `dbg.value`/`dbg.declare`/`dbg.assign` intrinsic most of the time, for example in generic (auto-param) lambdas, and the same for `DPLabel` and `dbg.label`s.
70+
This allows you to treat a `DbgVariableRecord` as if it's a `dbg.value`/`dbg.declare`/`dbg.assign` intrinsic most of the time, for example in generic (auto-param) lambdas, and the same for `DbgLabelRecord` and `dbg.label`s.
7171

7272
## How do these `DbgRecords` fit into the instruction stream?
7373

@@ -97,7 +97,7 @@ Each instruction has a pointer to a `DPMarker` (which will become optional), tha
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

100-
The various kinds of debug intrinsic (value, declare, assign, label) are all stored in `DbgRecord` subclasses, with a "RecordKind" field distinguishing `DPLabel`s from `DbgVariableRecord`s, and a `LocationType` field in the `DbgVariableRecord` class further disambiguating the various debug variable intrinsics it can represent.
100+
The various kinds of debug intrinsic (value, declare, assign, label) are all stored in `DbgRecord` subclasses, with a "RecordKind" field distinguishing `DbgLabelRecord`s from `DbgVariableRecord`s, and a `LocationType` field in the `DbgVariableRecord` class further disambiguating the various debug variable intrinsics it can represent.
101101

102102
## Finding debug info records
103103

llvm/include/llvm/IR/DebugProgramInstruction.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -222,23 +222,25 @@ inline raw_ostream &operator<<(raw_ostream &OS, const DbgRecord &R) {
222222
/// llvm.dbg.label intrinsic.
223223
/// FIXME: Rename DbgLabelRecord when DbgVariableRecord is renamed to
224224
/// DbgVariableRecord.
225-
class DPLabel : public DbgRecord {
225+
class DbgLabelRecord : public DbgRecord {
226226
DbgRecordParamRef<DILabel> Label;
227227

228228
/// This constructor intentionally left private, so that it is only called via
229-
/// "createUnresolvedDPLabel", which clearly expresses that it is for parsing
230-
/// only.
231-
DPLabel(MDNode *Label, MDNode *DL);
229+
/// "createUnresolvedDbgLabelRecord", which clearly expresses that it is for
230+
/// parsing only.
231+
DbgLabelRecord(MDNode *Label, MDNode *DL);
232232

233233
public:
234-
DPLabel(DILabel *Label, DebugLoc DL);
234+
DbgLabelRecord(DILabel *Label, DebugLoc DL);
235235

236-
/// For use during parsing; creates a DPLabel from as-of-yet unresolved
237-
/// MDNodes. Trying to access the resulting DPLabel's fields before they are
238-
/// resolved, or if they resolve to the wrong type, will result in a crash.
239-
static DPLabel *createUnresolvedDPLabel(MDNode *Label, MDNode *DL);
236+
/// For use during parsing; creates a DbgLabelRecord from as-of-yet unresolved
237+
/// MDNodes. Trying to access the resulting DbgLabelRecord's fields before
238+
/// they are resolved, or if they resolve to the wrong type, will result in a
239+
/// crash.
240+
static DbgLabelRecord *createUnresolvedDbgLabelRecord(MDNode *Label,
241+
MDNode *DL);
240242

241-
DPLabel *clone() const;
243+
DbgLabelRecord *clone() const;
242244
void print(raw_ostream &O, bool IsForDebug = false) const;
243245
void print(raw_ostream &ROS, ModuleSlotTracker &MST, bool IsForDebug) const;
244246
DbgLabelInst *createDebugIntrinsic(Module *M,

llvm/lib/AsmParser/LLParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6607,7 +6607,7 @@ bool LLParser::parseDebugRecord(DbgRecord *&DR, PerFunctionState &PFS) {
66076607
return true;
66086608
if (parseToken(lltok::rparen, "Expected ')' here"))
66096609
return true;
6610-
DR = DPLabel::createUnresolvedDPLabel(Label, DbgLoc);
6610+
DR = DbgLabelRecord::createUnresolvedDbgLabelRecord(Label, DbgLoc);
66116611
return false;
66126612
}
66136613

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6426,14 +6426,15 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
64266426
break;
64276427
}
64286428
case bitc::FUNC_CODE_DEBUG_RECORD_LABEL: {
6429-
// DPLabels are placed after the Instructions that they are attached to.
6429+
// DbgLabelRecords are placed after the Instructions that they are
6430+
// attached to.
64306431
Instruction *Inst = getLastInstruction();
64316432
if (!Inst)
64326433
return error("Invalid dbg record: missing instruction");
64336434
DILocation *DIL = cast<DILocation>(getFnMetadataByID(Record[0]));
64346435
DILabel *Label = cast<DILabel>(getFnMetadataByID(Record[1]));
64356436
Inst->getParent()->insertDbgRecordBefore(
6436-
new DPLabel(Label, DebugLoc(DIL)), Inst->getIterator());
6437+
new DbgLabelRecord(Label, DebugLoc(DIL)), Inst->getIterator());
64376438
continue; // This isn't an instruction.
64386439
}
64396440
case bitc::FUNC_CODE_DEBUG_RECORD_VALUE_SIMPLE:

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3570,9 +3570,9 @@ void ModuleBitcodeWriter::writeFunction(
35703570
// instruction. Write it after the instruction so that it's easy to
35713571
// re-attach to the instruction reading the records in.
35723572
for (DbgRecord &DR : I.DbgMarker->getDbgRecordRange()) {
3573-
if (DPLabel *DPL = dyn_cast<DPLabel>(&DR)) {
3574-
Vals.push_back(VE.getMetadataID(&*DPL->getDebugLoc()));
3575-
Vals.push_back(VE.getMetadataID(DPL->getLabel()));
3573+
if (DbgLabelRecord *DLR = dyn_cast<DbgLabelRecord>(&DR)) {
3574+
Vals.push_back(VE.getMetadataID(&*DLR->getDebugLoc()));
3575+
Vals.push_back(VE.getMetadataID(DLR->getLabel()));
35763576
Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_RECORD_LABEL, Vals);
35773577
Vals.clear();
35783578
continue;

llvm/lib/Bitcode/Writer/ValueEnumerator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,9 @@ ValueEnumerator::ValueEnumerator(const Module &M,
441441
};
442442

443443
for (DbgRecord &DR : I.getDbgRecordRange()) {
444-
if (DPLabel *DPL = dyn_cast<DPLabel>(&DR)) {
445-
EnumerateMetadata(&F, DPL->getLabel());
446-
EnumerateMetadata(&F, &*DPL->getDebugLoc());
444+
if (DbgLabelRecord *DLR = dyn_cast<DbgLabelRecord>(&DR)) {
445+
EnumerateMetadata(&F, DLR->getLabel());
446+
EnumerateMetadata(&F, &*DLR->getDebugLoc());
447447
continue;
448448
}
449449
// Enumerate non-local location metadata.

llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3376,13 +3376,13 @@ void IRTranslator::translateDbgDeclareRecord(Value *Address, bool HasArgList,
33763376
void IRTranslator::translateDbgInfo(const Instruction &Inst,
33773377
MachineIRBuilder &MIRBuilder) {
33783378
for (DbgRecord &DR : Inst.getDbgRecordRange()) {
3379-
if (DPLabel *DPL = dyn_cast<DPLabel>(&DR)) {
3380-
MIRBuilder.setDebugLoc(DPL->getDebugLoc());
3381-
assert(DPL->getLabel() && "Missing label");
3382-
assert(DPL->getLabel()->isValidLocationForIntrinsic(
3379+
if (DbgLabelRecord *DLR = dyn_cast<DbgLabelRecord>(&DR)) {
3380+
MIRBuilder.setDebugLoc(DLR->getDebugLoc());
3381+
assert(DLR->getLabel() && "Missing label");
3382+
assert(DLR->getLabel()->isValidLocationForIntrinsic(
33833383
MIRBuilder.getDebugLoc()) &&
33843384
"Expected inlined-at fields to agree");
3385-
MIRBuilder.buildDbgLabel(DPL->getLabel());
3385+
MIRBuilder.buildDbgLabel(DLR->getLabel());
33863386
continue;
33873387
}
33883388
DbgVariableRecord &DVR = cast<DbgVariableRecord>(DR);

llvm/lib/CodeGen/SelectionDAG/FastISel.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,16 +1192,16 @@ void FastISel::handleDbgInfo(const Instruction *II) {
11921192
flushLocalValueMap();
11931193
recomputeInsertPt();
11941194

1195-
if (DPLabel *DPL = dyn_cast<DPLabel>(&DR)) {
1196-
assert(DPL->getLabel() && "Missing label");
1195+
if (DbgLabelRecord *DLR = dyn_cast<DbgLabelRecord>(&DR)) {
1196+
assert(DLR->getLabel() && "Missing label");
11971197
if (!FuncInfo.MF->getMMI().hasDebugInfo()) {
1198-
LLVM_DEBUG(dbgs() << "Dropping debug info for " << *DPL << "\n");
1198+
LLVM_DEBUG(dbgs() << "Dropping debug info for " << *DLR << "\n");
11991199
continue;
12001200
}
12011201

1202-
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DPL->getDebugLoc(),
1202+
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DLR->getDebugLoc(),
12031203
TII.get(TargetOpcode::DBG_LABEL))
1204-
.addMetadata(DPL->getLabel());
1204+
.addMetadata(DLR->getLabel());
12051205
continue;
12061206
}
12071207

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,18 +1248,19 @@ void SelectionDAGBuilder::visitDbgInfo(const Instruction &I) {
12481248
// We must skip DbgVariableRecords if they've already been processed above as
12491249
// we have just emitted the debug values resulting from assignment tracking
12501250
// analysis, making any existing DbgVariableRecords redundant (and probably
1251-
// less correct). We still need to process DPLabels. This does sink DPLabels
1252-
// to the bottom of the group of debug records. That sholdn't be important
1253-
// as it does so deterministcally and ordering between DPLabels and
1254-
// DbgVariableRecords is immaterial (other than for MIR/IR printing).
1251+
// less correct). We still need to process DbgLabelRecords. This does sink
1252+
// DbgLabelRecords to the bottom of the group of debug records. That sholdn't
1253+
// be important as it does so deterministcally and ordering between
1254+
// DbgLabelRecords and DbgVariableRecords is immaterial (other than for MIR/IR
1255+
// printing).
12551256
bool SkipDbgVariableRecords = DAG.getFunctionVarLocs();
12561257
// Is there is any debug-info attached to this instruction, in the form of
12571258
// DbgRecord non-instruction debug-info records.
12581259
for (DbgRecord &DR : I.getDbgRecordRange()) {
1259-
if (DPLabel *DPL = dyn_cast<DPLabel>(&DR)) {
1260-
assert(DPL->getLabel() && "Missing label");
1260+
if (DbgLabelRecord *DLR = dyn_cast<DbgLabelRecord>(&DR)) {
1261+
assert(DLR->getLabel() && "Missing label");
12611262
SDDbgLabel *SDV =
1262-
DAG.getDbgLabel(DPL->getLabel(), DPL->getDebugLoc(), SDNodeOrder);
1263+
DAG.getDbgLabel(DLR->getLabel(), DLR->getDebugLoc(), SDNodeOrder);
12631264
DAG.AddDbgLabel(SDV);
12641265
continue;
12651266
}

llvm/lib/IR/AsmWriter.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,8 +1152,8 @@ void SlotTracker::processDbgRecordMetadata(const DbgRecord &DR) {
11521152
if (auto *Empty = dyn_cast<MDNode>(DVR->getRawAddress()))
11531153
CreateMetadataSlot(Empty);
11541154
}
1155-
} else if (const DPLabel *DPL = dyn_cast<const DPLabel>(&DR)) {
1156-
CreateMetadataSlot(DPL->getRawLabel());
1155+
} else if (const DbgLabelRecord *DLR = dyn_cast<const DbgLabelRecord>(&DR)) {
1156+
CreateMetadataSlot(DLR->getRawLabel());
11571157
} else {
11581158
llvm_unreachable("unsupported DbgRecord kind");
11591159
}
@@ -2719,7 +2719,7 @@ class AssemblyWriter {
27192719
void printInstruction(const Instruction &I);
27202720
void printDPMarker(const DPMarker &DPI);
27212721
void printDbgVariableRecord(const DbgVariableRecord &DVR);
2722-
void printDPLabel(const DPLabel &DPL);
2722+
void printDbgLabelRecord(const DbgLabelRecord &DLR);
27232723
void printDbgRecord(const DbgRecord &DR);
27242724
void printDbgRecordLine(const DbgRecord &DR);
27252725

@@ -4621,8 +4621,8 @@ void AssemblyWriter::printDPMarker(const DPMarker &Marker) {
46214621
void AssemblyWriter::printDbgRecord(const DbgRecord &DR) {
46224622
if (auto *DVR = dyn_cast<DbgVariableRecord>(&DR))
46234623
printDbgVariableRecord(*DVR);
4624-
else if (auto *DPL = dyn_cast<DPLabel>(&DR))
4625-
printDPLabel(*DPL);
4624+
else if (auto *DLR = dyn_cast<DbgLabelRecord>(&DR))
4625+
printDbgLabelRecord(*DLR);
46264626
else
46274627
llvm_unreachable("Unexpected DbgRecord kind");
46284628
}
@@ -4672,7 +4672,7 @@ void AssemblyWriter::printDbgRecordLine(const DbgRecord &DR) {
46724672
Out << '\n';
46734673
}
46744674

4675-
void AssemblyWriter::printDPLabel(const DPLabel &Label) {
4675+
void AssemblyWriter::printDbgLabelRecord(const DbgLabelRecord &Label) {
46764676
auto WriterCtx = getContext();
46774677
Out << "#dbg_label(";
46784678
WriteAsOperandInternal(Out, Label.getRawLabel(), WriterCtx, true);
@@ -4934,7 +4934,7 @@ void DPMarker::print(raw_ostream &ROS, ModuleSlotTracker &MST,
49344934
W.printDPMarker(*this);
49354935
}
49364936

4937-
void DPLabel::print(raw_ostream &ROS, bool IsForDebug) const {
4937+
void DbgLabelRecord::print(raw_ostream &ROS, bool IsForDebug) const {
49384938

49394939
ModuleSlotTracker MST(getModuleFromDPI(this), true);
49404940
print(ROS, MST, IsForDebug);
@@ -4957,8 +4957,8 @@ void DbgVariableRecord::print(raw_ostream &ROS, ModuleSlotTracker &MST,
49574957
W.printDbgVariableRecord(*this);
49584958
}
49594959

4960-
void DPLabel::print(raw_ostream &ROS, ModuleSlotTracker &MST,
4961-
bool IsForDebug) const {
4960+
void DbgLabelRecord::print(raw_ostream &ROS, ModuleSlotTracker &MST,
4961+
bool IsForDebug) const {
49624962
formatted_raw_ostream OS(ROS);
49634963
SlotTracker EmptySlotTable(static_cast<const Module *>(nullptr));
49644964
SlotTracker &SlotTable =
@@ -4970,7 +4970,7 @@ void DPLabel::print(raw_ostream &ROS, ModuleSlotTracker &MST,
49704970
incorporateFunction(Marker->getParent() ? Marker->getParent()->getParent()
49714971
: nullptr);
49724972
AssemblyWriter W(OS, SlotTable, getModuleFromDPI(this), nullptr, IsForDebug);
4973-
W.printDPLabel(*this);
4973+
W.printDbgLabelRecord(*this);
49744974
}
49754975

49764976
void Value::print(raw_ostream &ROS, bool IsForDebug) const {

0 commit comments

Comments
 (0)