[PATCH] D75568: [MCDwarf] Change emitListsTableHeaderStart to use a reference and fold Start/End symbols generation into it
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 3 16:42:47 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG90acc505edf4: [MCDwarf] Change emitListsTableHeaderStart to use a reference and fold… (authored by MaskRay).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75568/new/
https://reviews.llvm.org/D75568
Files:
llvm/include/llvm/MC/MCDwarf.h
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/MC/MCDwarf.cpp
Index: llvm/lib/MC/MCDwarf.cpp
===================================================================
--- llvm/lib/MC/MCDwarf.cpp
+++ llvm/lib/MC/MCDwarf.cpp
@@ -45,17 +45,21 @@
using namespace llvm;
-void mcdwarf::emitListsTableHeaderStart(MCStreamer *S, MCSymbol *TableStart,
- MCSymbol *TableEnd) {
- S->AddComment("Length");
- S->emitAbsoluteSymbolDiff(TableEnd, TableStart, 4);
- S->emitLabel(TableStart);
- S->AddComment("Version");
- S->emitInt16(S->getContext().getDwarfVersion());
- S->AddComment("Address size");
- S->emitInt8(S->getContext().getAsmInfo()->getCodePointerSize());
- S->AddComment("Segment selector size");
- S->emitInt8(0);
+MCSymbol *mcdwarf::emitListsTableHeaderStart(MCStreamer &S) {
+ MCSymbol *Start =
+ S.getContext().createTempSymbol("debug_list_header_start", true, true);
+ MCSymbol *End =
+ S.getContext().createTempSymbol("debug_list_header_end", true, true);
+ S.AddComment("Length");
+ S.emitAbsoluteSymbolDiff(End, Start, 4);
+ S.emitLabel(Start);
+ S.AddComment("Version");
+ S.emitInt16(S.getContext().getDwarfVersion());
+ S.AddComment("Address size");
+ S.emitInt8(S.getContext().getAsmInfo()->getCodePointerSize());
+ S.AddComment("Segment selector size");
+ S.emitInt8(0);
+ return End;
}
/// Manage the .debug_line_str section contents, if we use it.
@@ -1117,11 +1121,7 @@
if (MCOS->getContext().getDwarfVersion() >= 5) {
MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfRnglistsSection());
- MCSymbol *StartSymbol =
- context.createTempSymbol("debug_rnglists_start", true, true);
- MCSymbol *EndSymbol =
- context.createTempSymbol("debug_rnglists_end", true, true);
- mcdwarf::emitListsTableHeaderStart(MCOS, StartSymbol, EndSymbol);
+ MCSymbol *EndSymbol = mcdwarf::emitListsTableHeaderStart(*MCOS);
MCOS->AddComment("Offset entry count");
MCOS->emitInt32(0);
RangesSymbol = context.createTempSymbol("debug_rnglist0_start", true, true);
Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2405,10 +2405,7 @@
// complete.
static MCSymbol *emitRnglistsTableHeader(AsmPrinter *Asm,
const DwarfFile &Holder) {
- MCSymbol *TableStart = Asm->createTempSymbol("debug_rnglist_table_start");
- MCSymbol *TableEnd = Asm->createTempSymbol("debug_rnglist_table_end");
- mcdwarf::emitListsTableHeaderStart(Asm->OutStreamer.get(), TableStart,
- TableEnd);
+ MCSymbol *TableEnd = mcdwarf::emitListsTableHeaderStart(*Asm->OutStreamer);
Asm->OutStreamer->AddComment("Offset entry count");
Asm->emitInt32(Holder.getRangeLists().size());
@@ -2425,10 +2422,7 @@
// complete.
static MCSymbol *emitLoclistsTableHeader(AsmPrinter *Asm,
const DwarfDebug &DD) {
- MCSymbol *TableStart = Asm->createTempSymbol("debug_loclist_table_start");
- MCSymbol *TableEnd = Asm->createTempSymbol("debug_loclist_table_end");
- mcdwarf::emitListsTableHeaderStart(Asm->OutStreamer.get(), TableStart,
- TableEnd);
+ MCSymbol *TableEnd = mcdwarf::emitListsTableHeaderStart(*Asm->OutStreamer);
const auto &DebugLocs = DD.getDebugLocs();
Index: llvm/include/llvm/MC/MCDwarf.h
===================================================================
--- llvm/include/llvm/MC/MCDwarf.h
+++ llvm/include/llvm/MC/MCDwarf.h
@@ -43,8 +43,7 @@
namespace mcdwarf {
// Emit the common part of the DWARF 5 range/locations list tables header.
-void emitListsTableHeaderStart(MCStreamer *S, MCSymbol *TableStart,
- MCSymbol *TableEnd);
+MCSymbol *emitListsTableHeaderStart(MCStreamer &S);
} // namespace mcdwarf
/// Instances of this class represent the name of the dwarf .file directive and
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75568.248071.patch
Type: text/x-patch
Size: 4001 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200304/18c124b9/attachment.bin>
More information about the llvm-commits
mailing list