f5157acac5820dcb1a4c627d562aa54cc3006f52
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DIE.cpp
1 //===--- lib/CodeGen/DIE.cpp - DWARF Info Entries -------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Data structures for DWARF info entries.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "llvm/CodeGen/DIE.h"
15 #include "DwarfCompileUnit.h"
16 #include "DwarfDebug.h"
17 #include "DwarfUnit.h"
18 #include "llvm/ADT/Twine.h"
19 #include "llvm/CodeGen/AsmPrinter.h"
20 #include "llvm/IR/DataLayout.h"
21 #include "llvm/MC/MCAsmInfo.h"
22 #include "llvm/MC/MCContext.h"
23 #include "llvm/MC/MCStreamer.h"
24 #include "llvm/MC/MCSymbol.h"
25 #include "llvm/Support/Debug.h"
26 #include "llvm/Support/ErrorHandling.h"
27 #include "llvm/Support/Format.h"
28 #include "llvm/Support/FormattedStream.h"
29 #include "llvm/Support/LEB128.h"
30 #include "llvm/Support/MD5.h"
31 using namespace llvm;
32
33 //===----------------------------------------------------------------------===//
34 // DIEAbbrevData Implementation
35 //===----------------------------------------------------------------------===//
36
37 /// Profile - Used to gather unique data for the abbreviation folding set.
38 ///
39 void DIEAbbrevData::Profile(FoldingSetNodeID &ID) const {
40   // Explicitly cast to an integer type for which FoldingSetNodeID has
41   // overloads.  Otherwise MSVC 2010 thinks this call is ambiguous.
42   ID.AddInteger(unsigned(Attribute));
43   ID.AddInteger(unsigned(Form));
44 }
45
46 //===----------------------------------------------------------------------===//
47 // DIEAbbrev Implementation
48 //===----------------------------------------------------------------------===//
49
50 /// Profile - Used to gather unique data for the abbreviation folding set.
51 ///
52 void DIEAbbrev::Profile(FoldingSetNodeID &ID) const {
53   ID.AddInteger(unsigned(Tag));
54   ID.AddInteger(unsigned(Children));
55
56   // For each attribute description.
57   for (unsigned i = 0, N = Data.size(); i < N; ++i)
58     Data[i].Profile(ID);
59 }
60
61 /// Emit - Print the abbreviation using the specified asm printer.
62 ///
63 void DIEAbbrev::Emit(const AsmPrinter *AP) const {
64   // Emit its Dwarf tag type.
65   AP->EmitULEB128(Tag, dwarf::TagString(Tag));
66
67   // Emit whether it has children DIEs.
68   AP->EmitULEB128((unsigned)Children, dwarf::ChildrenString(Children));
69
70   // For each attribute description.
71   for (unsigned i = 0, N = Data.size(); i < N; ++i) {
72     const DIEAbbrevData &AttrData = Data[i];
73
74     // Emit attribute type.
75     AP->EmitULEB128(AttrData.getAttribute(),
76                     dwarf::AttributeString(AttrData.getAttribute()));
77
78     // Emit form type.
79     AP->EmitULEB128(AttrData.getForm(),
80                     dwarf::FormEncodingString(AttrData.getForm()));
81   }
82
83   // Mark end of abbreviation.
84   AP->EmitULEB128(0, "EOM(1)");
85   AP->EmitULEB128(0, "EOM(2)");
86 }
87
88 #ifndef NDEBUG
89 void DIEAbbrev::print(raw_ostream &O) {
90   O << "Abbreviation @"
91     << format("0x%lx", (long)(intptr_t)this)
92     << "  "
93     << dwarf::TagString(Tag)
94     << " "
95     << dwarf::ChildrenString(Children)
96     << '\n';
97
98   for (unsigned i = 0, N = Data.size(); i < N; ++i) {
99     O << "  "
100       << dwarf::AttributeString(Data[i].getAttribute())
101       << "  "
102       << dwarf::FormEncodingString(Data[i].getForm())
103       << '\n';
104   }
105 }
106 void DIEAbbrev::dump() { print(dbgs()); }
107 #endif
108
109 /// Climb up the parent chain to get the unit DIE to which this DIE
110 /// belongs.
111 const DIE *DIE::getUnit() const {
112   const DIE *Cu = getUnitOrNull();
113   assert(Cu && "We should not have orphaned DIEs.");
114   return Cu;
115 }
116
117 /// Climb up the parent chain to get the unit DIE this DIE belongs
118 /// to. Return NULL if DIE is not added to an owner yet.
119 const DIE *DIE::getUnitOrNull() const {
120   const DIE *p = this;
121   while (p) {
122     if (p->getTag() == dwarf::DW_TAG_compile_unit ||
123         p->getTag() == dwarf::DW_TAG_type_unit)
124       return p;
125     p = p->getParent();
126   }
127   return nullptr;
128 }
129
130 DIEValue *DIE::findAttribute(dwarf::Attribute Attribute) const {
131   const SmallVectorImpl<DIEValue *> &Values = getValues();
132   const DIEAbbrev &Abbrevs = getAbbrev();
133
134   // Iterate through all the attributes until we find the one we're
135   // looking for, if we can't find it return NULL.
136   for (size_t i = 0; i < Values.size(); ++i)
137     if (Abbrevs.getData()[i].getAttribute() == Attribute)
138       return Values[i];
139   return nullptr;
140 }
141
142 #ifndef NDEBUG
143 void DIE::print(raw_ostream &O, unsigned IndentCount) const {
144   const std::string Indent(IndentCount, ' ');
145   bool isBlock = Abbrev.getTag() == 0;
146
147   if (!isBlock) {
148     O << Indent
149       << "Die: "
150       << format("0x%lx", (long)(intptr_t)this)
151       << ", Offset: " << Offset
152       << ", Size: " << Size << "\n";
153
154     O << Indent
155       << dwarf::TagString(Abbrev.getTag())
156       << " "
157       << dwarf::ChildrenString(Abbrev.hasChildren()) << "\n";
158   } else {
159     O << "Size: " << Size << "\n";
160   }
161
162   const SmallVectorImpl<DIEAbbrevData> &Data = Abbrev.getData();
163
164   IndentCount += 2;
165   for (unsigned i = 0, N = Data.size(); i < N; ++i) {
166     O << Indent;
167
168     if (!isBlock)
169       O << dwarf::AttributeString(Data[i].getAttribute());
170     else
171       O << "Blk[" << i << "]";
172
173     O <<  "  "
174       << dwarf::FormEncodingString(Data[i].getForm())
175       << " ";
176     Values[i]->print(O);
177     O << "\n";
178   }
179   IndentCount -= 2;
180
181   for (unsigned j = 0, M = Children.size(); j < M; ++j) {
182     Children[j]->print(O, IndentCount+4);
183   }
184
185   if (!isBlock) O << "\n";
186 }
187
188 void DIE::dump() {
189   print(dbgs());
190 }
191 #endif
192
193 void DIEValue::anchor() { }
194
195 #ifndef NDEBUG
196 void DIEValue::dump() const {
197   print(dbgs());
198 }
199 #endif
200
201 //===----------------------------------------------------------------------===//
202 // DIEInteger Implementation
203 //===----------------------------------------------------------------------===//
204
205 /// EmitValue - Emit integer of appropriate size.
206 ///
207 void DIEInteger::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
208   unsigned Size = ~0U;
209   switch (Form) {
210   case dwarf::DW_FORM_flag_present:
211     // Emit something to keep the lines and comments in sync.
212     // FIXME: Is there a better way to do this?
213     Asm->OutStreamer.AddBlankLine();
214     return;
215   case dwarf::DW_FORM_flag:  // Fall thru
216   case dwarf::DW_FORM_ref1:  // Fall thru
217   case dwarf::DW_FORM_data1: Size = 1; break;
218   case dwarf::DW_FORM_ref2:  // Fall thru
219   case dwarf::DW_FORM_data2: Size = 2; break;
220   case dwarf::DW_FORM_sec_offset: // Fall thru
221   case dwarf::DW_FORM_strp: // Fall thru
222   case dwarf::DW_FORM_ref4:  // Fall thru
223   case dwarf::DW_FORM_data4: Size = 4; break;
224   case dwarf::DW_FORM_ref8:  // Fall thru
225   case dwarf::DW_FORM_ref_sig8:  // Fall thru
226   case dwarf::DW_FORM_data8: Size = 8; break;
227   case dwarf::DW_FORM_GNU_str_index: Asm->EmitULEB128(Integer); return;
228   case dwarf::DW_FORM_GNU_addr_index: Asm->EmitULEB128(Integer); return;
229   case dwarf::DW_FORM_udata: Asm->EmitULEB128(Integer); return;
230   case dwarf::DW_FORM_sdata: Asm->EmitSLEB128(Integer); return;
231   case dwarf::DW_FORM_addr:
232     Size = Asm->getDataLayout().getPointerSize(); break;
233   case dwarf::DW_FORM_ref_addr:
234     Size = SizeOf(Asm, dwarf::DW_FORM_ref_addr);
235     break;
236   default: llvm_unreachable("DIE Value form not supported yet");
237   }
238   Asm->OutStreamer.EmitIntValue(Integer, Size);
239 }
240
241 /// SizeOf - Determine size of integer value in bytes.
242 ///
243 unsigned DIEInteger::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
244   switch (Form) {
245   case dwarf::DW_FORM_flag_present: return 0;
246   case dwarf::DW_FORM_flag:  // Fall thru
247   case dwarf::DW_FORM_ref1:  // Fall thru
248   case dwarf::DW_FORM_data1: return sizeof(int8_t);
249   case dwarf::DW_FORM_ref2:  // Fall thru
250   case dwarf::DW_FORM_data2: return sizeof(int16_t);
251   case dwarf::DW_FORM_sec_offset: // Fall thru
252   case dwarf::DW_FORM_strp: // Fall thru
253   case dwarf::DW_FORM_ref4:  // Fall thru
254   case dwarf::DW_FORM_data4: return sizeof(int32_t);
255   case dwarf::DW_FORM_ref8:  // Fall thru
256   case dwarf::DW_FORM_ref_sig8:  // Fall thru
257   case dwarf::DW_FORM_data8: return sizeof(int64_t);
258   case dwarf::DW_FORM_GNU_str_index: return getULEB128Size(Integer);
259   case dwarf::DW_FORM_GNU_addr_index: return getULEB128Size(Integer);
260   case dwarf::DW_FORM_udata: return getULEB128Size(Integer);
261   case dwarf::DW_FORM_sdata: return getSLEB128Size(Integer);
262   case dwarf::DW_FORM_addr:  return AP->getDataLayout().getPointerSize();
263   case dwarf::DW_FORM_ref_addr:
264     if (AP->OutStreamer.getContext().getDwarfVersion() == 2)
265       return AP->getDataLayout().getPointerSize();
266     return sizeof(int32_t);
267     break;
268   default: llvm_unreachable("DIE Value form not supported yet");
269   }
270 }
271
272 #ifndef NDEBUG
273 void DIEInteger::print(raw_ostream &O) const {
274   O << "Int: " << (int64_t)Integer << "  0x";
275   O.write_hex(Integer);
276 }
277 #endif
278
279 //===----------------------------------------------------------------------===//
280 // DIEExpr Implementation
281 //===----------------------------------------------------------------------===//
282
283 /// EmitValue - Emit expression value.
284 ///
285 void DIEExpr::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
286   AP->OutStreamer.EmitValue(Expr, SizeOf(AP, Form));
287 }
288
289 /// SizeOf - Determine size of expression value in bytes.
290 ///
291 unsigned DIEExpr::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
292   if (Form == dwarf::DW_FORM_data4) return 4;
293   if (Form == dwarf::DW_FORM_sec_offset) return 4;
294   if (Form == dwarf::DW_FORM_strp) return 4;
295   return AP->getDataLayout().getPointerSize();
296 }
297
298 #ifndef NDEBUG
299 void DIEExpr::print(raw_ostream &O) const {
300   O << "Expr: ";
301   Expr->print(O);
302 }
303 #endif
304
305 //===----------------------------------------------------------------------===//
306 // DIELabel Implementation
307 //===----------------------------------------------------------------------===//
308
309 /// EmitValue - Emit label value.
310 ///
311 void DIELabel::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
312   AP->EmitLabelReference(Label, SizeOf(AP, Form),
313                          Form == dwarf::DW_FORM_strp ||
314                              Form == dwarf::DW_FORM_sec_offset ||
315                              Form == dwarf::DW_FORM_ref_addr);
316 }
317
318 /// SizeOf - Determine size of label value in bytes.
319 ///
320 unsigned DIELabel::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
321   if (Form == dwarf::DW_FORM_data4) return 4;
322   if (Form == dwarf::DW_FORM_sec_offset) return 4;
323   if (Form == dwarf::DW_FORM_strp) return 4;
324   return AP->getDataLayout().getPointerSize();
325 }
326
327 #ifndef NDEBUG
328 void DIELabel::print(raw_ostream &O) const {
329   O << "Lbl: " << Label->getName();
330 }
331 #endif
332
333 //===----------------------------------------------------------------------===//
334 // DIEDelta Implementation
335 //===----------------------------------------------------------------------===//
336
337 /// EmitValue - Emit delta value.
338 ///
339 void DIEDelta::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
340   AP->EmitLabelDifference(LabelHi, LabelLo, SizeOf(AP, Form));
341 }
342
343 /// SizeOf - Determine size of delta value in bytes.
344 ///
345 unsigned DIEDelta::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
346   if (Form == dwarf::DW_FORM_data4) return 4;
347   if (Form == dwarf::DW_FORM_sec_offset) return 4;
348   if (Form == dwarf::DW_FORM_strp) return 4;
349   return AP->getDataLayout().getPointerSize();
350 }
351
352 #ifndef NDEBUG
353 void DIEDelta::print(raw_ostream &O) const {
354   O << "Del: " << LabelHi->getName() << "-" << LabelLo->getName();
355 }
356 #endif
357
358 //===----------------------------------------------------------------------===//
359 // DIEString Implementation
360 //===----------------------------------------------------------------------===//
361
362 /// EmitValue - Emit string value.
363 ///
364 void DIEString::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
365   Access->EmitValue(AP, Form);
366 }
367
368 /// SizeOf - Determine size of delta value in bytes.
369 ///
370 unsigned DIEString::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
371   return Access->SizeOf(AP, Form);
372 }
373
374 #ifndef NDEBUG
375 void DIEString::print(raw_ostream &O) const {
376   O << "String: " << Str << "\tSymbol: ";
377   Access->print(O);
378 }
379 #endif
380
381 //===----------------------------------------------------------------------===//
382 // DIEEntry Implementation
383 //===----------------------------------------------------------------------===//
384
385 /// Emit something like ".long Hi+Offset-Lo" where the size in bytes of the
386 /// directive is specified by Size and Hi/Lo specify the labels.
387 static void emitLabelOffsetDifference(MCStreamer &Streamer, const MCSymbol *Hi,
388                                       uint64_t Offset, const MCSymbol *Lo,
389                                       unsigned Size) {
390   MCContext &Context = Streamer.getContext();
391
392   // Emit Hi+Offset - Lo
393   // Get the Hi+Offset expression.
394   const MCExpr *Plus =
395       MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(Hi, Context),
396                               MCConstantExpr::Create(Offset, Context), Context);
397
398   // Get the Hi+Offset-Lo expression.
399   const MCExpr *Diff = MCBinaryExpr::CreateSub(
400       Plus, MCSymbolRefExpr::Create(Lo, Context), Context);
401
402   // Otherwise, emit with .set (aka assignment).
403   MCSymbol *SetLabel = Context.CreateTempSymbol();
404   Streamer.EmitAssignment(SetLabel, Diff);
405   Streamer.EmitSymbolValue(SetLabel, Size);
406 }
407
408 /// EmitValue - Emit debug information entry offset.
409 ///
410 void DIEEntry::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
411
412   if (Form == dwarf::DW_FORM_ref_addr) {
413     const DwarfDebug *DD = AP->getDwarfDebug();
414     unsigned Addr = Entry.getOffset();
415     assert(!DD->useSplitDwarf() && "TODO: dwo files can't have relocations.");
416     // For DW_FORM_ref_addr, output the offset from beginning of debug info
417     // section. Entry->getOffset() returns the offset from start of the
418     // compile unit.
419     DwarfCompileUnit *CU = DD->lookupUnit(Entry.getUnit());
420     assert(CU && "CUDie should belong to a CU.");
421     Addr += CU->getDebugInfoOffset();
422     if (AP->MAI->doesDwarfUseRelocationsAcrossSections())
423       AP->EmitLabelPlusOffset(CU->getSectionSym(), Addr,
424                               DIEEntry::getRefAddrSize(AP));
425     else
426       emitLabelOffsetDifference(AP->OutStreamer, CU->getSectionSym(), Addr,
427                                 CU->getSectionSym(),
428                                 DIEEntry::getRefAddrSize(AP));
429   } else
430     AP->EmitInt32(Entry.getOffset());
431 }
432
433 unsigned DIEEntry::getRefAddrSize(const AsmPrinter *AP) {
434   // DWARF4: References that use the attribute form DW_FORM_ref_addr are
435   // specified to be four bytes in the DWARF 32-bit format and eight bytes
436   // in the DWARF 64-bit format, while DWARF Version 2 specifies that such
437   // references have the same size as an address on the target system.
438   const DwarfDebug *DD = AP->getDwarfDebug();
439   assert(DD && "Expected Dwarf Debug info to be available");
440   if (DD->getDwarfVersion() == 2)
441     return AP->getDataLayout().getPointerSize();
442   return sizeof(int32_t);
443 }
444
445 #ifndef NDEBUG
446 void DIEEntry::print(raw_ostream &O) const {
447   O << format("Die: 0x%lx", (long)(intptr_t)&Entry);
448 }
449 #endif
450
451 //===----------------------------------------------------------------------===//
452 // DIETypeSignature Implementation
453 //===----------------------------------------------------------------------===//
454 void DIETypeSignature::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
455   assert(Form == dwarf::DW_FORM_ref_sig8);
456   Asm->OutStreamer.EmitIntValue(Unit.getTypeSignature(), 8);
457 }
458
459 #ifndef NDEBUG
460 void DIETypeSignature::print(raw_ostream &O) const {
461   O << format("Type Unit: 0x%lx", Unit.getTypeSignature());
462 }
463
464 void DIETypeSignature::dump() const { print(dbgs()); }
465 #endif
466
467 //===----------------------------------------------------------------------===//
468 // DIELoc Implementation
469 //===----------------------------------------------------------------------===//
470
471 /// ComputeSize - calculate the size of the location expression.
472 ///
473 unsigned DIELoc::ComputeSize(const AsmPrinter *AP) const {
474   if (!Size) {
475     const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();
476     for (unsigned i = 0, N = Values.size(); i < N; ++i)
477       Size += Values[i]->SizeOf(AP, AbbrevData[i].getForm());
478   }
479
480   return Size;
481 }
482
483 /// EmitValue - Emit location data.
484 ///
485 void DIELoc::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
486   switch (Form) {
487   default: llvm_unreachable("Improper form for block");
488   case dwarf::DW_FORM_block1: Asm->EmitInt8(Size);    break;
489   case dwarf::DW_FORM_block2: Asm->EmitInt16(Size);   break;
490   case dwarf::DW_FORM_block4: Asm->EmitInt32(Size);   break;
491   case dwarf::DW_FORM_block:
492   case dwarf::DW_FORM_exprloc:
493     Asm->EmitULEB128(Size); break;
494   }
495
496   const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();
497   for (unsigned i = 0, N = Values.size(); i < N; ++i)
498     Values[i]->EmitValue(Asm, AbbrevData[i].getForm());
499 }
500
501 /// SizeOf - Determine size of location data in bytes.
502 ///
503 unsigned DIELoc::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
504   switch (Form) {
505   case dwarf::DW_FORM_block1: return Size + sizeof(int8_t);
506   case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);
507   case dwarf::DW_FORM_block4: return Size + sizeof(int32_t);
508   case dwarf::DW_FORM_block:
509   case dwarf::DW_FORM_exprloc:
510     return Size + getULEB128Size(Size);
511   default: llvm_unreachable("Improper form for block");
512   }
513 }
514
515 #ifndef NDEBUG
516 void DIELoc::print(raw_ostream &O) const {
517   O << "ExprLoc: ";
518   DIE::print(O, 5);
519 }
520 #endif
521
522 //===----------------------------------------------------------------------===//
523 // DIEBlock Implementation
524 //===----------------------------------------------------------------------===//
525
526 /// ComputeSize - calculate the size of the block.
527 ///
528 unsigned DIEBlock::ComputeSize(const AsmPrinter *AP) const {
529   if (!Size) {
530     const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();
531     for (unsigned i = 0, N = Values.size(); i < N; ++i)
532       Size += Values[i]->SizeOf(AP, AbbrevData[i].getForm());
533   }
534
535   return Size;
536 }
537
538 /// EmitValue - Emit block data.
539 ///
540 void DIEBlock::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
541   switch (Form) {
542   default: llvm_unreachable("Improper form for block");
543   case dwarf::DW_FORM_block1: Asm->EmitInt8(Size);    break;
544   case dwarf::DW_FORM_block2: Asm->EmitInt16(Size);   break;
545   case dwarf::DW_FORM_block4: Asm->EmitInt32(Size);   break;
546   case dwarf::DW_FORM_block:  Asm->EmitULEB128(Size); break;
547   }
548
549   const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();
550   for (unsigned i = 0, N = Values.size(); i < N; ++i)
551     Values[i]->EmitValue(Asm, AbbrevData[i].getForm());
552 }
553
554 /// SizeOf - Determine size of block data in bytes.
555 ///
556 unsigned DIEBlock::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
557   switch (Form) {
558   case dwarf::DW_FORM_block1: return Size + sizeof(int8_t);
559   case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);
560   case dwarf::DW_FORM_block4: return Size + sizeof(int32_t);
561   case dwarf::DW_FORM_block:  return Size + getULEB128Size(Size);
562   default: llvm_unreachable("Improper form for block");
563   }
564 }
565
566 #ifndef NDEBUG
567 void DIEBlock::print(raw_ostream &O) const {
568   O << "Blk: ";
569   DIE::print(O, 5);
570 }
571 #endif
572
573 //===----------------------------------------------------------------------===//
574 // DIELocList Implementation
575 //===----------------------------------------------------------------------===//
576
577 unsigned DIELocList::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
578   if (Form == dwarf::DW_FORM_data4)
579     return 4;
580   if (Form == dwarf::DW_FORM_sec_offset)
581     return 4;
582   return AP->getDataLayout().getPointerSize();
583 }
584
585 /// EmitValue - Emit label value.
586 ///
587 void DIELocList::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
588   DwarfDebug *DD = AP->getDwarfDebug();
589   MCSymbol *Label = DD->getDebugLocEntries()[Index].Label;
590
591   if (AP->MAI->doesDwarfUseRelocationsAcrossSections() && !DD->useSplitDwarf())
592     AP->EmitSectionOffset(Label, DD->getDebugLocSym());
593   else
594     AP->EmitLabelDifference(Label, DD->getDebugLocSym(), 4);
595 }
596
597 #ifndef NDEBUG
598 void DIELocList::print(raw_ostream &O) const {
599   O << "LocList: " << Index;
600
601 }
602 #endif