[llvm] r373663 - DebugInfo: Generalize rnglist emission as a precursor to reusing it for loclist emission
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 4 14:49:44 PDT 2019
On Fri, Oct 4, 2019 at 7:50 AM <paul.robinson at sony.com> wrote:
>
>
> > -----Original Message-----
> > From: llvm-commits <llvm-commits-bounces at lists.llvm.org> On Behalf Of
> > David Blaikie via llvm-commits
> > Sent: Thursday, October 03, 2019 4:56 PM
> > To: llvm-commits at lists.llvm.org
> > Subject: [llvm] r373663 - DebugInfo: Generalize rnglist emission as a
> > precursor to reusing it for loclist emission
> >
> > Author: dblaikie
> > Date: Thu Oct 3 13:56:23 2019
> > New Revision: 373663
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=373663&view=rev
> > Log:
> > DebugInfo: Generalize rnglist emission as a precursor to reusing it for
> > loclist emission
> >
> > Modified:
> > llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> >
> > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> > URL: http://llvm.org/viewvc/llvm-
> >
> project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=373663&r1=373
> > 662&r2=373663&view=diff
> >
> ==========================================================================
> > ====
> > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Oct 3 13:56:23
> > 2019
> > @@ -2556,23 +2556,24 @@ void DwarfDebug::emitDebugARanges() {
> > }
> > }
> >
> > -/// Emit a single range list. We handle both DWARF v5 and earlier.
> > -static void emitRangeList(DwarfDebug &DD, AsmPrinter *Asm,
> > - const RangeSpanList &List) {
> > -
> > +template <typename Ranges>
> > +static void emitRangeList(DwarfDebug &DD, AsmPrinter *Asm, MCSymbol
> *Sym,
> > + const Ranges &R, const DwarfCompileUnit &CU,
> > + unsigned BaseAddressx, unsigned OffsetPair,
> > + unsigned StartxLength, unsigned EndOfList,
> > + StringRef (*StringifyEnum)(unsigned)) {
> > auto DwarfVersion = DD.getDwarfVersion();
> > // Emit our symbol so we can find the beginning of the range.
> > - Asm->OutStreamer->EmitLabel(List.getSym());
> > + Asm->OutStreamer->EmitLabel(Sym);
> > // Gather all the ranges that apply to the same section so they can
> > share
> > // a base address entry.
> > MapVector<const MCSection *, std::vector<const RangeSpan *>>
> > SectionRanges;
> > // Size for our labels.
> > auto Size = Asm->MAI->getCodePointerSize();
> >
> > - for (const RangeSpan &Range : List.getRanges())
> > + for (const RangeSpan &Range : R)
> > SectionRanges[&Range.Begin->getSection()].push_back(&Range);
> >
> > - const DwarfCompileUnit &CU = List.getCU();
> > const MCSymbol *CUBase = CU.getBaseAddress();
> > bool BaseIsSet = false;
> > for (const auto &P : SectionRanges) {
> > @@ -2588,8 +2589,8 @@ static void emitRangeList(DwarfDebug &DD
> > BaseIsSet = true;
> > Base = DD.getSectionLabel(&P.second.front()->Begin->getSection());
> > if (DwarfVersion >= 5) {
> > - Asm->OutStreamer->AddComment("DW_RLE_base_addressx");
> > - Asm->OutStreamer->EmitIntValue(dwarf::DW_RLE_base_addressx, 1);
> > + Asm->OutStreamer->AddComment(StringifyEnum(BaseAddressx));
> > + Asm->OutStreamer->EmitIntValue(BaseAddressx, 1);
> > Asm->OutStreamer->AddComment(" base address index");
> > Asm->EmitULEB128(DD.getAddressPool().getIndex(Base));
> > } else {
> > @@ -2612,8 +2613,8 @@ static void emitRangeList(DwarfDebug &DD
> > if (Base) {
> > if (DwarfVersion >= 5) {
> > // Emit DW_RLE_offset_pair when we have a base.
>
> This comment should also go, or be rephrased.
>
Ah, yeah - dropping that & a few other things that don't make sense once
this is generalized over RLE and LLE in the following patches.
> --paulr
>
> > - Asm->OutStreamer->AddComment("DW_RLE_offset_pair");
> > - Asm->OutStreamer->EmitIntValue(dwarf::DW_RLE_offset_pair, 1);
> > + Asm->OutStreamer->AddComment(StringifyEnum(OffsetPair));
> > + Asm->emitInt8(OffsetPair);
> > Asm->OutStreamer->AddComment(" starting offset");
> > Asm->EmitLabelDifferenceAsULEB128(Begin, Base);
> > Asm->OutStreamer->AddComment(" ending offset");
> > @@ -2623,8 +2624,8 @@ static void emitRangeList(DwarfDebug &DD
> > Asm->EmitLabelDifference(End, Base, Size);
> > }
> > } else if (DwarfVersion >= 5) {
> > - Asm->OutStreamer->AddComment("DW_RLE_startx_length");
> > - Asm->OutStreamer->EmitIntValue(dwarf::DW_RLE_startx_length, 1);
> > + Asm->OutStreamer->AddComment(StringifyEnum(StartxLength));
> > + Asm->emitInt8(StartxLength);
> > Asm->OutStreamer->AddComment(" start index");
> > Asm->EmitULEB128(DD.getAddressPool().getIndex(Begin));
> > Asm->OutStreamer->AddComment(" length");
> > @@ -2636,8 +2637,8 @@ static void emitRangeList(DwarfDebug &DD
> > }
> > }
> > if (DwarfVersion >= 5) {
> > - Asm->OutStreamer->AddComment("DW_RLE_end_of_list");
> > - Asm->OutStreamer->EmitIntValue(dwarf::DW_RLE_end_of_list, 1);
> > + Asm->OutStreamer->AddComment(StringifyEnum(EndOfList));
> > + Asm->emitInt8(EndOfList);
> > } else {
> > // Terminate the list with two 0 values.
> > Asm->OutStreamer->EmitIntValue(0, Size);
> > @@ -2645,6 +2646,15 @@ static void emitRangeList(DwarfDebug &DD
> > }
> > }
> >
> > +/// Emit a single range list. We handle both DWARF v5 and earlier.
> > +static void emitRangeList(DwarfDebug &DD, AsmPrinter *Asm,
> > + const RangeSpanList &List) {
> > + emitRangeList(DD, Asm, List.getSym(), List.getRanges(), List.getCU(),
> > + dwarf::DW_RLE_base_addressx, dwarf::DW_RLE_offset_pair,
> > + dwarf::DW_RLE_startx_length, dwarf::DW_RLE_end_of_list,
> > + llvm::dwarf::RangeListEncodingString);
> > +}
> > +
> > static void emitDebugRangesImpl(DwarfDebug &DD, AsmPrinter *Asm,
> > const DwarfFile &Holder, MCSymbol
> > *TableEnd) {
> > for (const RangeSpanList &List : Holder.getRangeLists())
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191004/1207b42c/attachment.html>
More information about the llvm-commits
mailing list