summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
diff options
context:
space:
mode:
authorSourabh Singh Tomar <SourabhSingh.Tomar@amd.com>2019-12-04 18:32:39 +0530
committerSourabh Singh Tomar <SourabhSingh.Tomar@amd.com>2019-12-11 02:19:27 +0530
commit307f60a1a3ff04313a75e2fc11bc14df4fc2ffb8 (patch)
treea8986995a80db1d6f19f494bc0ba58a451fa4287 /llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
parent3e315ba2547cbbfd6055e38bbca03f4d11bacbea (diff)
downloadbcm5719-llvm-307f60a1a3ff04313a75e2fc11bc14df4fc2ffb8.tar.gz
bcm5719-llvm-307f60a1a3ff04313a75e2fc11bc14df4fc2ffb8.zip
[DebugInfo] Refactored macro related generation, added a test case for macinfo.dwo emission.
Reviewers: dblaikie, aprantl, jini.susan.george Tags: #debug-info #llvm Differential Revision: https://reviews.llvm.org/D71008
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp27
1 files changed, 8 insertions, 19 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index f6039cc5bc0..708cef896b5 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2773,8 +2773,7 @@ void DwarfDebug::emitMacroFile(DIMacroFile &F, DwarfCompileUnit &U) {
Asm->EmitULEB128(dwarf::DW_MACINFO_end_file);
}
-/// Emit macros into a debug macinfo section.
-void DwarfDebug::emitDebugMacinfo() {
+void DwarfDebug::emitDebugMacinfoImpl(MCSection *Section) {
for (const auto &P : CUMap) {
auto &TheCU = *P.second;
auto *SkCU = TheCU.getSkeleton();
@@ -2783,8 +2782,7 @@ void DwarfDebug::emitDebugMacinfo() {
DIMacroNodeArray Macros = CUNode->getMacros();
if (Macros.empty())
continue;
- Asm->OutStreamer->SwitchSection(
- Asm->getObjFileLowering().getDwarfMacinfoSection());
+ Asm->OutStreamer->SwitchSection(Section);
Asm->OutStreamer->EmitLabel(U.getMacroLabelBegin());
handleMacroNodes(Macros, U);
Asm->OutStreamer->AddComment("End Of Macro List Mark");
@@ -2792,22 +2790,13 @@ void DwarfDebug::emitDebugMacinfo() {
}
}
+/// Emit macros into a debug macinfo section.
+void DwarfDebug::emitDebugMacinfo() {
+ emitDebugMacinfoImpl(Asm->getObjFileLowering().getDwarfMacinfoSection());
+}
+
void DwarfDebug::emitDebugMacinfoDWO() {
- for (const auto &P : CUMap) {
- auto &TheCU = *P.second;
- auto *SkCU = TheCU.getSkeleton();
- DwarfCompileUnit &U = SkCU ? *SkCU : TheCU;
- auto *CUNode = cast<DICompileUnit>(P.first);
- DIMacroNodeArray Macros = CUNode->getMacros();
- if (Macros.empty())
- continue;
- Asm->OutStreamer->SwitchSection(
- Asm->getObjFileLowering().getDwarfMacinfoDWOSection());
- Asm->OutStreamer->EmitLabel(U.getMacroLabelBegin());
- handleMacroNodes(Macros, U);
- Asm->OutStreamer->AddComment("End Of Macro List Mark");
- Asm->emitInt8(0);
- }
+ emitDebugMacinfoImpl(Asm->getObjFileLowering().getDwarfMacinfoDWOSection());
}
// DWARF5 Experimental Separate Dwarf emitters.
OpenPOWER on IntegriCloud