summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-12-04 17:55:41 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-12-04 17:55:41 +0000
commit3ddd790df11cb1df6d2c81882b24f8c187c09033 (patch)
tree9f6f9809173d7d972b7f3e251415794569b1a60d /lib/CodeGen
parenta2f6f94b74b7660cdf594ee9c538e4bae2978c71 (diff)
downloadllvm-3ddd790df11cb1df6d2c81882b24f8c187c09033.tar.gz
llvm-3ddd790df11cb1df6d2c81882b24f8c187c09033.tar.bz2
llvm-3ddd790df11cb1df6d2c81882b24f8c187c09033.tar.xz
DebugInfo: Avoid recreating matching labels in disparate places.
Instead, reuse the same MCSymbol - this should make the code easier to follow by avoiding hard to trace dependencies between different bits of code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196392 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp36
1 files changed, 16 insertions, 20 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 010dcdf055..a7056d6a01 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -430,11 +430,8 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU, DISubprogram SP) {
}
}
- MCSymbol *FuncBegin =
- Asm->GetTempSymbol("func_begin", Asm->getFunctionNumber());
- MCSymbol *FuncEnd = Asm->GetTempSymbol("func_end", Asm->getFunctionNumber());
- SPCU->addLabelAddress(SPDie, dwarf::DW_AT_low_pc, FuncBegin);
- SPCU->addLabelAddress(SPDie, dwarf::DW_AT_high_pc, FuncEnd);
+ SPCU->addLabelAddress(SPDie, dwarf::DW_AT_low_pc, FunctionBeginSym);
+ SPCU->addLabelAddress(SPDie, dwarf::DW_AT_high_pc, FunctionEndSym);
const TargetRegisterInfo *RI = Asm->TM.getRegisterInfo();
MachineLocation Location(RI->getFrameRegister(*Asm->MF));
@@ -2452,15 +2449,15 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
// Emit a label so we can reference the beginning of this pubname section.
if (GnuStyle)
- Asm->OutStreamer.EmitLabel(
- Asm->GetTempSymbol("gnu_pubnames", TheU->getUniqueID()));
+ Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("gnu_pubnames", ID));
// Emit the header.
Asm->OutStreamer.AddComment("Length of Public Names Info");
- Asm->EmitLabelDifference(Asm->GetTempSymbol("pubnames_end", ID),
- Asm->GetTempSymbol("pubnames_begin", ID), 4);
+ MCSymbol *BeginLabel = Asm->GetTempSymbol("pubnames_begin", ID);
+ MCSymbol *EndLabel = Asm->GetTempSymbol("pubnames_end", ID);
+ Asm->EmitLabelDifference(EndLabel, BeginLabel, 4);
- Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("pubnames_begin", ID));
+ Asm->OutStreamer.EmitLabel(BeginLabel);
Asm->OutStreamer.AddComment("DWARF Version");
Asm->EmitInt16(dwarf::DW_PUBNAMES_VERSION);
@@ -2500,7 +2497,7 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
Asm->OutStreamer.AddComment("End Mark");
Asm->EmitInt32(0);
- Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("pubnames_end", ID));
+ Asm->OutStreamer.EmitLabel(EndLabel);
}
}
@@ -2514,22 +2511,22 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
E = getUnits().end();
I != E; ++I) {
Unit *TheU = *I;
+ unsigned ID = TheU->getUniqueID();
+
// Start the dwarf pubtypes section.
Asm->OutStreamer.SwitchSection(PSec);
// Emit a label so we can reference the beginning of this pubtype section.
if (GnuStyle)
- Asm->OutStreamer.EmitLabel(
- Asm->GetTempSymbol("gnu_pubtypes", TheU->getUniqueID()));
+ Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("gnu_pubtypes", ID));
// Emit the header.
Asm->OutStreamer.AddComment("Length of Public Types Info");
- Asm->EmitLabelDifference(
- Asm->GetTempSymbol("pubtypes_end", TheU->getUniqueID()),
- Asm->GetTempSymbol("pubtypes_begin", TheU->getUniqueID()), 4);
+ MCSymbol *BeginLabel = Asm->GetTempSymbol("pubtypes_begin", ID);
+ MCSymbol *EndLabel = Asm->GetTempSymbol("pubtypes_end", ID);
+ Asm->EmitLabelDifference(EndLabel, BeginLabel, 4);
- Asm->OutStreamer.EmitLabel(
- Asm->GetTempSymbol("pubtypes_begin", TheU->getUniqueID()));
+ Asm->OutStreamer.EmitLabel(BeginLabel);
if (Asm->isVerbose())
Asm->OutStreamer.AddComment("DWARF Version");
@@ -2574,8 +2571,7 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
Asm->OutStreamer.AddComment("End Mark");
Asm->EmitInt32(0);
- Asm->OutStreamer.EmitLabel(
- Asm->GetTempSymbol("pubtypes_end", TheU->getUniqueID()));
+ Asm->OutStreamer.EmitLabel(EndLabel);
}
}