summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2019-12-12 16:37:52 -0800
committerDavid Blaikie <dblaikie@gmail.com>2019-12-12 16:39:12 -0800
commit20e06a28dac65a68bfd906d703e980a8212f6187 (patch)
treec108125986d0154e07315dc5c1acbf76b2056e23 /llvm/lib/CodeGen/AsmPrinter
parentb7eb30d48131c0b42cf5fa5bf866e846959876c2 (diff)
downloadbcm5719-llvm-20e06a28dac65a68bfd906d703e980a8212f6187.tar.gz
bcm5719-llvm-20e06a28dac65a68bfd906d703e980a8212f6187.zip
NFC: DebugInfo: Refactor debug_loc/loclist emission into a common function
(except for v4 loclists, which are sufficiently different to not fit well in this generic implementation) In subsequent patches I intend to refactor the DebugLoc and ranges data structures to be more similar so I can common more of the implementation here.
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp34
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h2
2 files changed, 15 insertions, 21 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 098b5a91d6e..aa33659cd06 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2466,22 +2466,15 @@ static void emitLocList(DwarfDebug &DD, AsmPrinter *Asm, const DebugLocStream::L
});
}
-// Emit locations into the .debug_loc/.debug_loclists section.
-void DwarfDebug::emitDebugLoc() {
+void DwarfDebug::emitDebugLocImpl(MCSection *Sec) {
if (DebugLocs.getLists().empty())
return;
- MCSymbol *TableEnd = nullptr;
- if (getDwarfVersion() >= 5) {
-
- Asm->OutStreamer->SwitchSection(
- Asm->getObjFileLowering().getDwarfLoclistsSection());
+ Asm->OutStreamer->SwitchSection(Sec);
+ MCSymbol *TableEnd = nullptr;
+ if (getDwarfVersion() >= 5)
TableEnd = emitLoclistsTableHeader(Asm, *this);
- } else {
- Asm->OutStreamer->SwitchSection(
- Asm->getObjFileLowering().getDwarfLocSection());
- }
for (const auto &List : DebugLocs.getLists())
emitLocList(*this, Asm, List);
@@ -2490,21 +2483,20 @@ void DwarfDebug::emitDebugLoc() {
Asm->OutStreamer->EmitLabel(TableEnd);
}
+// Emit locations into the .debug_loc/.debug_loclists section.
+void DwarfDebug::emitDebugLoc() {
+ emitDebugLocImpl(
+ getDwarfVersion() >= 5
+ ? Asm->getObjFileLowering().getDwarfLoclistsSection()
+ : Asm->getObjFileLowering().getDwarfLocSection());
+}
+
// Emit locations into the .debug_loc.dwo/.debug_loclists.dwo section.
void DwarfDebug::emitDebugLocDWO() {
- if (DebugLocs.getLists().empty())
- return;
-
if (getDwarfVersion() >= 5) {
- MCSymbol *TableEnd = nullptr;
- Asm->OutStreamer->SwitchSection(
+ emitDebugLocImpl(
Asm->getObjFileLowering().getDwarfLoclistsDWOSection());
- TableEnd = emitLoclistsTableHeader(Asm, *this);
- for (const auto &List : DebugLocs.getLists())
- emitLocList(*this, Asm, List);
- if (TableEnd)
- Asm->OutStreamer->EmitLabel(TableEnd);
return;
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
index bdd1b255c02..8fc0ac82ff0 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -503,6 +503,8 @@ class DwarfDebug : public DebugHandlerBase {
/// Emit variable locations into a debug loc dwo section.
void emitDebugLocDWO();
+ void emitDebugLocImpl(MCSection *Sec);
+
/// Emit address ranges into a debug aranges section.
void emitDebugARanges();
OpenPOWER on IntegriCloud