Skip to content

Commit 5586259

Browse files
[llvm-debuginfo-analyzer] Add support for LLVM IR format.
Fixed compilation issues after latest DebugSSAUpdater rebase.
1 parent 7d19274 commit 5586259

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

llvm/include/llvm/DebugInfo/LogicalView/Readers/LVIRReader.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ class LVIRReader final : public LVReader {
7575
// An anonymous type for index type.
7676
LVType *NodeIndexType = nullptr;
7777

78+
SSAValueNameMap ValueNameMap;
79+
DenseMap<void*, uint64_t> InstrLineAddrMap;
7880
std::unique_ptr<DbgValueRangeTable> DbgValueRanges;
7981

8082
// Record the last assigned file index for each compile unit.

llvm/lib/DebugInfo/LogicalView/Readers/LVIRReader.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ std::string LVIRReader::getRegisterName(LVSmall Opcode,
319319
// dbgs() << "Printing Value: " << Operands[0] << " - "
320320
// << DbgValueRanges->getVariableName(Operands[0]) << "\n";
321321
// });
322-
return DbgValueRanges->getVariableName(Operands[0]);
322+
return ValueNameMap.getName(Operands[0]);
323323
}
324324

325325
llvm_unreachable("We shouldn't actually have any other reg types here!");
@@ -1074,8 +1074,6 @@ void LVIRReader::constructLine(LVScope *Scope, const DISubprogram *SP,
10741074
Line->setAddress(CurrentOffset);
10751075
Line->setName(Text);
10761076
Parent->addElement(Line);
1077-
1078-
DbgValueRanges->addLine(I.getIterator(), CurrentOffset);
10791077
}
10801078
};
10811079

@@ -1901,10 +1899,12 @@ void LVIRReader::processBasicBlocks(Function &F, const DISubprogram *SP) {
19011899
if (options().getPrintAnyLine())
19021900
constructLine(Scope, SP, I, GenerateLineBeforePrologue);
19031901

1902+
InstrLineAddrMap[I.getIterator().getNodePtr()] = CurrentOffset;
1903+
19041904
// Update code offset.
19051905
updateLineOffset();
19061906
}
1907-
DbgValueRanges->addLine(BB.end(), CurrentOffset);
1907+
InstrLineAddrMap[BB.end().getNodePtr()] = CurrentOffset;
19081908
}
19091909
GenerateLineBeforePrologue = false;
19101910

@@ -1934,7 +1934,7 @@ void LVIRReader::processBasicBlocks(Function &F, const DISubprogram *SP) {
19341934
});
19351935

19361936
auto AddLocationOp = [&](Value *V, bool IsMem) {
1937-
uint64_t RegValue = DbgValueRanges->addVariableName(V, Size);
1937+
uint64_t RegValue = ValueNameMap.addValue(V);
19381938
if (IsMem)
19391939
Symbol->addLocationOperands(dwarf::DW_OP_bregx, {RegValue, 0});
19401940
else
@@ -1970,8 +1970,10 @@ void LVIRReader::processBasicBlocks(Function &F, const DISubprogram *SP) {
19701970
AddLocation(DV);
19711971
} else {
19721972
for (DbgRangeEntry Entry : DbgValueRanges->getVariableRanges(DVA)) {
1973-
LVOffset Start = DbgValueRanges->getLine(Entry.Start);
1974-
LVOffset End = DbgValueRanges->getLine(Entry.End);
1973+
// These line addresses should have already been inserted into the
1974+
// InstrLineAddrMap, so we assume they are present here.
1975+
LVOffset Start = InstrLineAddrMap.at(Entry.Start.getNodePtr());
1976+
LVOffset End = InstrLineAddrMap.at(Entry.End.getNodePtr());
19751977
Symbol->addLocation(llvm::dwarf::DW_AT_location, Start, End,
19761978
/*SectionOffset=*/0, /*OffsetOnEntry=*/0);
19771979
DbgValueDef DV = Entry.Value;

0 commit comments

Comments
 (0)