@@ -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