Remove useless break after return.
[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   default: llvm_unreachable("DIE Value form not supported yet");
268   }
269 }
270
271 #ifndef NDEBUG
272 void DIEInteger::print(raw_ostream &O) const {
273   O << "Int: " << (int64_t)Integer << "  0x";
274   O.write_hex(Integer);
275 }
276 #endif
277
278 //===----------------------------------------------------------------------===//
279 // DIEExpr Implementation
280 //===----------------------------------------------------------------------===//
281
282 /// EmitValue - Emit expression value.
283 ///
284 void DIEExpr::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
285   AP->OutStreamer.EmitValue(Expr, SizeOf(AP, Form));
286 }
287
288 /// SizeOf - Determine size of expression value in bytes.
289 ///
290 unsigned DIEExpr::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
291   if (Form == dwarf::DW_FORM_data4) return 4;
292   if (Form == dwarf::DW_FORM_sec_offset) return 4;
293   if (Form == dwarf::DW_FORM_strp) return 4;
294   return AP->getDataLayout().getPointerSize();
295 }
296
297 #ifndef NDEBUG
298 void DIEExpr::print(raw_ostream &O) const {
299   O << "Expr: ";
300   Expr->print(O);
301 }
302 #endif
303
304 //===----------------------------------------------------------------------===//
305 // DIELabel Implementation
306 //===----------------------------------------------------------------------===//
307
308 /// EmitValue - Emit label value.
309 ///
310 void DIELabel::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
311   AP->EmitLabelReference(Label, SizeOf(AP, Form),
312                          Form == dwarf::DW_FORM_strp ||
313                              Form == dwarf::DW_FORM_sec_offset ||
314                              Form == dwarf::DW_FORM_ref_addr);
315 }
316
317 /// SizeOf - Determine size of label value in bytes.
318 ///
319 unsigned DIELabel::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
320   if (Form == dwarf::DW_FORM_data4) return 4;
321   if (Form == dwarf::DW_FORM_sec_offset) return 4;
322   if (Form == dwarf::DW_FORM_strp) return 4;
323   return AP->getDataLayout().getPointerSize();
324 }
325
326 #ifndef NDEBUG
327 void DIELabel::print(raw_ostream &O) const {
328   O << "Lbl: " << Label->getName();
329 }
330 #endif
331
332 //===----------------------------------------------------------------------===//
333 // DIEDelta Implementation
334 //===----------------------------------------------------------------------===//
335
336 /// EmitValue - Emit delta value.
337 ///
338 void DIEDelta::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
339   AP->EmitLabelDifference(LabelHi, LabelLo, SizeOf(AP, Form));
340 }
341
342 /// SizeOf - Determine size of delta value in bytes.
343 ///
344 unsigned DIEDelta::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
345   if (Form == dwarf::DW_FORM_data4) return 4;
346   if (Form == dwarf::DW_FORM_sec_offset) return 4;
347   if (Form == dwarf::DW_FORM_strp) return 4;
348   return AP->getDataLayout().getPointerSize();
349 }
350
351 #ifndef NDEBUG
352 void DIEDelta::print(raw_ostream &O) const {
353   O << "Del: " << LabelHi->getName() << "-" << LabelLo->getName();
354 }
355 #endif
356
357 //===----------------------------------------------------------------------===//
358 // DIEString Implementation
359 //===----------------------------------------------------------------------===//
360
361 /// EmitValue - Emit string value.
362 ///
363 void DIEString::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
364   Access->EmitValue(AP, Form);
365 }
366
367 /// SizeOf - Determine size of delta value in bytes.
368 ///
369 unsigned DIEString::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
370   return Access->SizeOf(AP, Form);
371 }
372
373 #ifndef NDEBUG
374 void DIEString::print(raw_ostream &O) const {
375   O << "String: " << Str << "\tSymbol: ";
376   Access->print(O);
377 }
378 #endif
379
380 //===----------------------------------------------------------------------===//
381 // DIEEntry Implementation
382 //===----------------------------------------------------------------------===//
383
384 /// Emit something like ".long Hi+Offset-Lo" where the size in bytes of the
385 /// directive is specified by Size and Hi/Lo specify the labels.
386 static void emitLabelOffsetDifference(MCStreamer &Streamer, const MCSymbol *Hi,
387                                       uint64_t Offset, const MCSymbol *Lo,
388                                       unsigned Size) {
389   MCContext &Context = Streamer.getContext();
390
391   // Emit Hi+Offset - Lo
392   // Get the Hi+Offset expression.
393   const MCExpr *Plus =
394       MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(Hi, Context),
395                               MCConstantExpr::Create(Offset, Context), Context);
396
397   // Get the Hi+Offset-Lo expression.
398   const MCExpr *Diff = MCBinaryExpr::CreateSub(
399       Plus, MCSymbolRefExpr::Create(Lo, Context), Context);
400
401   // Otherwise, emit with .set (aka assignment).
402   MCSymbol *SetLabel = Context.CreateTempSymbol();
403   Streamer.EmitAssignment(SetLabel, Diff);
404   Streamer.EmitSymbolValue(SetLabel, Size);
405 }
406
407 /// EmitValue - Emit debug information entry offset.
408 ///
409 void DIEEntry::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
410
411   if (Form == dwarf::DW_FORM_ref_addr) {
412     const DwarfDebug *DD = AP->getDwarfDebug();
413     unsigned Addr = Entry.getOffset();
414     assert(!DD->useSplitDwarf() && "TODO: dwo files can't have relocations.");
415     // For DW_FORM_ref_addr, output the offset from beginning of debug info
416     // section. Entry->getOffset() returns the offset from start of the
417     // compile unit.
418     DwarfCompileUnit *CU = DD->lookupUnit(Entry.getUnit());
419     assert(CU && "CUDie should belong to a CU.");
420     Addr += CU->getDebugInfoOffset();
421     if (AP->MAI->doesDwarfUseRelocationsAcrossSections())
422       AP->EmitLabelPlusOffset(CU->getSectionSym(), Addr,
423                               DIEEntry::getRefAddrSize(AP));
424     else
425       emitLabelOffsetDifference(AP->OutStreamer, CU->getSectionSym(), Addr,
426                                 CU->getSectionSym(),
427                                 DIEEntry::getRefAddrSize(AP));
428   } else
429     AP->EmitInt32(Entry.getOffset());
430 }
431
432 unsigned DIEEntry::getRefAddrSize(const AsmPrinter *AP) {
433   // DWARF4: References that use the attribute form DW_FORM_ref_addr are
434   // specified to be four bytes in the DWARF 32-bit format and eight bytes
435   // in the DWARF 64-bit format, while DWARF Version 2 specifies that such
436   // references have the same size as an address on the target system.
437   const DwarfDebug *DD = AP->getDwarfDebug();
438   assert(DD && "Expected Dwarf Debug info to be available");
439   if (DD->getDwarfVersion() == 2)
440     return AP->getDataLayout().getPointerSize();
441   return sizeof(int32_t);
442 }
443
444 #ifndef NDEBUG
445 void DIEEntry::print(raw_ostream &O) const {
446   O << format("Die: 0x%lx", (long)(intptr_t)&Entry);
447 }
448 #endif
449
450 //===----------------------------------------------------------------------===//
451 // DIETypeSignature Implementation
452 //===----------------------------------------------------------------------===//
453 void DIETypeSignature::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
454   assert(Form == dwarf::DW_FORM_ref_sig8);
455   Asm->OutStreamer.EmitIntValue(Unit.getTypeSignature(), 8);
456 }
457
458 #ifndef NDEBUG
459 void DIETypeSignature::print(raw_ostream &O) const {
460   O << format("Type Unit: 0x%lx", Unit.getTypeSignature());
461 }
462
463 void DIETypeSignature::dump() const { print(dbgs()); }
464 #endif
465
466 //===----------------------------------------------------------------------===//
467 // DIELoc Implementation
468 //===----------------------------------------------------------------------===//
469
470 /// ComputeSize - calculate the size of the location expression.
471 ///
472 unsigned DIELoc::ComputeSize(const AsmPrinter *AP) const {
473   if (!Size) {
474     const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();
475     for (unsigned i = 0, N = Values.size(); i < N; ++i)
476       Size += Values[i]->SizeOf(AP, AbbrevData[i].getForm());
477   }
478
479   return Size;
480 }
481
482 /// EmitValue - Emit location data.
483 ///
484 void DIELoc::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
485   switch (Form) {
486   default: llvm_unreachable("Improper form for block");
487   case dwarf::DW_FORM_block1: Asm->EmitInt8(Size);    break;
488   case dwarf::DW_FORM_block2: Asm->EmitInt16(Size);   break;
489   case dwarf::DW_FORM_block4: Asm->EmitInt32(Size);   break;
490   case dwarf::DW_FORM_block:
491   case dwarf::DW_FORM_exprloc:
492     Asm->EmitULEB128(Size); break;
493   }
494
495   const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();
496   for (unsigned i = 0, N = Values.size(); i < N; ++i)
497     Values[i]->EmitValue(Asm, AbbrevData[i].getForm());
498 }
499
500 /// SizeOf - Determine size of location data in bytes.
501 ///
502 unsigned DIELoc::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
503   switch (Form) {
504   case dwarf::DW_FORM_block1: return Size + sizeof(int8_t);
505   case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);
506   case dwarf::DW_FORM_block4: return Size + sizeof(int32_t);
507   case dwarf::DW_FORM_block:
508   case dwarf::DW_FORM_exprloc:
509     return Size + getULEB128Size(Size);
510   default: llvm_unreachable("Improper form for block");
511   }
512 }
513
514 #ifndef NDEBUG
515 void DIELoc::print(raw_ostream &O) const {
516   O << "ExprLoc: ";
517   DIE::print(O, 5);
518 }
519 #endif
520
521 //===----------------------------------------------------------------------===//
522 // DIEBlock Implementation
523 //===----------------------------------------------------------------------===//
524
525 /// ComputeSize - calculate the size of the block.
526 ///
527 unsigned DIEBlock::ComputeSize(const AsmPrinter *AP) const {
528   if (!Size) {
529     const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();
530     for (unsigned i = 0, N = Values.size(); i < N; ++i)
531       Size += Values[i]->SizeOf(AP, AbbrevData[i].getForm());
532   }
533
534   return Size;
535 }
536
537 /// EmitValue - Emit block data.
538 ///
539 void DIEBlock::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
540   switch (Form) {
541   default: llvm_unreachable("Improper form for block");
542   case dwarf::DW_FORM_block1: Asm->EmitInt8(Size);    break;
543   case dwarf::DW_FORM_block2: Asm->EmitInt16(Size);   break;
544   case dwarf::DW_FORM_block4: Asm->EmitInt32(Size);   break;
545   case dwarf::DW_FORM_block:  Asm->EmitULEB128(Size); break;
546   }
547
548   const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();
549   for (unsigned i = 0, N = Values.size(); i < N; ++i)
550     Values[i]->EmitValue(Asm, AbbrevData[i].getForm());
551 }
552
553 /// SizeOf - Determine size of block data in bytes.
554 ///
555 unsigned DIEBlock::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
556   switch (Form) {
557   case dwarf::DW_FORM_block1: return Size + sizeof(int8_t);
558   case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);
559   case dwarf::DW_FORM_block4: return Size + sizeof(int32_t);
560   case dwarf::DW_FORM_block:  return Size + getULEB128Size(Size);
561   default: llvm_unreachable("Improper form for block");
562   }
563 }
564
565 #ifndef NDEBUG
566 void DIEBlock::print(raw_ostream &O) const {
567   O << "Blk: ";
568   DIE::print(O, 5);
569 }
570 #endif
571
572 //===----------------------------------------------------------------------===//
573 // DIELocList Implementation
574 //===----------------------------------------------------------------------===//
575
576 unsigned DIELocList::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
577   if (Form == dwarf::DW_FORM_data4)
578     return 4;
579   if (Form == dwarf::DW_FORM_sec_offset)
580     return 4;
581   return AP->getDataLayout().getPointerSize();
582 }
583
584 /// EmitValue - Emit label value.
585 ///
586 void DIELocList::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
587   DwarfDebug *DD = AP->getDwarfDebug();
588   MCSymbol *Label = DD->getDebugLocEntries()[Index].Label;
589
590   if (AP->MAI->doesDwarfUseRelocationsAcrossSections() && !DD->useSplitDwarf())
591     AP->EmitSectionOffset(Label, DD->getDebugLocSym());
592   else
593     AP->EmitLabelDifference(Label, DD->getDebugLocSym(), 4);
594 }
595
596 #ifndef NDEBUG
597 void DIELocList::print(raw_ostream &O) const {
598   O << "LocList: " << Index;
599
600 }
601 #endif