summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-04-02 01:50:20 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-04-02 01:50:20 +0000
commit5b8e4798ce4d38a07959c663a26683816db3e042 (patch)
tree1f9418d135597ab573927c2aacb20492d3dbeaa5 /lib/CodeGen
parentb2d73d1556b47a79d01b188be3cf0b25631d3982 (diff)
downloadllvm-5b8e4798ce4d38a07959c663a26683816db3e042.tar.gz
llvm-5b8e4798ce4d38a07959c663a26683816db3e042.tar.bz2
llvm-5b8e4798ce4d38a07959c663a26683816db3e042.tar.xz
Split debug_loc and debug_loc.dwo emission into two separate functions
Based on code review feedback from Eric Christopher on r204697 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205385 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp50
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.h3
2 files changed, 32 insertions, 21 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 1b99ba61d3..9deb2f50f5 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1076,9 +1076,6 @@ void DwarfDebug::endModule() {
// Corresponding abbreviations into a abbrev section.
emitAbbreviations();
- // Emit info into a debug loc section.
- emitDebugLoc();
-
// Emit info into a debug aranges section.
if (GenerateARangeSection)
emitDebugARanges();
@@ -1093,7 +1090,10 @@ void DwarfDebug::endModule() {
emitDebugLineDWO();
// Emit DWO addresses.
InfoHolder.emitAddresses(Asm->getObjFileLowering().getDwarfAddrSection());
- }
+ emitDebugLocDWO();
+ } else
+ // Emit info into a debug loc section.
+ emitDebugLoc();
// Emit info into the dwarf accelerator table sections.
if (useDwarfAccelTables()) {
@@ -2406,8 +2406,7 @@ void DwarfDebug::emitDebugLocEntryLocation(const DebugLocEntry &Entry) {
void DwarfDebug::emitDebugLoc() {
// Start the dwarf loc section.
Asm->OutStreamer.SwitchSection(
- useSplitDwarf() ? Asm->getObjFileLowering().getDwarfLocDWOSection()
- : Asm->getObjFileLowering().getDwarfLocSection());
+ Asm->getObjFileLowering().getDwarfLocSection());
unsigned char Size = Asm->getDataLayout().getPointerSize();
for (const auto &DebugLoc : DotDebugLocEntries) {
Asm->OutStreamer.EmitLabel(DebugLoc.Label);
@@ -2416,16 +2415,7 @@ void DwarfDebug::emitDebugLoc() {
// compile unit. This is a hard coded 0 for low_pc when we're emitting
// ranges, or the DW_AT_low_pc on the compile unit otherwise.
const DwarfCompileUnit *CU = Entry.getCU();
- if (useSplitDwarf()) {
- // Just always use start_length for now - at least that's one address
- // rather than two. We could get fancier and try to, say, reuse an
- // address we know we've emitted elsewhere (the start of the function?
- // The start of the CU or CU subrange that encloses this range?)
- Asm->EmitInt8(dwarf::DW_LLE_start_length_entry);
- unsigned idx = InfoHolder.getAddrPoolIndex(Entry.getBeginSym());
- Asm->EmitULEB128(idx);
- Asm->EmitLabelDifference(Entry.getEndSym(), Entry.getBeginSym(), 4);
- } else if (CU->getRanges().size() == 1) {
+ if (CU->getRanges().size() == 1) {
// Grab the begin symbol from the first range as our base.
const MCSymbol *Base = CU->getRanges()[0].getStart();
Asm->EmitLabelDifference(Entry.getBeginSym(), Base, Size);
@@ -2434,14 +2424,32 @@ void DwarfDebug::emitDebugLoc() {
Asm->OutStreamer.EmitSymbolValue(Entry.getBeginSym(), Size);
Asm->OutStreamer.EmitSymbolValue(Entry.getEndSym(), Size);
}
+
emitDebugLocEntryLocation(Entry);
}
- if (useSplitDwarf())
- Asm->EmitInt8(dwarf::DW_LLE_end_of_list_entry);
- else {
- Asm->OutStreamer.EmitIntValue(0, Size);
- Asm->OutStreamer.EmitIntValue(0, Size);
+ Asm->OutStreamer.EmitIntValue(0, Size);
+ Asm->OutStreamer.EmitIntValue(0, Size);
+ }
+}
+
+void DwarfDebug::emitDebugLocDWO() {
+ Asm->OutStreamer.SwitchSection(
+ Asm->getObjFileLowering().getDwarfLocDWOSection());
+ for (const auto &DebugLoc : DotDebugLocEntries) {
+ Asm->OutStreamer.EmitLabel(DebugLoc.Label);
+ for (const auto &Entry : DebugLoc.List) {
+ // Just always use start_length for now - at least that's one address
+ // rather than two. We could get fancier and try to, say, reuse an
+ // address we know we've emitted elsewhere (the start of the function?
+ // The start of the CU or CU subrange that encloses this range?)
+ Asm->EmitInt8(dwarf::DW_LLE_start_length_entry);
+ unsigned idx = InfoHolder.getAddrPoolIndex(Entry.getBeginSym());
+ Asm->EmitULEB128(idx);
+ Asm->EmitLabelDifference(Entry.getEndSym(), Entry.getBeginSym(), 4);
+
+ emitDebugLocEntryLocation(Entry);
}
+ Asm->EmitInt8(dwarf::DW_LLE_end_of_list_entry);
}
}
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h
index 424595070d..da708f510c 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -520,6 +520,9 @@ class DwarfDebug : public AsmPrinterHandler {
/// \brief Emit visible names into a debug loc section.
void emitDebugLoc();
+ /// \brief Emit visible names into a debug loc dwo section.
+ void emitDebugLocDWO();
+
/// \brief Emit visible names into a debug aranges section.
void emitDebugARanges();