LLVM/project bdc77d1 — llvm/docs RemoveDIsDebugInfo.md, llvm/include/llvm/IR DebugProgramInstruction.h
[RemoveDIs][NFC] Rename DPLabel->DbgLabelRecord (#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/`.
@@ -65,9 +65,9 @@ We're using a dedicated C++ class called `DbgRecord` to store debug info, with a | |||
https://llvm.org/docs/doxygen/classllvm_1_1Dbg | https://llvm.org/docs/doxygen/classllvm_1_1Dbg | ||
https://llvm.org/docs/doxygen/classllvm_1_1Dbg | https://llvm.org/docs/doxygen/classllvm_1_1Dbg | ||
- https://llvm.org/docs/doxygen/ | + https://llvm.org/docs/doxygen/classllvm_1_1DbgLabelRecord.html | ||
-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 | +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. | ||
## How do these `DbgRecords` fit into the instruction stream? | ## How do these `DbgRecords` fit into the instruction stream? | ||
@@ -97,7 +97,7 @@ Each instruction has a pointer to a `DPMarker` (which will become optional), tha | |||
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 `DbgVariableRecor | 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 `DbgVariableRecor | ||
-The various kinds of debug intrinsic (value, declare, assign, label) are all stored in `DbgRecord` subclasses, with a "RecordKind" field distinguishing | +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. | ||
## Finding debug info records | ## Finding debug info records | ||
@@ -222,23 +222,25 @@ inline raw_ostream &operator<<(raw_ | |||
/// llvm.dbg.label intrinsic. | /// llvm.dbg.label intrinsic. | ||
/// FIXME: Rename DbgLabelRecord when DbgVariableRecor | /// FIXME: Rename DbgLabelRecord when DbgVariableRecor | ||
/// DbgVariableRecor | /// DbgVariableRecor | ||
-class | +class DbgLabelRecord : public DbgRecord { | ||
DbgRecordParamRe | DbgRecordParamRe | ||
/// This constructor intentionally left private, so that it is only called via | /// This constructor intentionally left private, so that it is only called via | ||
- /// | + /// "createUnresolvedDbgLabelRecord", which clearly expresses that it is for | ||
- /// only. | + /// parsing only. | ||
- | + DbgLabelRecord(MDNode *Label, MDNode *DL); | ||
public: | public: | ||
- | + DbgLabelRecord(DILabel *Label, DebugLoc DL); | ||
- /// For use during parsing; creates a | + /// For use during parsing; creates a DbgLabelRecord from as-of-yet unresolved | ||
- /// MDNodes. Trying to access the resulting | + /// MDNodes. Trying to access the resulting DbgLabelRecord's fields before | ||
- /// resolved, or if they resolve to the wrong type, will result in a | + /// they are resolved, or if they resolve to the wrong type, will result in a | ||
- static DPLabel *createUnresolved | + /// crash. | ||
+ static DbgLabelRecord *createUnresolved | |||
+ MDNode *DL); | |||
- | + DbgLabelRecord *clone() const; | ||
void print(raw_ostream &O, bool IsForDebug = false) const; | void print(raw_ostream &O, bool IsForDebug = false) const; | ||
void print(raw_ostream &ROS, ModuleSlotTracke | void print(raw_ostream &ROS, ModuleSlotTracke | ||
DbgLabelInst *createDebugIntri | DbgLabelInst *createDebugIntri |
@@ -6607,7 +6607,7 @@ bool LLParser::parseD | |||
return true; | return true; | ||
if (parseToken(lltok::rparen, "Expected ')' here")) | if (parseToken(lltok::rparen, "Expected ')' here")) | ||
return true; | return true; | ||
- DR = | + DR = DbgLabelRecord::createUnresolvedDbgLabelRecord(Label, DbgLoc); | ||
return false; | return false; | ||
} | } | ||
@@ -6426,14 +6426,15 @@ Error BitcodeReader::p | |||
break; | break; | ||
} | } | ||
case bitc::FUNC_CODE_DEBUG_ | case bitc::FUNC_CODE_DEBUG_ | ||
- // | + // DbgLabelRecords are placed after the Instructions that they are | ||
+ // attached to. | |||
Instruction *Inst = getLastInstructi | Instruction *Inst = getLastInstructi | ||
if (!Inst) | if (!Inst) | ||
return error("Invalid dbg record: missing instruction"); | return error("Invalid dbg record: missing instruction"); | ||
DILocation *DIL = cast<DILocation>(getFnMetadataByI | DILocation *DIL = cast<DILocation>(getFnMetadataByI | ||
DILabel *Label = cast<DILabel>(getFnMetadataByI | DILabel *Label = cast<DILabel>(getFnMetadataByI | ||
Inst->getParent()->insertDbgRecordB | Inst->getParent()->insertDbgRecordB | ||
- new | + new DbgLabelRecord(Label, DebugLoc(DIL)), Inst->getIterator()); | ||
continue; // This isn't an instruction. | continue; // This isn't an instruction. | ||
} | } | ||
case bitc::FUNC_CODE_DEBUG_ | case bitc::FUNC_CODE_DEBUG_ |
@@ -3570,9 +3570,9 @@ void ModuleBitcodeWri | |||
// instruction. Write it after the instruction so that it's easy to | // instruction. Write it after the instruction so that it's easy to | ||
// re-attach to the instruction reading the records in. | // re-attach to the instruction reading the records in. | ||
for (DbgRecord &DR : I.DbgMarker->getDbgRecordRang | for (DbgRecord &DR : I.DbgMarker->getDbgRecordRang | ||
- if ( | + if (DbgLabelRecord *DLR = dyn_cast<DbgLabelRecord>(&DR)) { | ||
- Vals.push_back(VE.getMetadataID(&* | + Vals.push_back(VE.getMetadataID(&*DLR->getDebugLoc())); | ||
- Vals.push_back(VE.getMetadataID( | + Vals.push_back(VE.getMetadataID(DLR->getLabel())); | ||
Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_ | Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_ | ||
Vals.clear(); | Vals.clear(); | ||
continue; | continue; |
@@ -441,9 +441,9 @@ ValueEnumerator: | |||
}; | }; | ||
for (DbgRecord &DR : I.getDbgRecordRang | for (DbgRecord &DR : I.getDbgRecordRang | ||
- if ( | + if (DbgLabelRecord *DLR = dyn_cast<DbgLabelRecord>(&DR)) { | ||
- EnumerateMetadata(&F, | + EnumerateMetadata(&F, DLR->getLabel()); | ||
- EnumerateMetadata(&F, &* | + EnumerateMetadata(&F, &*DLR->getDebugLoc()); | ||
continue; | continue; | ||
} | } | ||
// Enumerate non-local location metadata. | // Enumerate non-local location metadata. |
@@ -3376,13 +3376,13 @@ void IRTranslator::tr | |||
void IRTranslator::translateDbgInfo | void IRTranslator::translateDbgInfo | ||
MachineIRBuilder | MachineIRBuilder | ||
for (DbgRecord &DR : Inst.getDbgRecordRang | for (DbgRecord &DR : Inst.getDbgRecordRang | ||
- if ( | + if (DbgLabelRecord *DLR = dyn_cast<DbgLabelRecord>(&DR)) { | ||
- MIRBuilder.setDebugLoc( | + MIRBuilder.setDebugLoc(DLR->getDebugLoc()); | ||
- assert( | + assert(DLR->getLabel() && "Missing label"); | ||
- assert( | + assert(DLR->getLabel()->isValidLocationForIntrinsic( | ||
MIRBuilder.getDebugLoc()) && | MIRBuilder.getDebugLoc()) && | ||
"Expected inlined-at fields to agree"); | "Expected inlined-at fields to agree"); | ||
- MIRBuilder.buildDbgLabel( | + MIRBuilder.buildDbgLabel(DLR->getLabel()); | ||
continue; | continue; | ||
} | } | ||
DbgVariableRecor | DbgVariableRecor |
@@ -1192,16 +1192,16 @@ void FastISel::handle | |||
flushLocalValueM | flushLocalValueM | ||
recomputeInsertP | recomputeInsertP | ||
- if ( | + if (DbgLabelRecord *DLR = dyn_cast<DbgLabelRecord>(&DR)) { | ||
- assert( | + assert(DLR->getLabel() && "Missing label"); | ||
if (!FuncInfo.MF->getMMI().hasDebugInfo()) { | if (!FuncInfo.MF->getMMI().hasDebugInfo()) { | ||
- LLVM_DEBUG(dbgs() << "Dropping debug info for " << * | + LLVM_DEBUG(dbgs() << "Dropping debug info for " << *DLR << "\n"); | ||
continue; | continue; | ||
} | } | ||
- BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, | + BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DLR->getDebugLoc(), | ||
TII.get(TargetOpcode::DBG_LABEL)) | TII.get(TargetOpcode::DBG_LABEL)) | ||
- .addMetadata( | + .addMetadata(DLR->getLabel()); | ||
continue; | continue; | ||
} | } | ||
@@ -1248,18 +1248,19 @@ void SelectionDAGBuil | |||
// We must skip DbgVariableRecor | // We must skip DbgVariableRecor | ||
// we have just emitted the debug values resulting from assignment tracking | // we have just emitted the debug values resulting from assignment tracking | ||
// analysis, making any existing DbgVariableRecor | // analysis, making any existing DbgVariableRecor | ||
- // less correct). We still need to process | + // less correct). We still need to process DbgLabelRecords. This does sink | ||
- // to the bottom of the group of debug records. That sholdn't | + // DbgLabelRecords to the bottom of the group of debug records. That sholdn't | ||
- // as it does so deterministcally and ordering between | + // be important as it does so deterministcally and ordering between | ||
- // DbgVariableRecords is immaterial (other than for MIR/IR | + // DbgLabelRecords and DbgVariableRecords is immaterial (other than for MIR/IR | ||
+ // printing). | |||
bool SkipDbgVariableR | bool SkipDbgVariableR | ||
// Is there is any debug-info attached to this instruction, in the form of | // Is there is any debug-info attached to this instruction, in the form of | ||
// DbgRecord non-instruction debug-info records. | // DbgRecord non-instruction debug-info records. | ||
for (DbgRecord &DR : I.getDbgRecordRang | for (DbgRecord &DR : I.getDbgRecordRang | ||
- if ( | + if (DbgLabelRecord *DLR = dyn_cast<DbgLabelRecord>(&DR)) { | ||
- assert( | + assert(DLR->getLabel() && "Missing label"); | ||
SDDbgLabel *SDV = | SDDbgLabel *SDV = | ||
- DAG.getDbgLabel( | + DAG.getDbgLabel(DLR->getLabel(), DLR->getDebugLoc(), SDNodeOrder); | ||
DAG.AddDbgLabel(SDV); | DAG.AddDbgLabel(SDV); | ||
continue; | continue; | ||
} | } |
@@ -1152,8 +1152,8 @@ void SlotTracker::pro | |||
if (auto *Empty = dyn_cast<MDNode>(DVR->getRawAddress())) | if (auto *Empty = dyn_cast<MDNode>(DVR->getRawAddress())) | ||
CreateMetadataSl | CreateMetadataSl | ||
} | } | ||
- } else if (const | + } else if (const DbgLabelRecord *DLR = dyn_cast<const DbgLabelRecord>(&DR)) { | ||
- CreateMetadataSlot( | + CreateMetadataSlot(DLR->getRawLabel()); | ||
} else { | } else { | ||
llvm_unreachable | llvm_unreachable | ||
} | } | ||
@@ -2719,7 +2719,7 @@ public: | |||
void printInstruction | void printInstruction | ||
void printDPMarker(const DPMarker &DPI); | void printDPMarker(const DPMarker &DPI); | ||
void printDbgVariable | void printDbgVariable | ||
- void | + void printDbgLabelRecord(const DbgLabelRecord &DLR); | ||
void printDbgRecord(const DbgRecord &DR); | void printDbgRecord(const DbgRecord &DR); | ||
void printDbgRecordLi | void printDbgRecordLi | ||
@@ -4621,8 +4621,8 @@ void AssemblyWriter:: | |||
void AssemblyWriter::printDbgRecord(const DbgRecord &DR) { | void AssemblyWriter::printDbgRecord(const DbgRecord &DR) { | ||
if (auto *DVR = dyn_cast<DbgVariableRecor | if (auto *DVR = dyn_cast<DbgVariableRecor | ||
printDbgVariable | printDbgVariable | ||
- else if (auto * | + else if (auto *DLR = dyn_cast<DbgLabelRecord>(&DR)) | ||
- | + printDbgLabelRecord(*DLR); | ||
else | else | ||
llvm_unreachable | llvm_unreachable | ||
} | } | ||
@@ -4672,7 +4672,7 @@ void AssemblyWriter:: | |||
Out << '\n'; | Out << '\n'; | ||
} | } | ||
-void | +void AssemblyWriter::printDbgLabelRecord(const DbgLabelRecord &Label) { | ||
auto WriterCtx = getContext(); | auto WriterCtx = getContext(); | ||
Out << "#dbg_label("; | Out << "#dbg_label("; | ||
WriteAsOperandIn | WriteAsOperandIn | ||
@@ -4934,7 +4934,7 @@ void DPMarker::print( | |||
W.printDPMarker(*this); | W.printDPMarker(*this); | ||
} | } | ||
-void | +void DbgLabelRecord::print(raw_ostream &ROS, bool IsForDebug) const { | ||
ModuleSlotTracke | ModuleSlotTracke | ||
print(ROS, MST, IsForDebug); | print(ROS, MST, IsForDebug); | ||
@@ -4957,8 +4957,8 @@ void DbgVariableRecor | |||
W.printDbgVariable | W.printDbgVariable | ||
} | } | ||
-void | +void DbgLabelRecord::print(raw_ostream &ROS, ModuleSlotTracker &MST, | ||
- | + bool IsForDebug) const { | ||
formatted_raw_os | formatted_raw_os | ||
SlotTracker EmptySlotTable(static_cast<const Module *>(nullptr)); | SlotTracker EmptySlotTable(static_cast<const Module *>(nullptr)); | ||
SlotTracker &SlotTable = | SlotTracker &SlotTable = | ||
@@ -4970,7 +4970,7 @@ void DPLabel::print(r | |||
incorporateFunct | incorporateFunct | ||
: nullptr); | : nullptr); | ||
AssemblyWriter W(OS, SlotTable, getModuleFromDPI | AssemblyWriter W(OS, SlotTable, getModuleFromDPI | ||
- W. | + W.printDbgLabelRecord(*this); | ||
} | } | ||
void Value::print(raw_ostream &ROS, bool IsForDebug) const { | void Value::print(raw_ostream &ROS, bool IsForDebug) const { |
@@ -2358,7 +2358,7 @@ static MDType *unwrapMAVOp(Cal | |||
static void upgradeDbgIntrin | static void upgradeDbgIntrin | ||
DbgRecord *DR = nullptr; | DbgRecord *DR = nullptr; | ||
if (Name == "label") { | if (Name == "label") { | ||
- DR = new | + DR = new DbgLabelRecord(unwrapMAVOp<DILabel>(CI, 0), CI->getDebugLoc()); | ||
} else if (Name == "assign") { | } else if (Name == "assign") { | ||
DR = new DbgVariableRecor | DR = new DbgVariableRecor | ||
unwrapMAVOp<Metadata>(CI, 0), unwrapMAVOp<DILocalVariable>(CI, 1), | unwrapMAVOp<Metadata>(CI, 0), unwrapMAVOp<DILocalVariable>(CI, 1), |
@@ -83,7 +83,8 @@ void BasicBlock::conv | |||
} | } | ||
if (DbgLabelInst *DLI = dyn_cast<DbgLabelInst>(&I)) { | if (DbgLabelInst *DLI = dyn_cast<DbgLabelInst>(&I)) { | ||
- DbgVarRecs.push_back( | + DbgVarRecs.push_back( | ||
+ new DbgLabelRecord(DLI->getLabel(), DLI->getDebugLoc())); | |||
DLI->eraseFromParent(); | DLI->eraseFromParent(); | ||
continue; | continue; | ||
} | } |
@@ -1155,12 +1155,12 @@ DbgInstPtr DIBuilder::inser | |||
trackIfUnresolve | trackIfUnresolve | ||
if (M.IsNewDbgInfoForm | if (M.IsNewDbgInfoForm | ||
- | + DbgLabelRecord *DLR = new DbgLabelRecord(LabelInfo, DL); | ||
if (InsertBB && InsertBefore) | if (InsertBB && InsertBefore) | ||
- InsertBB->insertDbgRecordBefore( | + InsertBB->insertDbgRecordBefore(DLR, InsertBefore->getIterator()); | ||
else if (InsertBB) | else if (InsertBB) | ||
- InsertBB->insertDbgRecordBefore( | + InsertBB->insertDbgRecordBefore(DLR, InsertBB->end()); | ||
- return | + return DLR; | ||
} | } | ||
if (!LabelFn) | if (!LabelFn) |
@@ -82,7 +82,7 @@ void DbgRecord::delet | |||
delete cast<DbgVariableRecor | delete cast<DbgVariableRecor | ||
return; | return; | ||
case LabelKind: | case LabelKind: | ||
- delete | + delete cast<DbgLabelRecord>(this); | ||
return; | return; | ||
} | } | ||
llvm_unreachable | llvm_unreachable | ||
@@ -94,7 +94,7 @@ void DbgRecord::print | |||
cast<DbgVariableRecor | cast<DbgVariableRecor | ||
return; | return; | ||
case LabelKind: | case LabelKind: | ||
- | + cast<DbgLabelRecord>(this)->print(O, IsForDebug); | ||
return; | return; | ||
}; | }; | ||
llvm_unreachable | llvm_unreachable | ||
@@ -107,7 +107,7 @@ void DbgRecord::print | |||
cast<DbgVariableRecor | cast<DbgVariableRecor | ||
return; | return; | ||
case LabelKind: | case LabelKind: | ||
- | + cast<DbgLabelRecord>(this)->print(O, MST, IsForDebug); | ||
return; | return; | ||
}; | }; | ||
llvm_unreachable | llvm_unreachable | ||
@@ -121,7 +121,8 @@ bool DbgRecord::isIde | |||
return cast<DbgVariableRecor | return cast<DbgVariableRecor | ||
*cast<DbgVariableRecor | *cast<DbgVariableRecor | ||
case LabelKind: | case LabelKind: | ||
- return | + return cast<DbgLabelRecord>(this)->getLabel() == | ||
+ cast<DbgLabelRecord>(R).getLabel(); | |||
}; | }; | ||
llvm_unreachable | llvm_unreachable | ||
} | } | ||
@@ -136,24 +137,25 @@ DbgRecord::creat | |||
case ValueKind: | case ValueKind: | ||
return cast<DbgVariableRecor | return cast<DbgVariableRecor | ||
case LabelKind: | case LabelKind: | ||
- return | + return cast<DbgLabelRecord>(this)->createDebugIntrinsic(M, InsertBefore); | ||
}; | }; | ||
llvm_unreachable | llvm_unreachable | ||
} | } | ||
- | +DbgLabelRecord::DbgLabelRecord(MDNode *Label, MDNode *DL) | ||
: DbgRecord(LabelKind, DebugLoc(DL)), Label(Label) { | : DbgRecord(LabelKind, DebugLoc(DL)), Label(Label) { | ||
assert(Label && "Unexpected nullptr"); | assert(Label && "Unexpected nullptr"); | ||
assert((isa<DILabel>(Label) || Label->isTemporary()) && | assert((isa<DILabel>(Label) || Label->isTemporary()) && | ||
"Label type must be or resolve to a DILabel"); | "Label type must be or resolve to a DILabel"); | ||
} | } | ||
- | +DbgLabelRecord::DbgLabelRecord(DILabel *Label, DebugLoc DL) | ||
: DbgRecord(LabelKind, DL), Label(Label) { | : DbgRecord(LabelKind, DL), Label(Label) { | ||
assert(Label && "Unexpected nullptr"); | assert(Label && "Unexpected nullptr"); | ||
} | } | ||
-DPLabel *DPLabel::createUnresolved | +DbgLabelRecord *DbgLabelRecord::createUnresolved | ||
- return new DPLabel(Label, DL); | + MDNode *DL) { | ||
+ return new DbgLabelRecord(Label, DL); | |||
} | } | ||
DbgVariableRecor | DbgVariableRecor | ||
@@ -380,7 +382,7 @@ DbgRecord *DbgRecord::clon | |||
case ValueKind: | case ValueKind: | ||
return cast<DbgVariableRecor | return cast<DbgVariableRecor | ||
case LabelKind: | case LabelKind: | ||
- return | + return cast<DbgLabelRecord>(this)->clone(); | ||
}; | }; | ||
llvm_unreachable | llvm_unreachable | ||
} | } | ||
@@ -389,8 +391,8 @@ DbgVariableRecor | |||
return new DbgVariableRecor | return new DbgVariableRecor | ||
} | } | ||
- | +DbgLabelRecord *DbgLabelRecord::clone() const { | ||
- return new | + return new DbgLabelRecord(getLabel(), getDebugLoc()); | ||
} | } | ||
DbgVariableIntri | DbgVariableIntri | ||
@@ -450,8 +452,9 @@ DbgVariableRecor | |||
return DVI; | return DVI; | ||
} | } | ||
-DbgLabelInst * | +DbgLabelInst * | ||
- Instruction *InsertBefore) const { | +DbgLabelRecord::createDebugIntri | ||
+ Instruction *InsertBefore) const { | |||
auto *LabelFn = Intrinsic::getDeclaration(M, Intrinsic::dbg_label); | auto *LabelFn = Intrinsic::getDeclaration(M, Intrinsic::dbg_label); | ||
Value *Args[] = { | Value *Args[] = { | ||
MetadataAsValue::get(getDebugLoc()->getContext(), getLabel())}; | MetadataAsValue::get(getDebugLoc()->getContext(), getLabel())}; |
@@ -544,7 +544,7 @@ private: | |||
void visitTemplatePar | void visitTemplatePar | ||
- void visit( | + void visit(DbgLabelRecord &DLR); | ||
void visit(DbgVariableRecor | void visit(DbgVariableRecor | ||
// InstVisitor overrides... | // InstVisitor overrides... | ||
using InstVisitor<Verifier>::visit; | using InstVisitor<Verifier>::visit; | ||
@@ -696,8 +696,8 @@ void Verifier::visitD | |||
// intrinsic behaviour. | // intrinsic behaviour. | ||
verifyFragmentEx | verifyFragmentEx | ||
verifyNotEntryVa | verifyNotEntryVa | ||
- } else if (auto * | + } else if (auto *DLR = dyn_cast<DbgLabelRecord>(&DR)) { | ||
- visit(* | + visit(*DLR); | ||
} | } | ||
} | } | ||
} | } | ||
@@ -6244,22 +6244,22 @@ static DISubprogram *getSubprogram(M | |||
return nullptr; | return nullptr; | ||
} | } | ||
-void Verifier::visit( | +void Verifier::visit(DbgLabelRecord &DLR) { | ||
- CheckDI(isa<DILabel>( | + CheckDI(isa<DILabel>(DLR.getRawLabel()), | ||
- "invalid #dbg_label intrinsic variable", | + "invalid #dbg_label intrinsic variable", &DLR, DLR.getRawLabel()); | ||
// Ignore broken !dbg attachments; they're checked elsewhere. | // Ignore broken !dbg attachments; they're checked elsewhere. | ||
- if (MDNode *N = | + if (MDNode *N = DLR.getDebugLoc().getAsMDNode()) | ||
if (!isa<DILocation>(N)) | if (!isa<DILocation>(N)) | ||
return; | return; | ||
- BasicBlock *BB = | + BasicBlock *BB = DLR.getParent(); | ||
Function *F = BB ? BB->getParent() : nullptr; | Function *F = BB ? BB->getParent() : nullptr; | ||
// The scopes for variables and !dbg attachments must agree. | // The scopes for variables and !dbg attachments must agree. | ||
- DILabel *Label = | + DILabel *Label = DLR.getLabel(); | ||
- DILocation *Loc = | + DILocation *Loc = DLR.getDebugLoc(); | ||
- CheckDI(Loc, "#dbg_label record requires a !dbg attachment", | + CheckDI(Loc, "#dbg_label record requires a !dbg attachment", &DLR, BB, F); | ||
DISubprogram *LabelSP = getSubprogram(Label->getRawScope()); | DISubprogram *LabelSP = getSubprogram(Label->getRawScope()); | ||
DISubprogram *LocSP = getSubprogram(Loc->getRawScope()); | DISubprogram *LocSP = getSubprogram(Loc->getRawScope()); | ||
@@ -6268,7 +6268,7 @@ void Verifier::visit( | |||
CheckDI(LabelSP == LocSP, | CheckDI(LabelSP == LocSP, | ||
"mismatched subprogram between #dbg_label label and !dbg attachment", | "mismatched subprogram between #dbg_label label and !dbg attachment", | ||
- | + &DLR, BB, F, Label, Label->getScope()->getSubprogram(), Loc, | ||
Loc->getScope()->getSubprogram()); | Loc->getScope()->getSubprogram()); | ||
} | } | ||
@@ -292,7 +292,7 @@ bool SpeculativeExecu | |||
InstructionCost TotalSpeculation | InstructionCost TotalSpeculation | ||
unsigned NotHoistedInstCo | unsigned NotHoistedInstCo | ||
for (const auto &I : FromBlock) { | for (const auto &I : FromBlock) { | ||
- // Make note of any DbgVariableRecords that need hoisting. | + // Make note of any DbgVariableRecords that need hoisting. DbgLabelRecords | ||
// get left behind just like llvm.dbg.labels. | // get left behind just like llvm.dbg.labels. | ||
for (DbgVariableRecor | for (DbgVariableRecor | ||
if (HasNoUnhoistedIn | if (HasNoUnhoistedIn |
@@ -388,7 +388,7 @@ DbgVariableRecor | |||
SmallDenseSet<DebugVariable> VariableSet; | SmallDenseSet<DebugVariable> VariableSet; | ||
for (auto &I : reverse(*BB)) { | for (auto &I : reverse(*BB)) { | ||
for (DbgRecord &DR : reverse(I.getDbgRecordRang | for (DbgRecord &DR : reverse(I.getDbgRecordRang | ||
- if ( | + if (isa<DbgLabelRecord>(DR)) { | ||
// Emulate existing behaviour (see comment below for dbg.declares). | // Emulate existing behaviour (see comment below for dbg.declares). | ||
// FIXME: Don't do this. | // FIXME: Don't do this. | ||
VariableSet.clear(); | VariableSet.clear(); |
@@ -1619,8 +1619,8 @@ static void fixupDebugInfoPo | |||
auto UpdateDbgRecords | auto UpdateDbgRecords | ||
for (DbgRecord &DR : I.getDbgRecordRang | for (DbgRecord &DR : I.getDbgRecordRang | ||
- if ( | + if (DbgLabelRecord *DLR = dyn_cast<DbgLabelRecord>(&DR)) { | ||
- UpdateDbgLabel( | + UpdateDbgLabel(DLR); | ||
continue; | continue; | ||
} | } | ||
@@ -538,8 +538,8 @@ Value *Mapper::mapValu | |||
} | } | ||
void Mapper::remapDbgRecord(DbgRecord &DR) { | void Mapper::remapDbgRecord(DbgRecord &DR) { | ||
- if ( | + if (DbgLabelRecord *DLR = dyn_cast<DbgLabelRecord>(&DR)) { | ||
- | + DLR->setLabel(cast<DILabel>(mapMetadata(DLR->getLabel()))); | ||
return; | return; | ||
} | } | ||
@@ -922,7 +922,7 @@ TEST_F(IRBuilder | |||
DILabel *Label = | DILabel *Label = | ||
DIB.createLabel(BarScope, "badger", File, 1, /*AlwaysPreserve*/ false); | DIB.createLabel(BarScope, "badger", File, 1, /*AlwaysPreserve*/ false); | ||
- { /* dbg.label | | + { /* dbg.label | DbgLabelRecord */ | ||
// Insert before I and check order. | // Insert before I and check order. | ||
ExpectOrder(DIB.insertLabel(Label, LabelLoc, I), I->getIterator()); | ExpectOrder(DIB.insertLabel(Label, LabelLoc, I), I->getIterator()); | ||
@@ -931,7 +931,7 @@ TEST_F(IRBuilder | |||
// inserted into the block untill another instruction is added. | // inserted into the block untill another instruction is added. | ||
DbgInstPtr LabelRecord = DIB.insertLabel(Label, LabelLoc, BB); | DbgInstPtr LabelRecord = DIB.insertLabel(Label, LabelLoc, BB); | ||
// Specifically do not insert a terminator, to check this works. `I` | // Specifically do not insert a terminator, to check this works. `I` | ||
- // should have absorbed the | + // should have absorbed the DbgLabelRecord in the new debug info mode. | ||
I = Builder.CreateAlloca(Builder.getInt32Ty()); | I = Builder.CreateAlloca(Builder.getInt32Ty()); | ||
ExpectOrder(LabelRecord, I->getIterator()); | ExpectOrder(LabelRecord, I->getIterator()); | ||
} | } |