aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorStephen Tozer <stephen.tozer@sony.com>2024-03-19 20:07:07 +0000
committerGitHub <noreply@github.com>2024-03-19 20:07:07 +0000
commitffd08c7759000f55332f1657a1fab64a7adc03fd (patch)
treeffc35f7afc77e9aa3ff89031c72a9ec8e7321b2b /llvm/lib/IR
parent3cd9dccbb4235e057d0e53ab0b9673f3766800d4 (diff)
downloadllvm-ffd08c7759000f55332f1657a1fab64a7adc03fd.zip
llvm-ffd08c7759000f55332f1657a1fab64a7adc03fd.tar.gz
llvm-ffd08c7759000f55332f1657a1fab64a7adc03fd.tar.bz2
[RemoveDIs][NFC] Rename DPValue -> DbgVariableRecord (#85216)
This is the major rename patch that prior patches have built towards. The DPValue class is being renamed to DbgVariableRecord, which reflects the updated terminology for the "final" implementation of the RemoveDI feature. This is a pure string substitution + clang-format patch. The only manual component of this patch was determining where to perform these string substitutions: `DPValue` and `DPV` are almost exclusively used for DbgRecords, *except* for: - llvm/lib/target, where 'DP' is used to mean double-precision, and so appears as part of .td files and in variable names. NB: There is a single existing use of `DPValue` here that refers to debug info, which I've manually updated. - llvm/tools/gold, where 'LDPV' is used as a prefix for symbol visibility enums. Outside of these places, I've applied several basic string substitutions, with the intent that they only affect DbgRecord-related identifiers; I've checked them as I went through to verify this, with reasonable confidence that there are no unintended changes that slipped through the cracks. The substitutions applied are all case-sensitive, and are applied in the order shown: ``` DPValue -> DbgVariableRecord DPVal -> DbgVarRec DPV -> DVR ``` Following the previous rename patches, it should be the case that there are no instances of any of these strings that are meant to refer to the general case of DbgRecords, or anything other than the DPValue class. The idea behind this patch is therefore that pure string substitution is correct in all cases as long as these assumptions hold.
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/AsmWriter.cpp61
-rw-r--r--llvm/lib/IR/AutoUpgrade.cpp24
-rw-r--r--llvm/lib/IR/BasicBlock.cpp26
-rw-r--r--llvm/lib/IR/DIBuilder.cpp38
-rw-r--r--llvm/lib/IR/DebugInfo.cpp122
-rw-r--r--llvm/lib/IR/DebugInfoMetadata.cpp8
-rw-r--r--llvm/lib/IR/DebugProgramInstruction.cpp217
-rw-r--r--llvm/lib/IR/Instruction.cpp10
-rw-r--r--llvm/lib/IR/LLVMContextImpl.cpp4
-rw-r--r--llvm/lib/IR/LLVMContextImpl.h16
-rw-r--r--llvm/lib/IR/LegacyPassManager.cpp5
-rw-r--r--llvm/lib/IR/Metadata.cpp31
-rw-r--r--llvm/lib/IR/Value.cpp8
-rw-r--r--llvm/lib/IR/Verifier.cpp144
14 files changed, 373 insertions, 341 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index f657621..d7fee60 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -862,7 +862,7 @@ private:
void processInstructionMetadata(const Instruction &I);
/// Add all of the metadata from a DbgRecord.
- void processDbgRecordMetadata(const DbgRecord &DPV);
+ void processDbgRecordMetadata(const DbgRecord &DVR);
};
} // end namespace llvm
@@ -1139,17 +1139,17 @@ void SlotTracker::processFunctionMetadata(const Function &F) {
}
void SlotTracker::processDbgRecordMetadata(const DbgRecord &DR) {
- if (const DPValue *DPV = dyn_cast<const DPValue>(&DR)) {
+ if (const DbgVariableRecord *DVR = dyn_cast<const DbgVariableRecord>(&DR)) {
// Process metadata used by DbgRecords; we only specifically care about the
// DILocalVariable, DILocation, and DIAssignID fields, as the Value and
// Expression fields should only be printed inline and so do not use a slot.
// Note: The above doesn't apply for empty-metadata operands.
- if (auto *Empty = dyn_cast<MDNode>(DPV->getRawLocation()))
+ if (auto *Empty = dyn_cast<MDNode>(DVR->getRawLocation()))
CreateMetadataSlot(Empty);
- CreateMetadataSlot(DPV->getRawVariable());
- if (DPV->isDbgAssign()) {
- CreateMetadataSlot(cast<MDNode>(DPV->getRawAssignID()));
- if (auto *Empty = dyn_cast<MDNode>(DPV->getRawAddress()))
+ CreateMetadataSlot(DVR->getRawVariable());
+ if (DVR->isDbgAssign()) {
+ CreateMetadataSlot(cast<MDNode>(DVR->getRawAssignID()));
+ if (auto *Empty = dyn_cast<MDNode>(DVR->getRawAddress()))
CreateMetadataSlot(Empty);
}
} else if (const DPLabel *DPL = dyn_cast<const DPLabel>(&DR)) {
@@ -2719,10 +2719,10 @@ public:
void printInstructionLine(const Instruction &I);
void printInstruction(const Instruction &I);
void printDPMarker(const DPMarker &DPI);
- void printDPValue(const DPValue &DPI);
+ void printDbgVariableRecord(const DbgVariableRecord &DVR);
void printDPLabel(const DPLabel &DPL);
- void printDbgRecord(const DbgRecord &DPI);
- void printDbgRecordLine(const DbgRecord &DPI);
+ void printDbgRecord(const DbgRecord &DR);
+ void printDbgRecordLine(const DbgRecord &DR);
void printUseListOrder(const Value *V, const std::vector<unsigned> &Shuffle);
void printUseLists(const Function *F);
@@ -4620,46 +4620,47 @@ void AssemblyWriter::printDPMarker(const DPMarker &Marker) {
}
void AssemblyWriter::printDbgRecord(const DbgRecord &DR) {
- if (auto *DPV = dyn_cast<DPValue>(&DR))
- printDPValue(*DPV);
+ if (auto *DVR = dyn_cast<DbgVariableRecord>(&DR))
+ printDbgVariableRecord(*DVR);
else if (auto *DPL = dyn_cast<DPLabel>(&DR))
printDPLabel(*DPL);
else
llvm_unreachable("Unexpected DbgRecord kind");
}
-void AssemblyWriter::printDPValue(const DPValue &DPV) {
+void AssemblyWriter::printDbgVariableRecord(const DbgVariableRecord &DVR) {
auto WriterCtx = getContext();
Out << "#dbg_";
- switch (DPV.getType()) {
- case DPValue::LocationType::Value:
+ switch (DVR.getType()) {
+ case DbgVariableRecord::LocationType::Value:
Out << "value";
break;
- case DPValue::LocationType::Declare:
+ case DbgVariableRecord::LocationType::Declare:
Out << "declare";
break;
- case DPValue::LocationType::Assign:
+ case DbgVariableRecord::LocationType::Assign:
Out << "assign";
break;
default:
- llvm_unreachable("Tried to print a DPValue with an invalid LocationType!");
+ llvm_unreachable(
+ "Tried to print a DbgVariableRecord with an invalid LocationType!");
}
Out << "(";
- WriteAsOperandInternal(Out, DPV.getRawLocation(), WriterCtx, true);
+ WriteAsOperandInternal(Out, DVR.getRawLocation(), WriterCtx, true);
Out << ", ";
- WriteAsOperandInternal(Out, DPV.getRawVariable(), WriterCtx, true);
+ WriteAsOperandInternal(Out, DVR.getRawVariable(), WriterCtx, true);
Out << ", ";
- WriteAsOperandInternal(Out, DPV.getRawExpression(), WriterCtx, true);
+ WriteAsOperandInternal(Out, DVR.getRawExpression(), WriterCtx, true);
Out << ", ";
- if (DPV.isDbgAssign()) {
- WriteAsOperandInternal(Out, DPV.getRawAssignID(), WriterCtx, true);
+ if (DVR.isDbgAssign()) {
+ WriteAsOperandInternal(Out, DVR.getRawAssignID(), WriterCtx, true);
Out << ", ";
- WriteAsOperandInternal(Out, DPV.getRawAddress(), WriterCtx, true);
+ WriteAsOperandInternal(Out, DVR.getRawAddress(), WriterCtx, true);
Out << ", ";
- WriteAsOperandInternal(Out, DPV.getRawAddressExpression(), WriterCtx, true);
+ WriteAsOperandInternal(Out, DVR.getRawAddressExpression(), WriterCtx, true);
Out << ", ";
}
- WriteAsOperandInternal(Out, DPV.getDebugLoc().getAsMDNode(), WriterCtx, true);
+ WriteAsOperandInternal(Out, DVR.getDebugLoc().getAsMDNode(), WriterCtx, true);
Out << ")";
}
@@ -4913,7 +4914,7 @@ void DPMarker::print(raw_ostream &ROS, bool IsForDebug) const {
print(ROS, MST, IsForDebug);
}
-void DPValue::print(raw_ostream &ROS, bool IsForDebug) const {
+void DbgVariableRecord::print(raw_ostream &ROS, bool IsForDebug) const {
ModuleSlotTracker MST(getModuleFromDPI(this), true);
print(ROS, MST, IsForDebug);
@@ -4940,8 +4941,8 @@ void DPLabel::print(raw_ostream &ROS, bool IsForDebug) const {
print(ROS, MST, IsForDebug);
}
-void DPValue::print(raw_ostream &ROS, ModuleSlotTracker &MST,
- bool IsForDebug) const {
+void DbgVariableRecord::print(raw_ostream &ROS, ModuleSlotTracker &MST,
+ bool IsForDebug) const {
formatted_raw_ostream OS(ROS);
SlotTracker EmptySlotTable(static_cast<const Module *>(nullptr));
SlotTracker &SlotTable =
@@ -4954,7 +4955,7 @@ void DPValue::print(raw_ostream &ROS, ModuleSlotTracker &MST,
? Marker->getParent()->getParent()
: nullptr);
AssemblyWriter W(OS, SlotTable, getModuleFromDPI(this), nullptr, IsForDebug);
- W.printDPValue(*this);
+ W.printDbgVariableRecord(*this);
}
void DPLabel::print(raw_ostream &ROS, ModuleSlotTracker &MST,
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index c28a291..7d954f9 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -1067,7 +1067,7 @@ static bool upgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
}
}
// Update llvm.dbg.addr intrinsics even in "new debug mode"; they'll get
- // converted to DPValues later.
+ // converted to DbgVariableRecords later.
if (Name == "addr" || (Name == "value" && F->arg_size() == 4)) {
rename(F);
NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::dbg_value);
@@ -2360,23 +2360,23 @@ static void upgradeDbgIntrinsicToDbgRecord(StringRef Name, CallBase *CI) {
if (Name == "label") {
DR = new DPLabel(unwrapMAVOp<DILabel>(CI, 0), CI->getDebugLoc());
} else if (Name == "assign") {
- DR = new DPValue(
+ DR = new DbgVariableRecord(
unwrapMAVOp<Metadata>(CI, 0), unwrapMAVOp<DILocalVariable>(CI, 1),
unwrapMAVOp<DIExpression>(CI, 2), unwrapMAVOp<DIAssignID>(CI, 3),
unwrapMAVOp<Metadata>(CI, 4), unwrapMAVOp<DIExpression>(CI, 5),
CI->getDebugLoc());
} else if (Name == "declare") {
- DR = new DPValue(unwrapMAVOp<Metadata>(CI, 0),
- unwrapMAVOp<DILocalVariable>(CI, 1),
- unwrapMAVOp<DIExpression>(CI, 2), CI->getDebugLoc(),
- DPValue::LocationType::Declare);
+ DR = new DbgVariableRecord(
+ unwrapMAVOp<Metadata>(CI, 0), unwrapMAVOp<DILocalVariable>(CI, 1),
+ unwrapMAVOp<DIExpression>(CI, 2), CI->getDebugLoc(),
+ DbgVariableRecord::LocationType::Declare);
} else if (Name == "addr") {
// Upgrade dbg.addr to dbg.value with DW_OP_deref.
DIExpression *Expr = unwrapMAVOp<DIExpression>(CI, 2);
Expr = DIExpression::append(Expr, dwarf::DW_OP_deref);
- DR = new DPValue(unwrapMAVOp<Metadata>(CI, 0),
- unwrapMAVOp<DILocalVariable>(CI, 1), Expr,
- CI->getDebugLoc());
+ DR = new DbgVariableRecord(unwrapMAVOp<Metadata>(CI, 0),
+ unwrapMAVOp<DILocalVariable>(CI, 1), Expr,
+ CI->getDebugLoc());
} else if (Name == "value") {
// An old version of dbg.value had an extra offset argument.
unsigned VarOp = 1;
@@ -2389,9 +2389,9 @@ static void upgradeDbgIntrinsicToDbgRecord(StringRef Name, CallBase *CI) {
VarOp = 2;
ExprOp = 3;
}
- DR = new DPValue(unwrapMAVOp<Metadata>(CI, 0),
- unwrapMAVOp<DILocalVariable>(CI, VarOp),
- unwrapMAVOp<DIExpression>(CI, ExprOp), CI->getDebugLoc());
+ DR = new DbgVariableRecord(
+ unwrapMAVOp<Metadata>(CI, 0), unwrapMAVOp<DILocalVariable>(CI, VarOp),
+ unwrapMAVOp<DIExpression>(CI, ExprOp), CI->getDebugLoc());
}
assert(DR && "Unhandled intrinsic kind in upgrade to DbgRecord");
CI->getParent()->insertDbgRecordBefore(DR, CI->getIterator());
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index 5f07808..2dff6e4 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -71,34 +71,34 @@ void BasicBlock::convertToNewDbgValues() {
// Iterate over all instructions in the instruction list, collecting debug
// info intrinsics and converting them to DbgRecords. Once we find a "real"
// instruction, attach all those DbgRecords to a DPMarker in that instruction.
- SmallVector<DbgRecord *, 4> DPVals;
+ SmallVector<DbgRecord *, 4> DbgVarRecs;
for (Instruction &I : make_early_inc_range(InstList)) {
assert(!I.DbgMarker && "DbgMarker already set on old-format instrs?");
if (DbgVariableIntrinsic *DVI = dyn_cast<DbgVariableIntrinsic>(&I)) {
- // Convert this dbg.value to a DPValue.
- DPValue *Value = new DPValue(DVI);
- DPVals.push_back(Value);
+ // Convert this dbg.value to a DbgVariableRecord.
+ DbgVariableRecord *Value = new DbgVariableRecord(DVI);
+ DbgVarRecs.push_back(Value);
DVI->eraseFromParent();
continue;
}
if (DbgLabelInst *DLI = dyn_cast<DbgLabelInst>(&I)) {
- DPVals.push_back(new DPLabel(DLI->getLabel(), DLI->getDebugLoc()));
+ DbgVarRecs.push_back(new DPLabel(DLI->getLabel(), DLI->getDebugLoc()));
DLI->eraseFromParent();
continue;
}
- if (DPVals.empty())
+ if (DbgVarRecs.empty())
continue;
// Create a marker to store DbgRecords in.
createMarker(&I);
DPMarker *Marker = I.DbgMarker;
- for (DbgRecord *DPV : DPVals)
- Marker->insertDbgRecord(DPV, false);
+ for (DbgRecord *DVR : DbgVarRecs)
+ Marker->insertDbgRecord(DVR, false);
- DPVals.clear();
+ DbgVarRecs.clear();
}
}
@@ -1034,21 +1034,21 @@ void BasicBlock::splice(iterator Dest, BasicBlock *Src, iterator First,
flushTerminatorDbgRecords();
}
-void BasicBlock::insertDbgRecordAfter(DbgRecord *DPV, Instruction *I) {
+void BasicBlock::insertDbgRecordAfter(DbgRecord *DR, Instruction *I) {
assert(IsNewDbgInfoFormat);
assert(I->getParent() == this);
iterator NextIt = std::next(I->getIterator());
DPMarker *NextMarker = createMarker(NextIt);
- NextMarker->insertDbgRecord(DPV, true);
+ NextMarker->insertDbgRecord(DR, true);
}
-void BasicBlock::insertDbgRecordBefore(DbgRecord *DPV,
+void BasicBlock::insertDbgRecordBefore(DbgRecord *DR,
InstListType::iterator Where) {
assert(Where == end() || Where->getParent() == this);
bool InsertAtHead = Where.getHeadBit();
DPMarker *M = createMarker(Where);
- M->insertDbgRecord(DPV, InsertAtHead);
+ M->insertDbgRecord(DR, InsertAtHead);
}
DPMarker *BasicBlock::getNextMarker(Instruction *I) {
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index f484680..f10b5ac 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -967,14 +967,14 @@ DbgInstPtr DIBuilder::insertDbgAssign(Instruction *LinkedInstr, Value *Val,
assert(Link && "Linked instruction must have DIAssign metadata attached");
if (M.IsNewDbgInfoFormat) {
- DPValue *DPV = DPValue::createDPVAssign(Val, SrcVar, ValExpr, Link, Addr,
- AddrExpr, DL);
+ DbgVariableRecord *DVR = DbgVariableRecord::createDVRAssign(
+ Val, SrcVar, ValExpr, Link, Addr, AddrExpr, DL);
BasicBlock *InsertBB = LinkedInstr->getParent();
// Insert after LinkedInstr.
BasicBlock::iterator NextIt = std::next(LinkedInstr->getIterator());
Instruction *InsertBefore = NextIt == InsertBB->end() ? nullptr : &*NextIt;
- insertDPValue(DPV, InsertBB, InsertBefore, true);
- return DPV;
+ insertDbgVariableRecord(DVR, InsertBB, InsertBefore, true);
+ return DVR;
}
LLVMContext &Ctx = LinkedInstr->getContext();
@@ -1056,9 +1056,10 @@ DbgInstPtr DIBuilder::insertDbgValueIntrinsic(
llvm::Value *Val, DILocalVariable *VarInfo, DIExpression *Expr,
const DILocation *DL, BasicBlock *InsertBB, Instruction *InsertBefore) {
if (M.IsNewDbgInfoFormat) {
- DPValue *DPV = DPValue::createDPValue(Val, VarInfo, Expr, DL);
- insertDPValue(DPV, InsertBB, InsertBefore);
- return DPV;
+ DbgVariableRecord *DVR =
+ DbgVariableRecord::createDbgVariableRecord(Val, VarInfo, Expr, DL);
+ insertDbgVariableRecord(DVR, InsertBB, InsertBefore);
+ return DVR;
}
if (!ValueFn)
@@ -1078,9 +1079,10 @@ DbgInstPtr DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
"Expected matching subprograms");
if (M.IsNewDbgInfoFormat) {
- DPValue *DPV = DPValue::createDPVDeclare(Storage, VarInfo, Expr, DL);
- insertDPValue(DPV, InsertBB, InsertBefore);
- return DPV;
+ DbgVariableRecord *DVR =
+ DbgVariableRecord::createDVRDeclare(Storage, VarInfo, Expr, DL);
+ insertDbgVariableRecord(DVR, InsertBB, InsertBefore);
+ return DVR;
}
if (!DeclareFn)
@@ -1097,13 +1099,15 @@ DbgInstPtr DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
return B.CreateCall(DeclareFn, Args);
}
-void DIBuilder::insertDPValue(DPValue *DPV, BasicBlock *InsertBB,
- Instruction *InsertBefore, bool InsertAtHead) {
+void DIBuilder::insertDbgVariableRecord(DbgVariableRecord *DVR,
+ BasicBlock *InsertBB,
+ Instruction *InsertBefore,
+ bool InsertAtHead) {
assert(InsertBefore || InsertBB);
- trackIfUnresolved(DPV->getVariable());
- trackIfUnresolved(DPV->getExpression());
- if (DPV->isDbgAssign())
- trackIfUnresolved(DPV->getAddressExpression());
+ trackIfUnresolved(DVR->getVariable());
+ trackIfUnresolved(DVR->getExpression());
+ if (DVR->isDbgAssign())
+ trackIfUnresolved(DVR->getAddressExpression());
BasicBlock::iterator InsertPt;
if (InsertBB && InsertBefore)
@@ -1111,7 +1115,7 @@ void DIBuilder::insertDPValue(DPValue *DPV, BasicBlock *InsertBB,
else if (InsertBB)
InsertPt = InsertBB->end();
InsertPt.setHeadBit(InsertAtHead);
- InsertBB->insertDbgRecordBefore(DPV, InsertPt);
+ InsertBB->insertDbgRecordBefore(DVR, InsertPt);
}
Instruction *DIBuilder::insertDbgIntrinsic(llvm::Function *IntrinsicFn,
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 1736961..09bce9d 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -63,7 +63,7 @@ TinyPtrVector<DbgDeclareInst *> llvm::findDbgDeclares(Value *V) {
return Declares;
}
-TinyPtrVector<DPValue *> llvm::findDPVDeclares(Value *V) {
+TinyPtrVector<DbgVariableRecord *> llvm::findDVRDeclares(Value *V) {
// This function is hot. Check whether the value has any metadata to avoid a
// DenseMap lookup.
if (!V->isUsedByMetadata())
@@ -72,18 +72,19 @@ TinyPtrVector<DPValue *> llvm::findDPVDeclares(Value *V) {
if (!L)
return {};
- TinyPtrVector<DPValue *> Declares;
- for (DPValue *DPV : L->getAllDPValueUsers())
- if (DPV->getType() == DPValue::LocationType::Declare)
- Declares.push_back(DPV);
+ TinyPtrVector<DbgVariableRecord *> Declares;
+ for (DbgVariableRecord *DVR : L->getAllDbgVariableRecordUsers())
+ if (DVR->getType() == DbgVariableRecord::LocationType::Declare)
+ Declares.push_back(DVR);
return Declares;
}
-template <typename IntrinsicT,
- DPValue::LocationType Type = DPValue::LocationType::Any>
-static void findDbgIntrinsics(SmallVectorImpl<IntrinsicT *> &Result, Value *V,
- SmallVectorImpl<DPValue *> *DPValues) {
+template <typename IntrinsicT, DbgVariableRecord::LocationType Type =
+ DbgVariableRecord::LocationType::Any>
+static void
+findDbgIntrinsics(SmallVectorImpl<IntrinsicT *> &Result, Value *V,
+ SmallVectorImpl<DbgVariableRecord *> *DbgVariableRecords) {
// This function is hot. Check whether the value has any metadata to avoid a
// DenseMap lookup.
if (!V->isUsedByMetadata())
@@ -96,25 +97,27 @@ static void findDbgIntrinsics(SmallVectorImpl<IntrinsicT *> &Result, Value *V,
// V will also appear twice in a dbg.assign if its used in the both the value
// and address components.
SmallPtrSet<IntrinsicT *, 4> EncounteredIntrinsics;
- SmallPtrSet<DPValue *, 4> EncounteredDPValues;
+ SmallPtrSet<DbgVariableRecord *, 4> EncounteredDbgVariableRecords;
/// Append IntrinsicT users of MetadataAsValue(MD).
- auto AppendUsers = [&Ctx, &EncounteredIntrinsics, &EncounteredDPValues,
- &Result, DPValues](Metadata *MD) {
+ auto AppendUsers = [&Ctx, &EncounteredIntrinsics,
+ &EncounteredDbgVariableRecords, &Result,
+ DbgVariableRecords](Metadata *MD) {
if (auto *MDV = MetadataAsValue::getIfExists(Ctx, MD)) {
for (User *U : MDV->users())
if (IntrinsicT *DVI = dyn_cast<IntrinsicT>(U))
if (EncounteredIntrinsics.insert(DVI).second)
Result.push_back(DVI);
}
- if (!DPValues)
+ if (!DbgVariableRecords)
return;
- // Get DPValues that use this as a single value.
+ // Get DbgVariableRecords that use this as a single value.
if (LocalAsMetadata *L = dyn_cast<LocalAsMetadata>(MD)) {
- for (DPValue *DPV : L->getAllDPValueUsers()) {
- if (Type == DPValue::LocationType::Any || DPV->getType() == Type)
- if (EncounteredDPValues.insert(DPV).second)
- DPValues->push_back(DPV);
+ for (DbgVariableRecord *DVR : L->getAllDbgVariableRecordUsers()) {
+ if (Type == DbgVariableRecord::LocationType::Any ||
+ DVR->getType() == Type)
+ if (EncounteredDbgVariableRecords.insert(DVR).second)
+ DbgVariableRecords->push_back(DVR);
}
}
};
@@ -123,27 +126,30 @@ static void findDbgIntrinsics(SmallVectorImpl<IntrinsicT *> &Result, Value *V,
AppendUsers(L);
for (Metadata *AL : L->getAllArgListUsers()) {
AppendUsers(AL);
- if (!DPValues)
+ if (!DbgVariableRecords)
continue;
DIArgList *DI = cast<DIArgList>(AL);
- for (DPValue *DPV : DI->getAllDPValueUsers())
- if (Type == DPValue::LocationType::Any || DPV->getType() == Type)
- if (EncounteredDPValues.insert(DPV).second)
- DPValues->push_back(DPV);
+ for (DbgVariableRecord *DVR : DI->getAllDbgVariableRecordUsers())
+ if (Type == DbgVariableRecord::LocationType::Any ||
+ DVR->getType() == Type)
+ if (EncounteredDbgVariableRecords.insert(DVR).second)
+ DbgVariableRecords->push_back(DVR);
}
}
}
-void llvm::findDbgValues(SmallVectorImpl<DbgValueInst *> &DbgValues,
- Value *V, SmallVectorImpl<DPValue *> *DPValues) {
- findDbgIntrinsics<DbgValueInst, DPValue::LocationType::Value>(DbgValues, V,
- DPValues);
+void llvm::findDbgValues(
+ SmallVectorImpl<DbgValueInst *> &DbgValues, Value *V,
+ SmallVectorImpl<DbgVariableRecord *> *DbgVariableRecords) {
+ findDbgIntrinsics<DbgValueInst, DbgVariableRecord::LocationType::Value>(
+ DbgValues, V, DbgVariableRecords);
}
-void llvm::findDbgUsers(SmallVectorImpl<DbgVariableIntrinsic *> &DbgUsers,
- Value *V, SmallVectorImpl<DPValue *> *DPValues) {
- findDbgIntrinsics<DbgVariableIntrinsic, DPValue::LocationType::Any>(
- DbgUsers, V, DPValues);
+void llvm::findDbgUsers(
+ SmallVectorImpl<DbgVariableIntrinsic *> &DbgUsers, Value *V,
+ SmallVectorImpl<DbgVariableRecord *> *DbgVariableRecords) {
+ findDbgIntrinsics<DbgVariableIntrinsic, DbgVariableRecord::LocationType::Any>(
+ DbgUsers, V, DbgVariableRecords);
}
DISubprogram *llvm::getDISubprogram(const MDNode *Scope) {
@@ -164,16 +170,16 @@ DebugLoc llvm::getDebugValueLoc(DbgVariableIntrinsic *DII) {
return DILocation::get(DII->getContext(), 0, 0, Scope, InlinedAt);
}
-DebugLoc llvm::getDebugValueLoc(DPValue *DPV) {
+DebugLoc llvm::getDebugValueLoc(DbgVariableRecord *DVR) {
// Original dbg.declare must have a location.
- const DebugLoc &DeclareLoc = DPV->getDebugLoc();
+ const DebugLoc &DeclareLoc = DVR->getDebugLoc();
MDNode *Scope = DeclareLoc.getScope();
DILocation *InlinedAt = DeclareLoc.getInlinedAt();
// Because no machine insts can come from debug intrinsics, only the scope
// and inlinedAt is significant. Zero line numbers are used in case this
// DebugLoc leaks into any adjacent instructions. Produce an unknown location
// with the correct scope / inlinedAt fields.
- return DILocation::get(DPV->getContext(), 0, 0, Scope, InlinedAt);
+ return DILocation::get(DVR->getContext(), 0, 0, Scope, InlinedAt);
}
//===----------------------------------------------------------------------===//
@@ -253,8 +259,8 @@ void DebugInfoFinder::processLocation(const Module &M, const DILocation *Loc) {
}
void DebugInfoFinder::processDbgRecord(const Module &M, const DbgRecord &DR) {
- if (const DPValue *DPV = dyn_cast<const DPValue>(&DR))
- processVariable(M, DPV->getVariable());
+ if (const DbgVariableRecord *DVR = dyn_cast<const DbgVariableRecord>(&DR))
+ processVariable(M, DVR->getVariable());
processLocation(M, DR.getDebugLoc().get());
}
@@ -1864,14 +1870,14 @@ AssignmentMarkerRange at::getAssignmentMarkers(DIAssignID *ID) {
void at::deleteAssignmentMarkers(const Instruction *Inst) {
auto Range = getAssignmentMarkers(Inst);
- SmallVector<DPValue *> DPVAssigns = getDPVAssignmentMarkers(Inst);
- if (Range.empty() && DPVAssigns.empty())
+ SmallVector<DbgVariableRecord *> DVRAssigns = getDVRAssignmentMarkers(Inst);
+ if (Range.empty() && DVRAssigns.empty())
return;
SmallVector<DbgAssignIntrinsic *> ToDelete(Range.begin(), Range.end());
for (auto *DAI : ToDelete)
DAI->eraseFromParent();
- for (auto *DPV : DPVAssigns)
- DPV->eraseFromParent();
+ for (auto *DVR : DVRAssigns)
+ DVR->eraseFromParent();
}
void at::RAUW(DIAssignID *Old, DIAssignID *New) {
@@ -1889,12 +1895,12 @@ void at::RAUW(DIAssignID *Old, DIAssignID *New) {
void at::deleteAll(Function *F) {
SmallVector<DbgAssignIntrinsic *, 12> ToDelete;
- SmallVector<DPValue *, 12> DPToDelete;
+ SmallVector<DbgVariableRecord *, 12> DPToDelete;
for (BasicBlock &BB : *F) {
for (Instruction &I : BB) {
- for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange()))
- if (DPV.isDbgAssign())
- DPToDelete.push_back(&DPV);
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange()))
+ if (DVR.isDbgAssign())
+ DPToDelete.push_back(&DVR);
if (auto *DAI = dyn_cast<DbgAssignIntrinsic>(&I))
ToDelete.push_back(DAI);
else
@@ -1903,20 +1909,20 @@ void at::deleteAll(Function *F) {
}
for (auto *DAI : ToDelete)
DAI->eraseFromParent();
- for (auto *DPV : DPToDelete)
- DPV->eraseFromParent();
+ for (auto *DVR : DPToDelete)
+ DVR->eraseFromParent();
}
/// Get the FragmentInfo for the variable if it exists, otherwise return a
/// FragmentInfo that covers the entire variable if the variable size is
/// known, otherwise return a zero-sized fragment.
static DIExpression::FragmentInfo
-getFragmentOrEntireVariable(const DPValue *DPV) {
+getFragmentOrEntireVariable(const DbgVariableRecord *DVR) {
DIExpression::FragmentInfo VariableSlice(0, 0);
// Get the fragment or variable size, or zero.
- if (auto Sz = DPV->getFragmentSizeInBits())
+ if (auto Sz = DVR->getFragmentSizeInBits())
VariableSlice.SizeInBits = *Sz;
- if (auto Frag = DPV->getExpression()->getFragmentInfo())
+ if (auto Frag = DVR->getExpression()->getFragmentInfo())
VariableSlice.OffsetInBits = Frag->OffsetInBits;
return VariableSlice;
}
@@ -2080,10 +2086,10 @@ bool at::calculateFragmentIntersect(
}
bool at::calculateFragmentIntersect(
const DataLayout &DL, const Value *Dest, uint64_t SliceOffsetInBits,
- uint64_t SliceSizeInBits, const DPValue *DPVAssign,
+ uint64_t SliceSizeInBits, const DbgVariableRecord *DVRAssign,
std::optional<DIExpression::FragmentInfo> &Result) {
return calculateFragmentIntersectImpl(DL, Dest, SliceOffsetInBits,
- SliceSizeInBits, DPVAssign, Result);
+ SliceSizeInBits, DVRAssign, Result);
}
/// Collect constant properies (base, size, offset) of \p StoreDest.
@@ -2177,7 +2183,7 @@ static void emitDbgAssign(AssignmentInfo Info, Value *Val, Value *Dest,
DIExpression *AddrExpr =
DIExpression::get(StoreLikeInst.getContext(), std::nullopt);
if (StoreLikeInst.getParent()->IsNewDbgInfoFormat) {
- auto *Assign = DPValue::createLinkedDPVAssign(
+ auto *Assign = DbgVariableRecord::createLinkedDVRAssign(
&StoreLikeInst, Val, VarRec.Var, Expr, Dest, AddrExpr, VarRec.DL);
(void)Assign;
LLVM_DEBUG(if (Assign) errs() << " > INSERT: " << *Assign << "\n");
@@ -2295,7 +2301,7 @@ bool AssignmentTrackingPass::runOnFunction(Function &F) {
// storage" is limited to Allocas). We'll use this to find dbg.declares to
// delete after running `trackAssignments`.
DenseMap<const AllocaInst *, SmallPtrSet<DbgDeclareInst *, 2>> DbgDeclares;
- DenseMap<const AllocaInst *, SmallPtrSet<DPValue *, 2>> DPVDeclares;
+ DenseMap<const AllocaInst *, SmallPtrSet<DbgVariableRecord *, 2>> DVRDeclares;
// Create another similar map of {storage : variables} that we'll pass to
// trackAssignments.
StorageToVarsMap Vars;
@@ -2321,9 +2327,9 @@ bool AssignmentTrackingPass::runOnFunction(Function &F) {
};
for (auto &BB : F) {
for (auto &I : BB) {
- for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange())) {
- if (DPV.isDbgDeclare())
- ProcessDeclare(&DPV, DPVDeclares);
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange())) {
+ if (DVR.isDbgDeclare())
+ ProcessDeclare(&DVR, DVRDeclares);
}
if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(&I))
ProcessDeclare(DDI, DbgDeclares);
@@ -2364,8 +2370,8 @@ bool AssignmentTrackingPass::runOnFunction(Function &F) {
};
for (auto &P : DbgDeclares)
DeleteSubsumedDeclare(at::getAssignmentMarkers(P.first), P.second);
- for (auto &P : DPVDeclares)
- DeleteSubsumedDeclare(at::getDPVAssignmentMarkers(P.first), P.second);
+ for (auto &P : DVRDeclares)
+ DeleteSubsumedDeclare(at::getDVRAssignmentMarkers(P.first), P.second);
return Changed;
}
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index 6e9cc51..5705155 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -46,10 +46,10 @@ DebugVariable::DebugVariable(const DbgVariableIntrinsic *DII)
Fragment(DII->getExpression()->getFragmentInfo()),
InlinedAt(DII->getDebugLoc().getInlinedAt()) {}
-DebugVariable::DebugVariable(const DPValue *DPV)
- : Variable(DPV->getVariable()),
- Fragment(DPV->getExpression()->getFragmentInfo()),
- InlinedAt(DPV->getDebugLoc().getInlinedAt()) {}
+DebugVariable::DebugVariable(const DbgVariableRecord *DVR)
+ : Variable(DVR->getVariable()),
+ Fragment(DVR->getExpression()->getFragmentInfo()),
+ InlinedAt(DVR->getDebugLoc().getInlinedAt()) {}
DebugVariableAggregate::DebugVariableAggregate(const DbgVariableIntrinsic *DVI)
: DebugVariable(DVI->getVariable(), std::nullopt,
diff --git a/llvm/lib/IR/DebugProgramInstruction.cpp b/llvm/lib/IR/DebugProgramInstruction.cpp
index f34d3ae..1fb435f 100644
--- a/llvm/lib/IR/DebugProgramInstruction.cpp
+++ b/llvm/lib/IR/DebugProgramInstruction.cpp
@@ -28,7 +28,7 @@ template class DbgRecordParamRef<DIExpression>;
template class DbgRecordParamRef<DILabel>;
template class DbgRecordParamRef<DILocalVariable>;
-DPValue::DPValue(const DbgVariableIntrinsic *DVI)
+DbgVariableRecord::DbgVariableRecord(const DbgVariableIntrinsic *DVI)
: DbgRecord(ValueKind, DVI->getDebugLoc()),
DebugValueUser({DVI->getRawLocation(), nullptr, nullptr}),
Variable(DVI->getVariable()), Expression(DVI->getExpression()),
@@ -51,25 +51,27 @@ DPValue::DPValue(const DbgVariableIntrinsic *DVI)
}
default:
llvm_unreachable(
- "Trying to create a DPValue with an invalid intrinsic type!");
+ "Trying to create a DbgVariableRecord with an invalid intrinsic type!");
}
}
-DPValue::DPValue(const DPValue &DPV)
- : DbgRecord(ValueKind, DPV.getDebugLoc()), DebugValueUser(DPV.DebugValues),
- Type(DPV.getType()), Variable(DPV.getVariable()),
- Expression(DPV.getExpression()),
- AddressExpression(DPV.AddressExpression) {}
+DbgVariableRecord::DbgVariableRecord(const DbgVariableRecord &DVR)
+ : DbgRecord(ValueKind, DVR.getDebugLoc()), DebugValueUser(DVR.DebugValues),
+ Type(DVR.getType()), Variable(DVR.getVariable()),
+ Expression(DVR.getExpression()),
+ AddressExpression(DVR.AddressExpression) {}
-DPValue::DPValue(Metadata *Location, DILocalVariable *DV, DIExpression *Expr,
- const DILocation *DI, LocationType Type)
+DbgVariableRecord::DbgVariableRecord(Metadata *Location, DILocalVariable *DV,
+ DIExpression *Expr, const DILocation *DI,
+ LocationType Type)
: DbgRecord(ValueKind, DI), DebugValueUser({Location, nullptr, nullptr}),
Type(Type), Variable(DV), Expression(Expr) {}
-DPValue::DPValue(Metadata *Value, DILocalVariable *Variable,
- DIExpression *Expression, DIAssignID *AssignID,
- Metadata *Address, DIExpression *AddressExpression,
- const DILocation *DI)
+DbgVariableRecord::DbgVariableRecord(Metadata *Value, DILocalVariable *Variable,
+ DIExpression *Expression,
+ DIAssignID *AssignID, Metadata *Address,
+ DIExpression *AddressExpression,
+ const DILocation *DI)
: DbgRecord(ValueKind, DI), DebugValueUser({Value, Address, AssignID}),
Type(LocationType::Assign), Variable(Variable), Expression(Expression),
AddressExpression(AddressExpression) {}
@@ -77,7 +79,7 @@ DPValue::DPValue(Metadata *Value, DILocalVariable *Variable,
void DbgRecord::deleteRecord() {
switch (RecordKind) {
case ValueKind:
- delete cast<DPValue>(this);
+ delete cast<DbgVariableRecord>(this);
return;
case LabelKind:
delete cast<DPLabel>(this);
@@ -89,7 +91,7 @@ void DbgRecord::deleteRecord() {
void DbgRecord::print(raw_ostream &O, bool IsForDebug) const {
switch (RecordKind) {
case ValueKind:
- cast<DPValue>(this)->print(O, IsForDebug);
+ cast<DbgVariableRecord>(this)->print(O, IsForDebug);
return;
case LabelKind:
cast<DPLabel>(this)->print(O, IsForDebug);
@@ -102,7 +104,7 @@ void DbgRecord::print(raw_ostream &O, ModuleSlotTracker &MST,
bool IsForDebug) const {
switch (RecordKind) {
case ValueKind:
- cast<DPValue>(this)->print(O, MST, IsForDebug);
+ cast<DbgVariableRecord>(this)->print(O, MST, IsForDebug);
return;
case LabelKind:
cast<DPLabel>(this)->print(O, MST, IsForDebug);
@@ -116,7 +118,8 @@ bool DbgRecord::isIdenticalToWhenDefined(const DbgRecord &R) const {
return false;
switch (RecordKind) {
case ValueKind:
- return cast<DPValue>(this)->isIdenticalToWhenDefined(*cast<DPValue>(&R));
+ return cast<DbgVariableRecord>(this)->isIdenticalToWhenDefined(
+ *cast<DbgVariableRecord>(&R));
case LabelKind:
return cast<DPLabel>(this)->getLabel() == cast<DPLabel>(R).getLabel();
};
@@ -131,7 +134,7 @@ DbgInfoIntrinsic *
DbgRecord::createDebugIntrinsic(Module *M, Instruction *InsertBefore) const {
switch (RecordKind) {
case ValueKind:
- return cast<DPValue>(this)->createDebugIntrinsic(M, InsertBefore);
+ return cast<DbgVariableRecord>(this)->createDebugIntrinsic(M, InsertBefore);
case LabelKind:
return cast<DPLabel>(this)->createDebugIntrinsic(M, InsertBefore);
};
@@ -153,79 +156,83 @@ DPLabel *DPLabel::createUnresolvedDPLabel(MDNode *Label, MDNode *DL) {
return new DPLabel(Label, DL);
}
-DPValue::DPValue(DPValue::LocationType Type, Metadata *Val, MDNode *Variable,
- MDNode *Expression, MDNode *AssignID, Metadata *Address,
- MDNode *AddressExpression, MDNode *DI)
+DbgVariableRecord::DbgVariableRecord(DbgVariableRecord::LocationType Type,
+ Metadata *Val, MDNode *Variable,
+ MDNode *Expression, MDNode *AssignID,
+ Metadata *Address,
+ MDNode *AddressExpression, MDNode *DI)
: DbgRecord(ValueKind, DebugLoc(DI)),
DebugValueUser({Val, Address, AssignID}), Type(Type), Variable(Variable),
Expression(Expression), AddressExpression(AddressExpression) {}
-DPValue *DPValue::createUnresolvedDPValue(DPValue::LocationType Type,
- Metadata *Val, MDNode *Variable,
- MDNode *Expression, MDNode *AssignID,
- Metadata *Address,
- MDNode *AddressExpression,
- MDNode *DI) {
- return new DPValue(Type, Val, Variable, Expression, AssignID, Address,
- AddressExpression, DI);
+DbgVariableRecord *DbgVariableRecord::createUnresolvedDbgVariableRecord(
+ DbgVariableRecord::LocationType Type, Metadata *Val, MDNode *Variable,
+ MDNode *Expression, MDNode *AssignID, Metadata *Address,
+ MDNode *AddressExpression, MDNode *DI) {
+ return new DbgVariableRecord(Type, Val, Variable, Expression, AssignID,
+ Address, AddressExpression, DI);
}
-DPValue *DPValue::createDPValue(Value *Location, DILocalVariable *DV,
- DIExpression *Expr, const DILocation *DI) {
- return new DPValue(ValueAsMetadata::get(Location), DV, Expr, DI,
- LocationType::Value);
+DbgVariableRecord *
+DbgVariableRecord::createDbgVariableRecord(Value *Location, DILocalVariable *DV,
+ DIExpression *Expr,
+ const DILocation *DI) {
+ return new DbgVariableRecord(ValueAsMetadata::get(Location), DV, Expr, DI,
+ LocationType::Value);
}
-DPValue *DPValue::createDPValue(Value *Location, DILocalVariable *DV,
- DIExpression *Expr, const DILocation *DI,
- DPValue &InsertBefore) {
- auto *NewDPValue = createDPValue(Location, DV, Expr, DI);
- NewDPValue->insertBefore(&InsertBefore);
- return NewDPValue;
+DbgVariableRecord *DbgVariableRecord::createDbgVariableRecord(
+ Value *Location, DILocalVariable *DV, DIExpression *Expr,
+ const DILocation *DI, DbgVariableRecord &InsertBefore) {
+ auto *NewDbgVariableRecord = createDbgVariableRecord(Location, DV, Expr, DI);
+ NewDbgVariableRecord->insertBefore(&InsertBefore);
+ return NewDbgVariableRecord;
}
-DPValue *DPValue::createDPVDeclare(Value *Address, DILocalVariable *DV,
- DIExpression *Expr, const DILocation *DI) {
- return new DPValue(ValueAsMetadata::get(Address), DV, Expr, DI,
- LocationType::Declare);
+DbgVariableRecord *DbgVariableRecord::createDVRDeclare(Value *Address,
+ DILocalVariable *DV,
+ DIExpression *Expr,
+ const DILocation *DI) {
+ return new DbgVariableRecord(ValueAsMetadata::get(Address), DV, Expr, DI,
+ LocationType::Declare);
}
-DPValue *DPValue::createDPVDeclare(Value *Address, DILocalVariable *DV,
- DIExpression *Expr, const DILocation *DI,
- DPValue &InsertBefore) {
- auto *NewDPVDeclare = createDPVDeclare(Address, DV, Expr, DI);
- NewDPVDeclare->insertBefore(&InsertBefore);
- return NewDPVDeclare;
+DbgVariableRecord *
+DbgVariableRecord::createDVRDeclare(Value *Address, DILocalVariable *DV,
+ DIExpression *Expr, const DILocation *DI,
+ DbgVariableRecord &InsertBefore) {
+ auto *NewDVRDeclare = createDVRDeclare(Address, DV, Expr, DI);
+ NewDVRDeclare->insertBefore(&InsertBefore);
+ return NewDVRDeclare;
}
-DPValue *DPValue::createDPVAssign(Value *Val, DILocalVariable *Variable,
- DIExpression *Expression,
- DIAssignID *AssignID, Value *Address,
- DIExpression *AddressExpression,
- const DILocation *DI) {
- return new DPValue(ValueAsMetadata::get(Val), Variable, Expression, AssignID,
- ValueAsMetadata::get(Address), AddressExpression, DI);
+DbgVariableRecord *DbgVariableRecord::createDVRAssign(
+ Value *Val, DILocalVariable *Variable, DIExpression *Expression,
+ DIAssignID *AssignID, Value *Address, DIExpression *AddressExpression,
+ const DILocation *DI) {
+ return new DbgVariableRecord(ValueAsMetadata::get(Val), Variable, Expression,
+ AssignID, ValueAsMetadata::get(Address),
+ AddressExpression, DI);
}
-DPValue *DPValue::createLinkedDPVAssign(Instruction *LinkedInstr, Value *Val,
- DILocalVariable *Variable,
- DIExpression *Expression,
- Value *Address,
- DIExpression *AddressExpression,
- const DILocation *DI) {
+DbgVariableRecord *DbgVariableRecord::createLinkedDVRAssign(
+ Instruction *LinkedInstr, Value *Val, DILocalVariable *Variable,
+ DIExpression *Expression, Value *Address, DIExpression *AddressExpression,
+ const DILocation *DI) {
auto *Link = LinkedInstr->getMetadata(LLVMContext::MD_DIAssignID);
assert(Link && "Linked instruction must have DIAssign metadata attached");
- auto *NewDPVAssign = DPValue::createDPVAssign(Val, Variable, Expression,
- cast<DIAssignID>(Link), Address,
- AddressExpression, DI);
- LinkedInstr->getParent()->insertDbgRecordAfter(NewDPVAssign, LinkedInstr);
- return NewDPVAssign;
+ auto *NewDVRAssign = DbgVariableRecord::createDVRAssign(
+ Val, Variable, Expression, cast<DIAssignID>(Link), Address,
+ AddressExpression, DI);
+ LinkedInstr->getParent()->insertDbgRecordAfter(NewDVRAssign, LinkedInstr);
+ return NewDVRAssign;
}
-iterator_range<DPValue::location_op_iterator> DPValue::location_ops() const {
+iterator_range<DbgVariableRecord::location_op_iterator>
+DbgVariableRecord::location_ops() const {
auto *MD = getRawLocation();
- // If a Value has been deleted, the "location" for this DPValue will be
- // replaced by nullptr. Return an empty range.
+ // If a Value has been deleted, the "location" for this DbgVariableRecord will
+ // be replaced by nullptr. Return an empty range.
if (!MD)
return {location_op_iterator(static_cast<ValueAsMetadata *>(nullptr)),
location_op_iterator(static_cast<ValueAsMetadata *>(nullptr))};
@@ -245,13 +252,13 @@ iterator_range<DPValue::location_op_iterator> DPValue::location_ops() const {
location_op_iterator(static_cast<ValueAsMetadata *>(nullptr))};
}
-unsigned DPValue::getNumVariableLocationOps() const {
+unsigned DbgVariableRecord::getNumVariableLocationOps() const {
if (hasArgList())
return cast<DIArgList>(getRawLocation())->getArgs().size();
return 1;
}
-Value *DPValue::getVariableLocationOp(unsigned OpIdx) const {
+Value *DbgVariableRecord::getVariableLocationOp(unsigned OpIdx) const {
auto *MD = getRawLocation();
if (!MD)
return nullptr;
@@ -261,7 +268,7 @@ Value *DPValue::getVariableLocationOp(unsigned OpIdx) const {
if (isa<MDNode>(MD))
return nullptr;
assert(isa<ValueAsMetadata>(MD) &&
- "Attempted to get location operand from DPValue with none.");
+ "Attempted to get location operand from DbgVariableRecord with none.");
auto *V = cast<ValueAsMetadata>(MD);
assert(OpIdx == 0 && "Operand Index must be 0 for a debug intrinsic with a "
"single location operand.");
@@ -274,8 +281,9 @@ static ValueAsMetadata *getAsMetadata(Value *V) {
: ValueAsMetadata::get(V);
}
-void DPValue::replaceVariableLocationOp(Value *OldValue, Value *NewValue,
- bool AllowEmpty) {
+void DbgVariableRecord::replaceVariableLocationOp(Value *OldValue,
+ Value *NewValue,
+ bool AllowEmpty) {
assert(NewValue && "Values must be non-null");
bool DbgAssignAddrReplaced = isDbgAssign() && OldValue == getAddress();
@@ -307,7 +315,8 @@ void DPValue::replaceVariableLocationOp(Value *OldValue, Value *NewValue,
setRawLocation(DIArgList::get(getVariableLocationOp(0)->getContext(), MDs));
}
-void DPValue::replaceVariableLocationOp(unsigned OpIdx, Value *NewValue) {
+void DbgVariableRecord::replaceVariableLocationOp(unsigned OpIdx,
+ Value *NewValue) {
assert(OpIdx < getNumVariableLocationOps() && "Invalid Operand Index");
if (!hasArgList()) {
@@ -326,8 +335,8 @@ void DPValue::replaceVariableLocationOp(unsigned OpIdx, Value *NewValue) {
setRawLocation(DIArgList::get(getVariableLocationOp(0)->getContext(), MDs));
}
-void DPValue::addVariableLocationOps(ArrayRef<Value *> NewValues,
- DIExpression *NewExpr) {
+void DbgVariableRecord::addVariableLocationOps(ArrayRef<Value *> NewValues,
+ DIExpression *NewExpr) {
assert(NewExpr->hasAllLocationOps(getNumVariableLocationOps() +
NewValues.size()) &&
"NewExpr for debug variable intrinsic does not reference every "
@@ -342,7 +351,7 @@ void DPValue::addVariableLocationOps(ArrayRef<Value *> NewValues,
setRawLocation(DIArgList::get(getVariableLocationOp(0)->getContext(), MDs));
}
-void DPValue::setKillLocation() {
+void DbgVariableRecord::setKillLocation() {
// TODO: When/if we remove duplicate values from DIArgLists, we don't need
// this set anymore.
SmallPtrSet<Value *, 4> RemovedValues;
@@ -354,13 +363,13 @@ void DPValue::setKillLocation() {
}
}
-bool DPValue::isKillLocation() const {
+bool DbgVariableRecord::isKillLocation() const {
return (getNumVariableLocationOps() == 0 &&
!getExpression()->isComplex()) ||
any_of(location_ops(), [](Value *V) { return isa<UndefValue>(V); });
}
-std::optional<uint64_t> DPValue::getFragmentSizeInBits() const {
+std::optional<uint64_t> DbgVariableRecord::getFragmentSizeInBits() const {
if (auto Fragment = getExpression()->getFragmentInfo())
return Fragment->SizeInBits;
return getVariable()->getSizeInBits();
@@ -369,21 +378,24 @@ std::optional<uint64_t> DPValue::getFragmentSizeInBits() const {
DbgRecord *DbgRecord::clone() const {
switch (RecordKind) {
case ValueKind:
- return cast<DPValue>(this)->clone();
+ return cast<DbgVariableRecord>(this)->clone();
case LabelKind:
return cast<DPLabel>(this)->clone();
};
llvm_unreachable("unsupported DbgRecord kind");
}
-DPValue *DPValue::clone() const { return new DPValue(*this); }
+DbgVariableRecord *DbgVariableRecord::clone() const {
+ return new DbgVariableRecord(*this);
+}
DPLabel *DPLabel::clone() const {
return new DPLabel(getLabel(), getDebugLoc());
}
DbgVariableIntrinsic *
-DPValue::createDebugIntrinsic(Module *M, Instruction *InsertBefore) const {
+DbgVariableRecord::createDebugIntrinsic(Module *M,
+ Instruction *InsertBefore) const {
[[maybe_unused]] DICompileUnit *Unit =
getDebugLoc().get()->getScope()->getSubprogram()->getUnit();
assert(M && Unit &&
@@ -394,24 +406,25 @@ DPValue::createDebugIntrinsic(Module *M, Instruction *InsertBefore) const {
// Work out what sort of intrinsic we're going to produce.
switch (getType()) {
- case DPValue::LocationType::Declare:
+ case DbgVariableRecord::LocationType::Declare:
IntrinsicFn = Intrinsic::getDeclaration(M, Intrinsic::dbg_declare);
break;
- case DPValue::LocationType::Value:
+ case DbgVariableRecord::LocationType::Value:
IntrinsicFn = Intrinsic::getDeclaration(M, Intrinsic::dbg_value);
break;
- case DPValue::LocationType::Assign:
+ case DbgVariableRecord::LocationType::Assign:
IntrinsicFn = Intrinsic::getDeclaration(M, Intrinsic::dbg_assign);
break;
- case DPValue::LocationType::End:
- case DPValue::LocationType::Any:
+ case DbgVariableRecord::LocationType::End:
+ case DbgVariableRecord::LocationType::Any:
llvm_unreachable("Invalid LocationType");
}
- // Create the intrinsic from this DPValue's information, optionally insert
- // into the target location.
+ // Create the intrinsic from this DbgVariableRecord's information, optionally
+ // insert into the target location.
DbgVariableIntrinsic *DVI;
- assert(getRawLocation() && "DPValue's RawLocation should be non-null.");
+ assert(getRawLocation() &&
+ "DbgVariableRecord's RawLocation should be non-null.");
if (isDbgAssign()) {
Value *AssignArgs[] = {
MetadataAsValue::get(Context, getRawLocation()),
@@ -451,7 +464,7 @@ DbgLabelInst *DPLabel::createDebugIntrinsic(Module *M,
return DbgLabel;
}
-Value *DPValue::getAddress() const {
+Value *DbgVariableRecord::getAddress() const {
auto *MD = getRawAddress();
if (auto *V = dyn_cast<ValueAsMetadata>(MD))
return V->getValue();
@@ -461,18 +474,20 @@ Value *DPValue::getAddress() const {
return nullptr;
}
-DIAssignID *DPValue::getAssignID() const {
+DIAssignID *DbgVariableRecord::getAssignID() const {
return cast<DIAssignID>(DebugValues[2]);
}
-void DPValue::setAssignId(DIAssignID *New) { resetDebugValue(2, New); }
+void DbgVariableRecord::setAssignId(DIAssignID *New) {
+ resetDebugValue(2, New);
+}
-void DPValue::setKillAddress() {
+void DbgVariableRecord::setKillAddress() {
resetDebugValue(
1, ValueAsMetadata::get(UndefValue::get(getAddress()->getType())));
}
-bool DPValue::isKillAddress() const {
+bool DbgVariableRecord::isKillAddress() const {
Value *Addr = getAddress();
return !Addr || isa<UndefValue>(Addr);
}
@@ -647,8 +662,8 @@ void DPMarker::insertDbgRecordAfter(DbgRecord *New, DbgRecord *InsertAfter) {
void DPMarker::absorbDebugValues(DPMarker &Src, bool InsertAtHead) {
auto It = InsertAtHead ? StoredDbgRecords.begin() : StoredDbgRecords.end();
- for (DbgRecord &DPV : Src.StoredDbgRecords)
- DPV.setMarker(this);
+ for (DbgRecord &DVR : Src.StoredDbgRecords)
+ DVR.setMarker(this);
StoredDbgRecords.splice(It, Src.StoredDbgRecords);
}
@@ -677,8 +692,8 @@ iterator_range<simple_ilist<DbgRecord>::iterator> DPMarker::cloneDebugInfoFrom(
if (from_here.has_value())
Range = make_range(*from_here, From->StoredDbgRecords.end());
- // Clone each DPValue and insert into StoreDPValues; optionally place them at
- // the start or the end of the list.
+ // Clone each DbgVariableRecord and insert into StoreDbgVariableRecords;
+ // optionally place them at the start or the end of the list.
auto Pos = (InsertAtHead) ? StoredDbgRecords.begin() : StoredDbgRecords.end();
for (DbgRecord &DR : Range) {
DbgRecord *New = DR.clone();
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index 7a677d7..9744eb3 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -143,8 +143,8 @@ void Instruction::insertBefore(BasicBlock &BB,
return;
// We've inserted "this": if InsertAtHead is set then it comes before any
- // DPValues attached to InsertPos. But if it's not set, then any DbgRecords
- // should now come before "this".
+ // DbgVariableRecords attached to InsertPos. But if it's not set, then any
+ // DbgRecords should now come before "this".
bool InsertAtHead = InsertPos.getHeadBit();
if (!InsertAtHead) {
DPMarker *SrcMarker = BB.getMarker(InsertPos);
@@ -217,7 +217,7 @@ void Instruction::moveBeforeImpl(BasicBlock &BB, InstListType::iterator I,
if (BB.IsNewDbgInfoFormat && DbgMarker && !Preserve) {
if (I != this->getIterator() || InsertAtHead) {
// "this" is definitely moving in the list, or it's moving ahead of its
- // attached DPValues. Detach any existing DbgRecords.
+ // attached DbgVariableRecords. Detach any existing DbgRecords.
handleMarkerRemoval();
}
}
@@ -320,8 +320,8 @@ void Instruction::dropDbgRecords() {
DbgMarker->dropDbgRecords();
}
-void Instruction::dropOneDbgRecord(DbgRecord *DPV) {
- DbgMarker->dropOneDbgRecord(DPV);
+void Instruction::dropOneDbgRecord(DbgRecord *DVR) {
+ DbgMarker->dropOneDbgRecord(DVR);
}
bool Instruction::comesBefore(const Instruction *Other) const {
diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp
index a471314..72fedd8 100644
--- a/llvm/lib/IR/LLVMContextImpl.cpp
+++ b/llvm/lib/IR/LLVMContextImpl.cpp
@@ -48,8 +48,8 @@ LLVMContextImpl::~LLVMContextImpl() {
#ifndef NDEBUG
// Check that any variable location records that fell off the end of a block
// when it's terminator was removed were eventually replaced. This assertion
- // firing indicates that DPValues went missing during the lifetime of the
- // LLVMContext.
+ // firing indicates that DbgVariableRecords went missing during the lifetime
+ // of the LLVMContext.
assert(TrailingDbgRecords.empty() && "DbgRecords in blocks not cleaned");
#endif
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index 00af694..4542e16 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -1675,20 +1675,20 @@ public:
/// LLVMContext is used by compilation.
void setOptPassGate(OptPassGate &);
- /// Mapping of blocks to collections of "trailing" DPValues. As part of the
- /// "RemoveDIs" project, debug-info variable location records are going to
- /// cease being instructions... which raises the problem of where should they
- /// be recorded when we remove the terminator of a blocks, such as:
+ /// Mapping of blocks to collections of "trailing" DbgVariableRecords. As part
+ /// of the "RemoveDIs" project, debug-info variable location records are going
+ /// to cease being instructions... which raises the problem of where should
+ /// they be recorded when we remove the terminator of a blocks, such as:
///
/// %foo = add i32 0, 0
/// br label %bar
///
/// If the branch is removed, a legitimate transient state while editing a
/// block, any debug-records between those two instructions will not have a
- /// location. Each block thus records any DPValue records that "trail" in
- /// such a way. These are stored in LLVMContext because typically LLVM only
- /// edits a small number of blocks at a time, so there's no need to bloat
- /// BasicBlock with such a data structure.
+ /// location. Each block thus records any DbgVariableRecord records that
+ /// "trail" in such a way. These are stored in LLVMContext because typically
+ /// LLVM only edits a small number of blocks at a time, so there's no need to
+ /// bloat BasicBlock with such a data structure.
SmallDenseMap<BasicBlock *, DPMarker *> TrailingDbgRecords;
// Set, get and delete operations for TrailingDbgRecords.
diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp
index 8945c6d..953f21c 100644
--- a/llvm/lib/IR/LegacyPassManager.cpp
+++ b/llvm/lib/IR/LegacyPassManager.cpp
@@ -528,8 +528,9 @@ bool PassManagerImpl::run(Module &M) {
dumpArguments();
dumpPasses();
- // RemoveDIs: if a command line flag is given, convert to the DPValue
- // representation of debug-info for the duration of these passes.
+ // RemoveDIs: if a command line flag is given, convert to the
+ // DbgVariableRecord representation of debug-info for the duration of these
+ // passes.
bool shouldConvertDbgInfo = UseNewDbgInfoFormat && !M.IsNewDbgInfoFormat;
if (shouldConvertDbgInfo)
M.convertToNewDbgValues();
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index 06db91f..4472bf1 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -148,9 +148,11 @@ void MetadataAsValue::untrack() {
MetadataTracking::untrack(MD);
}
-DPValue *DebugValueUser::getUser() { return static_cast<DPValue *>(this); }
-const DPValue *DebugValueUser::getUser() const {
- return static_cast<const DPValue *>(this);
+DbgVariableRecord *DebugValueUser::getUser() {
+ return static_cast<DbgVariableRecord *>(this);
+}
+const DbgVariableRecord *DebugValueUser::getUser() const {
+ return static_cast<const DbgVariableRecord *>(this);
}
void DebugValueUser::handleChangedValue(void *Old, Metadata *New) {
@@ -266,28 +268,29 @@ SmallVector<Metadata *> ReplaceableMetadataImpl::getAllArgListUsers() {
return MDUsers;
}
-SmallVector<DPValue *> ReplaceableMetadataImpl::getAllDPValueUsers() {
- SmallVector<std::pair<OwnerTy, uint64_t> *> DPVUsersWithID;
+SmallVector<DbgVariableRecord *>
+ReplaceableMetadataImpl::getAllDbgVariableRecordUsers() {
+ SmallVector<std::pair<OwnerTy, uint64_t> *> DVRUsersWithID;
for (auto Pair : UseMap) {
OwnerTy Owner = Pair.second.first;
if (Owner.isNull())
continue;
if (!Owner.is<DebugValueUser *>())
continue;
- DPVUsersWithID.push_back(&UseMap[Pair.first]);
+ DVRUsersWithID.push_back(&UseMap[Pair.first]);
}
- // Order DPValue users in reverse-creation order. Normal dbg.value users
- // of MetadataAsValues are ordered by their UseList, i.e. reverse order of
- // when they were added: we need to replicate that here. The structure of
+ // Order DbgVariableRecord users in reverse-creation order. Normal dbg.value
+ // users of MetadataAsValues are ordered by their UseList, i.e. reverse order
+ // of when they were added: we need to replicate that here. The structure of
// debug-info output depends on the ordering of intrinsics, thus we need
// to keep them consistent for comparisons sake.
- llvm::sort(DPVUsersWithID, [](auto UserA, auto UserB) {
+ llvm::sort(DVRUsersWithID, [](auto UserA, auto UserB) {
return UserA->second > UserB->second;
});
- SmallVector<DPValue *> DPVUsers;
- for (auto UserWithID : DPVUsersWithID)
- DPVUsers.push_back(UserWithID->first.get<DebugValueUser *>()->getUser());
- return DPVUsers;
+ SmallVector<DbgVariableRecord *> DVRUsers;
+ for (auto UserWithID : DVRUsersWithID)
+ DVRUsers.push_back(UserWithID->first.get<DebugValueUser *>()->getUser());
+ return DVRUsers;
}
void ReplaceableMetadataImpl::addRef(void *Ref, OwnerTy Owner) {
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index c4e4797..61e1c35 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -574,16 +574,16 @@ void Value::replaceUsesWithIf(Value *New,
/// with New.
static void replaceDbgUsesOutsideBlock(Value *V, Value *New, BasicBlock *BB) {
SmallVector<DbgVariableIntrinsic *> DbgUsers;
- SmallVector<DPValue *> DPUsers;
+ SmallVector<DbgVariableRecord *> DPUsers;
findDbgUsers(DbgUsers, V, &DPUsers);
for (auto *DVI : DbgUsers) {
if (DVI->getParent() != BB)
DVI->replaceVariableLocationOp(V, New);
}
- for (auto *DPV : DPUsers) {
- DPMarker *Marker = DPV->getMarker();
+ for (auto *DVR : DPUsers) {
+ DPMarker *Marker = DVR->getMarker();
if (Marker->getParent() != BB)
- DPV->replaceVariableLocationOp(V, New);
+ DVR->replaceVariableLocationOp(V, New);
}
}
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index a923f5e..1e16e864 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -180,21 +180,21 @@ private:
}
}
- void Write(DPValue::LocationType Type) {
+ void Write(DbgVariableRecord::LocationType Type) {
switch (Type) {
- case DPValue::LocationType::Value:
+ case DbgVariableRecord::LocationType::Value:
*OS << "value";
break;
- case DPValue::LocationType::Declare:
+ case DbgVariableRecord::LocationType::Declare:
*OS << "declare";
break;
- case DPValue::LocationType::Assign:
+ case DbgVariableRecord::LocationType::Assign:
*OS << "assign";
break;
- case DPValue::LocationType::End:
+ case DbgVariableRecord::LocationType::End:
*OS << "end";
break;
- case DPValue::LocationType::Any:
+ case DbgVariableRecord::LocationType::Any:
*OS << "any";
break;
};
@@ -545,7 +545,7 @@ private:
void visitTemplateParams(const MDNode &N, const Metadata &RawParams);
void visit(DPLabel &DPL);
- void visit(DPValue &DPV);
+ void visit(DbgVariableRecord &DVR);
// InstVisitor overrides...
using InstVisitor<Verifier>::visit;
void visitDbgRecords(Instruction &I);
@@ -632,15 +632,15 @@ private:
void verifySiblingFuncletUnwinds();
void verifyFragmentExpression(const DbgVariableIntrinsic &I);
- void verifyFragmentExpression(const DPValue &I);
+ void verifyFragmentExpression(const DbgVariableRecord &I);
template <typename ValueOrMetadata>
void verifyFragmentExpression(const DIVariable &V,
DIExpression::FragmentInfo Fragment,
ValueOrMetadata *Desc);
void verifyFnArgs(const DbgVariableIntrinsic &I);
- void verifyFnArgs(const DPValue &DPV);
+ void verifyFnArgs(const DbgVariableRecord &DVR);
void verifyNotEntryValue(const DbgVariableIntrinsic &I);
- void verifyNotEntryValue(const DPValue &I);
+ void verifyNotEntryValue(const DbgVariableRecord &I);
/// Module-level debug info verification...
void verifyCompileUnits();
@@ -690,12 +690,12 @@ void Verifier::visitDbgRecords(Instruction &I) {
if (auto *Loc =
dyn_cast_or_null<DILocation>(DR.getDebugLoc().getAsMDNode()))
visitMDNode(*Loc, AreDebugLocsAllowed::Yes);
- if (auto *DPV = dyn_cast<DPValue>(&DR)) {
- visit(*DPV);
+ if (auto *DVR = dyn_cast<DbgVariableRecord>(&DR)) {
+ visit(*DVR);
// These have to appear after `visit` for consistency with existing
// intrinsic behaviour.
- verifyFragmentExpression(*DPV);
- verifyNotEntryValue(*DPV);
+ verifyFragmentExpression(*DVR);
+ verifyNotEntryValue(*DVR);
} else if (auto *DPL = dyn_cast<DPLabel>(&DR)) {
visit(*DPL);
}
@@ -4808,11 +4808,12 @@ void Verifier::visitDIAssignIDMetadata(Instruction &I, MDNode *MD) {
"dbg.assign not in same function as inst", DAI, &I);
}
}
- for (DPValue *DPV : cast<DIAssignID>(MD)->getAllDPValueUsers()) {
- CheckDI(DPV->isDbgAssign(),
- "!DIAssignID should only be used by Assign DPVs.", MD, DPV);
- CheckDI(DPV->getFunction() == I.getFunction(),
- "DPVAssign not in same function as inst", DPV, &I);
+ for (DbgVariableRecord *DVR :
+ cast<DIAssignID>(MD)->getAllDbgVariableRecordUsers()) {
+ CheckDI(DVR->isDbgAssign(),
+ "!DIAssignID should only be used by Assign DVRs.", MD, DVR);
+ CheckDI(DVR->getFunction() == I.getFunction(),
+ "DVRAssign not in same function as inst", DVR, &I);
}
}
@@ -6271,71 +6272,72 @@ void Verifier::visit(DPLabel &DPL) {
Loc->getScope()->getSubprogram());
}
-void Verifier::visit(DPValue &DPV) {
- BasicBlock *BB = DPV.getParent();
+void Verifier::visit(DbgVariableRecord &DVR) {
+ BasicBlock *BB = DVR.getParent();
Function *F = BB->getParent();
- CheckDI(DPV.getType() == DPValue::LocationType::Value ||
- DPV.getType() == DPValue::LocationType::Declare ||
- DPV.getType() == DPValue::LocationType::Assign,
- "invalid #dbg record type", &DPV, DPV.getType());
+ CheckDI(DVR.getType() == DbgVariableRecord::LocationType::Value ||
+ DVR.getType() == DbgVariableRecord::LocationType::Declare ||
+ DVR.getType() == DbgVariableRecord::LocationType::Assign,
+ "invalid #dbg record type", &DVR, DVR.getType());
- // The location for a DPValue must be either a ValueAsMetadata, DIArgList, or
- // an empty MDNode (which is a legacy representation for an "undef" location).
- auto *MD = DPV.getRawLocation();
+ // The location for a DbgVariableRecord must be either a ValueAsMetadata,
+ // DIArgList, or an empty MDNode (which is a legacy representation for an
+ // "undef" location).
+ auto *MD = DVR.getRawLocation();
CheckDI(MD && (isa<ValueAsMetadata>(MD) || isa<DIArgList>(MD) ||
(isa<MDNode>(MD) && !cast<MDNode>(MD)->getNumOperands())),
- "invalid #dbg record address/value", &DPV, MD);
+ "invalid #dbg record address/value", &DVR, MD);
if (auto *VAM = dyn_cast<ValueAsMetadata>(MD))
visitValueAsMetadata(*VAM, F);
else if (auto *AL = dyn_cast<DIArgList>(MD))
visitDIArgList(*AL, F);
- CheckDI(isa_and_nonnull<DILocalVariable>(DPV.getRawVariable()),
- "invalid #dbg record variable", &DPV, DPV.getRawVariable());
- visitMDNode(*DPV.getRawVariable(), AreDebugLocsAllowed::No);
+ CheckDI(isa_and_nonnull<DILocalVariable>(DVR.getRawVariable()),
+ "invalid #dbg record variable", &DVR, DVR.getRawVariable());
+ visitMDNode(*DVR.getRawVariable(), AreDebugLocsAllowed::No);
- CheckDI(isa_and_nonnull<DIExpression>(DPV.getRawExpression()),
- "invalid #dbg record expression", &DPV, DPV.getRawExpression());
- visitMDNode(*DPV.getExpression(), AreDebugLocsAllowed::No);
+ CheckDI(isa_and_nonnull<DIExpression>(DVR.getRawExpression()),
+ "invalid #dbg record expression", &DVR, DVR.getRawExpression());
+ visitMDNode(*DVR.getExpression(), AreDebugLocsAllowed::No);
- if (DPV.isDbgAssign()) {
- CheckDI(isa_and_nonnull<DIAssignID>(DPV.getRawAssignID()),
- "invalid #dbg_assign DIAssignID", &DPV, DPV.getRawAssignID());
- visitMDNode(*cast<DIAssignID>(DPV.getRawAssignID()),
+ if (DVR.isDbgAssign()) {
+ CheckDI(isa_and_nonnull<DIAssignID>(DVR.getRawAssignID()),
+ "invalid #dbg_assign DIAssignID", &DVR, DVR.getRawAssignID());
+ visitMDNode(*cast<DIAssignID>(DVR.getRawAssignID()),
AreDebugLocsAllowed::No);
- const auto *RawAddr = DPV.getRawAddress();
- // Similarly to the location above, the address for an assign DPValue must
- // be a ValueAsMetadata or an empty MDNode, which represents an undef
- // address.
+ const auto *RawAddr = DVR.getRawAddress();
+ // Similarly to the location above, the address for an assign
+ // DbgVariableRecord must be a ValueAsMetadata or an empty MDNode, which
+ // represents an undef address.
CheckDI(
isa<ValueAsMetadata>(RawAddr) ||
(isa<MDNode>(RawAddr) && !cast<MDNode>(RawAddr)->getNumOperands()),
- "invalid #dbg_assign address", &DPV, DPV.getRawAddress());
+ "invalid #dbg_assign address", &DVR, DVR.getRawAddress());
if (auto *VAM = dyn_cast<ValueAsMetadata>(RawAddr))
visitValueAsMetadata(*VAM, F);
- CheckDI(isa_and_nonnull<DIExpression>(DPV.getRawAddressExpression()),
- "invalid #dbg_assign address expression", &DPV,
- DPV.getRawAddressExpression());
- visitMDNode(*DPV.getAddressExpression(), AreDebugLocsAllowed::No);
+ CheckDI(isa_and_nonnull<DIExpression>(DVR.getRawAddressExpression()),
+ "invalid #dbg_assign address expression", &DVR,
+ DVR.getRawAddressExpression());
+ visitMDNode(*DVR.getAddressExpression(), AreDebugLocsAllowed::No);
- // All of the linked instructions should be in the same function as DPV.
- for (Instruction *I : at::getAssignmentInsts(&DPV))
- CheckDI(DPV.getFunction() == I->getFunction(),
- "inst not in same function as #dbg_assign", I, &DPV);
+ // All of the linked instructions should be in the same function as DVR.
+ for (Instruction *I : at::getAssignmentInsts(&DVR))
+ CheckDI(DVR.getFunction() == I->getFunction(),
+ "inst not in same function as #dbg_assign", I, &DVR);
}
// This check is redundant with one in visitLocalVariable().
- DILocalVariable *Var = DPV.getVariable();
+ DILocalVariable *Var = DVR.getVariable();
CheckDI(isType(Var->getRawType()), "invalid type ref", Var,
Var->getRawType());
- auto *DLNode = DPV.getDebugLoc().getAsMDNode();
+ auto *DLNode = DVR.getDebugLoc().getAsMDNode();
CheckDI(isa_and_nonnull<DILocation>(DLNode), "invalid #dbg record DILocation",
- &DPV, DLNode);
- DILocation *Loc = DPV.getDebugLoc();
+ &DVR, DLNode);
+ DILocation *Loc = DVR.getDebugLoc();
// The scopes for variables and !dbg attachments must agree.
DISubprogram *VarSP = getSubprogram(Var->getRawScope());
@@ -6345,10 +6347,10 @@ void Verifier::visit(DPValue &DPV) {
CheckDI(VarSP == LocSP,
"mismatched subprogram between #dbg record variable and DILocation",
- &DPV, BB, F, Var, Var->getScope()->getSubprogram(), Loc,
+ &DVR, BB, F, Var, Var->getScope()->getSubprogram(), Loc,
Loc->getScope()->getSubprogram());
- verifyFnArgs(DPV);
+ verifyFnArgs(DVR);
}
void Verifier::visitVPIntrinsic(VPIntrinsic &VPI) {
@@ -6709,9 +6711,9 @@ void Verifier::verifyFragmentExpression(const DbgVariableIntrinsic &I) {
verifyFragmentExpression(*V, *Fragment, &I);
}
-void Verifier::verifyFragmentExpression(const DPValue &DPV) {
- DILocalVariable *V = dyn_cast_or_null<DILocalVariable>(DPV.getRawVariable());
- DIExpression *E = dyn_cast_or_null<DIExpression>(DPV.getRawExpression());
+void Verifier::verifyFragmentExpression(const DbgVariableRecord &DVR) {
+ DILocalVariable *V = dyn_cast_or_null<DILocalVariable>(DVR.getRawVariable());
+ DIExpression *E = dyn_cast_or_null<DIExpression>(DVR.getRawExpression());
// We don't know whether this intrinsic verified correctly.
if (!V || !E || !E->isValid())
@@ -6731,7 +6733,7 @@ void Verifier::verifyFragmentExpression(const DPValue &DPV) {
if (V->isArtificial())
return;
- verifyFragmentExpression(*V, *Fragment, &DPV);
+ verifyFragmentExpression(*V, *Fragment, &DVR);
}
template <typename ValueOrMetadata>
@@ -6779,7 +6781,7 @@ void Verifier::verifyFnArgs(const DbgVariableIntrinsic &I) {
CheckDI(!Prev || (Prev == Var), "conflicting debug info for argument", &I,
Prev, Var);
}
-void Verifier::verifyFnArgs(const DPValue &DPV) {
+void Verifier::verifyFnArgs(const DbgVariableRecord &DVR) {
// This function does not take the scope of noninlined function arguments into
// account. Don't run it if current function is nodebug, because it may
// contain inlined debug intrinsics.
@@ -6787,10 +6789,10 @@ void Verifier::verifyFnArgs(const DPValue &DPV) {
return;
// For performance reasons only check non-inlined ones.
- if (DPV.getDebugLoc()->getInlinedAt())
+ if (DVR.getDebugLoc()->getInlinedAt())
return;
- DILocalVariable *Var = DPV.getVariable();
+ DILocalVariable *Var = DVR.getVariable();
CheckDI(Var, "#dbg record without variable");
unsigned ArgNo = Var->getArg();
@@ -6804,7 +6806,7 @@ void Verifier::verifyFnArgs(const DPValue &DPV) {
auto *Prev = DebugFnArgs[ArgNo - 1];
DebugFnArgs[ArgNo - 1] = Var;
- CheckDI(!Prev || (Prev == Var), "conflicting debug info for argument", &DPV,
+ CheckDI(!Prev || (Prev == Var), "conflicting debug info for argument", &DVR,
Prev, Var);
}
@@ -6831,15 +6833,15 @@ void Verifier::verifyNotEntryValue(const DbgVariableIntrinsic &I) {
"swiftasync Argument",
&I);
}
-void Verifier::verifyNotEntryValue(const DPValue &DPV) {
- DIExpression *E = dyn_cast_or_null<DIExpression>(DPV.getRawExpression());
+void Verifier::verifyNotEntryValue(const DbgVariableRecord &DVR) {
+ DIExpression *E = dyn_cast_or_null<DIExpression>(DVR.getRawExpression());
// We don't know whether this intrinsic verified correctly.
if (!E || !E->isValid())
return;
- if (isa<ValueAsMetadata>(DPV.getRawLocation())) {
- Value *VarValue = DPV.getVariableLocationOp(0);
+ if (isa<ValueAsMetadata>(DVR.getRawLocation())) {
+ Value *VarValue = DVR.getVariableLocationOp(0);
if (isa<UndefValue>(VarValue) || isa<PoisonValue>(VarValue))
return;
// We allow EntryValues for swift async arguments, as they have an
@@ -6852,7 +6854,7 @@ void Verifier::verifyNotEntryValue(const DPValue &DPV) {
CheckDI(!E->isEntryValue(),
"Entry values are only allowed in MIR unless they target a "
"swiftasync Argument",
- &DPV);
+ &DVR);
}
void Verifier::verifyCompileUnits() {