[llvm] 90acc50 - [MCDwarf] Change emitListsTableHeaderStart to use a reference and fold Start/End symbols generation into it
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 3 16:22:10 PST 2020
Author: Fangrui Song
Date: 2020-03-03T16:20:40-08:00
New Revision: 90acc505edf46410a44f45ff01eb301de21936fb
URL: https://github.com/llvm/llvm-project/commit/90acc505edf46410a44f45ff01eb301de21936fb
DIFF: https://github.com/llvm/llvm-project/commit/90acc505edf46410a44f45ff01eb301de21936fb.diff
LOG: [MCDwarf] Change emitListsTableHeaderStart to use a reference and fold Start/End symbols generation into it
Apply @dblaikie's suggestions in a post-commit review for D75375
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D75568
Added:
Modified:
llvm/include/llvm/MC/MCDwarf.h
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/MC/MCDwarf.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCDwarf.h b/llvm/include/llvm/MC/MCDwarf.h
index 2938245d5669..2950a7b0b13a 100644
--- a/llvm/include/llvm/MC/MCDwarf.h
+++ b/llvm/include/llvm/MC/MCDwarf.h
@@ -43,8 +43,7 @@ class SourceMgr;
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
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index dfa09d7a8c0d..1b1ce14f0ea1 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2405,10 +2405,7 @@ void DwarfDebug::emitDebugLocEntryLocation(const DebugLocStream::Entry &Entry,
// 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 @@ static MCSymbol *emitRnglistsTableHeader(AsmPrinter *Asm,
// 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();
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index a0d47569e01c..3c51020056bc 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/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 @@ static MCSymbol *emitGenDwarfRanges(MCStreamer *MCOS) {
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);
More information about the llvm-commits
mailing list