summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-03-05 22:41:20 +0000
committerEric Christopher <echristo@gmail.com>2014-03-05 22:41:20 +0000
commita27220fb8c15e0e09cb2175b155e9a27852f2392 (patch)
tree2db8cc643d96aa20176fd1d1a38e68b1d135d5bf /llvm/lib/CodeGen/AsmPrinter/DIE.cpp
parent3e373261667f848035ffecce72a4d03a65f21604 (diff)
downloadbcm5719-llvm-a27220fb8c15e0e09cb2175b155e9a27852f2392.tar.gz
bcm5719-llvm-a27220fb8c15e0e09cb2175b155e9a27852f2392.zip
Add a DIELocList class to handle pointers into the location list.
This enables us to figure out where in the debug_loc section our locations are so that we can eventually hash them. It also helps remove some special case code in emission. No functional change. llvm-svn: 203018
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DIE.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DIE.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
index e8be7ad626d..0c6e01504ef 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
@@ -524,3 +524,34 @@ void DIEBlock::print(raw_ostream &O) const {
DIE::print(O, 5);
}
#endif
+
+//===----------------------------------------------------------------------===//
+// DIELocList Implementation
+//===----------------------------------------------------------------------===//
+
+unsigned DIELocList::SizeOf(AsmPrinter *AP, dwarf::Form Form) const {
+ if (Form == dwarf::DW_FORM_data4)
+ return 4;
+ if (Form == dwarf::DW_FORM_sec_offset)
+ return 4;
+ return AP->getDataLayout().getPointerSize();
+}
+
+/// EmitValue - Emit label value.
+///
+void DIELocList::EmitValue(AsmPrinter *AP, dwarf::Form Form) const {
+ MCSymbol *Label = AP->GetTempSymbol("debug_loc", Index);
+ MCSymbol *DwarfDebugLocSectionSym = AP->getDwarfDebug()->getDebugLocSym();
+
+ if (AP->MAI->doesDwarfUseRelocationsAcrossSections())
+ AP->EmitSectionOffset(Label, DwarfDebugLocSectionSym);
+ else
+ AP->EmitLabelDifference(Label, DwarfDebugLocSectionSym, 4);
+}
+
+#ifndef NDEBUG
+void DIELocList::print(raw_ostream &O) const {
+ O << "LocList: " << Index;
+
+}
+#endif
OpenPOWER on IntegriCloud