aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/DebugInfo.cpp
diff options
context:
space:
mode:
authorOrlando Cazalet-Hyams <orlando.hyams@sony.com>2024-02-20 16:00:55 +0000
committerGitHub <noreply@github.com>2024-02-20 16:00:55 +0000
commitababa964752d5bfa6eb608c97f19d4e68df1d243 (patch)
tree26b6cb86bafab688a348e950479323949092e568 /llvm/lib/IR/DebugInfo.cpp
parent8f7ae64ea108de54d9aad963c55e1aef7dc62b86 (diff)
downloadllvm-ababa964752d5bfa6eb608c97f19d4e68df1d243.zip
llvm-ababa964752d5bfa6eb608c97f19d4e68df1d243.tar.gz
llvm-ababa964752d5bfa6eb608c97f19d4e68df1d243.tar.bz2
[RemoveDIs][NFC] Introduce DbgRecord base class [1/3] (#78252)
Patch 1 of 3 to add llvm.dbg.label support to the RemoveDIs project. The patch stack adds a new base class -> 1. Add DbgRecord base class for DPValue and the not-yet-added DPLabel class. 2. Add the DPLabel class. 3. Enable dbg.label conversion and add support to passes. Patches 1 and 2 are NFC. In the near future we also will rename DPValue to DbgVariableRecord and DPLabel to DbgLabelRecord, at which point we'll overhaul the function names too. The name DPLabel keeps things consistent for now.
Diffstat (limited to 'llvm/lib/IR/DebugInfo.cpp')
-rw-r--r--llvm/lib/IR/DebugInfo.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index eaa5cb3..a4fec60 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -240,8 +240,8 @@ void DebugInfoFinder::processInstruction(const Module &M,
if (auto DbgLoc = I.getDebugLoc())
processLocation(M, DbgLoc.get());
- for (const DPValue &DPV : I.getDbgValueRange())
- processDPValue(M, DPV);
+ for (const DbgRecord &DPR : I.getDbgValueRange())
+ processDbgRecord(M, DPR);
}
void DebugInfoFinder::processLocation(const Module &M, const DILocation *Loc) {
@@ -256,6 +256,10 @@ void DebugInfoFinder::processDPValue(const Module &M, const DPValue &DPV) {
processLocation(M, DPV.getDebugLoc().get());
}
+void DebugInfoFinder::processDbgRecord(const Module &M, const DbgRecord &DPR) {
+ processDPValue(M, cast<DPValue>(DPR));
+}
+
void DebugInfoFinder::processType(DIType *DT) {
if (!addType(DT))
return;
@@ -1822,7 +1826,7 @@ void at::deleteAll(Function *F) {
SmallVector<DPValue *, 12> DPToDelete;
for (BasicBlock &BB : *F) {
for (Instruction &I : BB) {
- for (auto &DPV : I.getDbgValueRange())
+ for (DPValue &DPV : DPValue::filter(I.getDbgValueRange()))
if (DPV.isDbgAssign())
DPToDelete.push_back(&DPV);
if (auto *DAI = dyn_cast<DbgAssignIntrinsic>(&I))
@@ -2246,7 +2250,7 @@ bool AssignmentTrackingPass::runOnFunction(Function &F) {
};
for (auto &BB : F) {
for (auto &I : BB) {
- for (auto &DPV : I.getDbgValueRange()) {
+ for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) {
if (DPV.isDbgDeclare())
ProcessDeclare(&DPV, DPVDeclares);
}