LLVM  3.7.0
DIE.cpp
Go to the documentation of this file.
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"
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"
27 #include "llvm/Support/Format.h"
29 #include "llvm/Support/LEB128.h"
30 #include "llvm/Support/MD5.h"
32 using namespace llvm;
33 
34 //===----------------------------------------------------------------------===//
35 // DIEAbbrevData Implementation
36 //===----------------------------------------------------------------------===//
37 
38 /// Profile - Used to gather unique data for the abbreviation folding set.
39 ///
41  // Explicitly cast to an integer type for which FoldingSetNodeID has
42  // overloads. Otherwise MSVC 2010 thinks this call is ambiguous.
43  ID.AddInteger(unsigned(Attribute));
44  ID.AddInteger(unsigned(Form));
45 }
46 
47 //===----------------------------------------------------------------------===//
48 // DIEAbbrev Implementation
49 //===----------------------------------------------------------------------===//
50 
51 /// Profile - Used to gather unique data for the abbreviation folding set.
52 ///
54  ID.AddInteger(unsigned(Tag));
55  ID.AddInteger(unsigned(Children));
56 
57  // For each attribute description.
58  for (unsigned i = 0, N = Data.size(); i < N; ++i)
59  Data[i].Profile(ID);
60 }
61 
62 /// Emit - Print the abbreviation using the specified asm printer.
63 ///
64 void DIEAbbrev::Emit(const AsmPrinter *AP) const {
65  // Emit its Dwarf tag type.
66  AP->EmitULEB128(Tag, dwarf::TagString(Tag));
67 
68  // Emit whether it has children DIEs.
69  AP->EmitULEB128((unsigned)Children, dwarf::ChildrenString(Children));
70 
71  // For each attribute description.
72  for (unsigned i = 0, N = Data.size(); i < N; ++i) {
73  const DIEAbbrevData &AttrData = Data[i];
74 
75  // Emit attribute type.
76  AP->EmitULEB128(AttrData.getAttribute(),
78 
79  // Emit form type.
80  AP->EmitULEB128(AttrData.getForm(),
82  }
83 
84  // Mark end of abbreviation.
85  AP->EmitULEB128(0, "EOM(1)");
86  AP->EmitULEB128(0, "EOM(2)");
87 }
88 
89 #ifndef NDEBUG
91  O << "Abbreviation @"
92  << format("0x%lx", (long)(intptr_t)this)
93  << " "
94  << dwarf::TagString(Tag)
95  << " "
96  << dwarf::ChildrenString(Children)
97  << '\n';
98 
99  for (unsigned i = 0, N = Data.size(); i < N; ++i) {
100  O << " "
101  << dwarf::AttributeString(Data[i].getAttribute())
102  << " "
103  << dwarf::FormEncodingString(Data[i].getForm())
104  << '\n';
105  }
106 }
107 void DIEAbbrev::dump() { print(dbgs()); }
108 #endif
109 
111  DIEAbbrev Abbrev(Tag, hasChildren());
112  for (const DIEValue &V : Values)
113  Abbrev.AddAttribute(V.getAttribute(), V.getForm());
114  return Abbrev;
115 }
116 
117 /// Climb up the parent chain to get the unit DIE to which this DIE
118 /// belongs.
119 const DIE *DIE::getUnit() const {
120  const DIE *Cu = getUnitOrNull();
121  assert(Cu && "We should not have orphaned DIEs.");
122  return Cu;
123 }
124 
125 /// Climb up the parent chain to get the unit DIE this DIE belongs
126 /// to. Return NULL if DIE is not added to an owner yet.
127 const DIE *DIE::getUnitOrNull() const {
128  const DIE *p = this;
129  while (p) {
130  if (p->getTag() == dwarf::DW_TAG_compile_unit ||
131  p->getTag() == dwarf::DW_TAG_type_unit)
132  return p;
133  p = p->getParent();
134  }
135  return nullptr;
136 }
137 
139  // Iterate through all the attributes until we find the one we're
140  // looking for, if we can't find it return NULL.
141  for (const auto &V : values())
142  if (V.getAttribute() == Attribute)
143  return V;
144  return DIEValue();
145 }
146 
147 #ifndef NDEBUG
148 void DIE::print(raw_ostream &O, unsigned IndentCount) const {
149  const std::string Indent(IndentCount, ' ');
150  bool isBlock = getTag() == 0;
151 
152  if (!isBlock) {
153  O << Indent
154  << "Die: "
155  << format("0x%lx", (long)(intptr_t)this)
156  << ", Offset: " << Offset
157  << ", Size: " << Size << "\n";
158 
159  O << Indent
161  << " "
162  << dwarf::ChildrenString(hasChildren()) << "\n";
163  } else {
164  O << "Size: " << Size << "\n";
165  }
166 
167  IndentCount += 2;
168  unsigned I = 0;
169  for (const auto &V : Values) {
170  O << Indent;
171 
172  if (!isBlock)
173  O << dwarf::AttributeString(V.getAttribute());
174  else
175  O << "Blk[" << I++ << "]";
176 
177  O << " " << dwarf::FormEncodingString(V.getForm()) << " ";
178  V.print(O);
179  O << "\n";
180  }
181  IndentCount -= 2;
182 
183  for (const auto &Child : children())
184  Child.print(O, IndentCount + 4);
185 
186  if (!isBlock) O << "\n";
187 }
188 
189 void DIE::dump() {
190  print(dbgs());
191 }
192 #endif
193 
194 void DIEValue::EmitValue(const AsmPrinter *AP) const {
195  switch (Ty) {
196  case isNone:
197  llvm_unreachable("Expected valid DIEValue");
198 #define HANDLE_DIEVALUE(T) \
199  case is##T: \
200  getDIE##T().EmitValue(AP, Form); \
201  break;
202 #include "llvm/CodeGen/DIEValue.def"
203  }
204 }
205 
206 unsigned DIEValue::SizeOf(const AsmPrinter *AP) const {
207  switch (Ty) {
208  case isNone:
209  llvm_unreachable("Expected valid DIEValue");
210 #define HANDLE_DIEVALUE(T) \
211  case is##T: \
212  return getDIE##T().SizeOf(AP, Form);
213 #include "llvm/CodeGen/DIEValue.def"
214  }
215  llvm_unreachable("Unknown DIE kind");
216 }
217 
218 #ifndef NDEBUG
219 void DIEValue::print(raw_ostream &O) const {
220  switch (Ty) {
221  case isNone:
222  llvm_unreachable("Expected valid DIEValue");
223 #define HANDLE_DIEVALUE(T) \
224  case is##T: \
225  getDIE##T().print(O); \
226  break;
227 #include "llvm/CodeGen/DIEValue.def"
228  }
229 }
230 
231 void DIEValue::dump() const {
232  print(dbgs());
233 }
234 #endif
235 
236 //===----------------------------------------------------------------------===//
237 // DIEInteger Implementation
238 //===----------------------------------------------------------------------===//
239 
240 /// EmitValue - Emit integer of appropriate size.
241 ///
243  unsigned Size = ~0U;
244  switch (Form) {
246  // Emit something to keep the lines and comments in sync.
247  // FIXME: Is there a better way to do this?
248  Asm->OutStreamer->AddBlankLine();
249  return;
250  case dwarf::DW_FORM_flag: // Fall thru
251  case dwarf::DW_FORM_ref1: // Fall thru
252  case dwarf::DW_FORM_data1: Size = 1; break;
253  case dwarf::DW_FORM_ref2: // Fall thru
254  case dwarf::DW_FORM_data2: Size = 2; break;
255  case dwarf::DW_FORM_sec_offset: // Fall thru
256  case dwarf::DW_FORM_strp: // Fall thru
257  case dwarf::DW_FORM_ref4: // Fall thru
258  case dwarf::DW_FORM_data4: Size = 4; break;
259  case dwarf::DW_FORM_ref8: // Fall thru
260  case dwarf::DW_FORM_ref_sig8: // Fall thru
261  case dwarf::DW_FORM_data8: Size = 8; break;
262  case dwarf::DW_FORM_GNU_str_index: Asm->EmitULEB128(Integer); return;
263  case dwarf::DW_FORM_GNU_addr_index: Asm->EmitULEB128(Integer); return;
264  case dwarf::DW_FORM_udata: Asm->EmitULEB128(Integer); return;
265  case dwarf::DW_FORM_sdata: Asm->EmitSLEB128(Integer); return;
266  case dwarf::DW_FORM_addr:
267  Size = Asm->getDataLayout().getPointerSize(); break;
269  Size = SizeOf(Asm, dwarf::DW_FORM_ref_addr);
270  break;
271  default: llvm_unreachable("DIE Value form not supported yet");
272  }
273  Asm->OutStreamer->EmitIntValue(Integer, Size);
274 }
275 
276 /// SizeOf - Determine size of integer value in bytes.
277 ///
278 unsigned DIEInteger::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
279  switch (Form) {
280  case dwarf::DW_FORM_flag_present: return 0;
281  case dwarf::DW_FORM_flag: // Fall thru
282  case dwarf::DW_FORM_ref1: // Fall thru
283  case dwarf::DW_FORM_data1: return sizeof(int8_t);
284  case dwarf::DW_FORM_ref2: // Fall thru
285  case dwarf::DW_FORM_data2: return sizeof(int16_t);
286  case dwarf::DW_FORM_sec_offset: // Fall thru
287  case dwarf::DW_FORM_strp: // Fall thru
288  case dwarf::DW_FORM_ref4: // Fall thru
289  case dwarf::DW_FORM_data4: return sizeof(int32_t);
290  case dwarf::DW_FORM_ref8: // Fall thru
291  case dwarf::DW_FORM_ref_sig8: // Fall thru
292  case dwarf::DW_FORM_data8: return sizeof(int64_t);
293  case dwarf::DW_FORM_GNU_str_index: return getULEB128Size(Integer);
294  case dwarf::DW_FORM_GNU_addr_index: return getULEB128Size(Integer);
295  case dwarf::DW_FORM_udata: return getULEB128Size(Integer);
296  case dwarf::DW_FORM_sdata: return getSLEB128Size(Integer);
297  case dwarf::DW_FORM_addr: return AP->getDataLayout().getPointerSize();
299  if (AP->OutStreamer->getContext().getDwarfVersion() == 2)
300  return AP->getDataLayout().getPointerSize();
301  return sizeof(int32_t);
302  default: llvm_unreachable("DIE Value form not supported yet");
303  }
304 }
305 
306 #ifndef NDEBUG
308  O << "Int: " << (int64_t)Integer << " 0x";
309  O.write_hex(Integer);
310 }
311 #endif
312 
313 //===----------------------------------------------------------------------===//
314 // DIEExpr Implementation
315 //===----------------------------------------------------------------------===//
316 
317 /// EmitValue - Emit expression value.
318 ///
320  AP->OutStreamer->EmitValue(Expr, SizeOf(AP, Form));
321 }
322 
323 /// SizeOf - Determine size of expression value in bytes.
324 ///
325 unsigned DIEExpr::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
326  if (Form == dwarf::DW_FORM_data4) return 4;
327  if (Form == dwarf::DW_FORM_sec_offset) return 4;
328  if (Form == dwarf::DW_FORM_strp) return 4;
329  return AP->getDataLayout().getPointerSize();
330 }
331 
332 #ifndef NDEBUG
333 void DIEExpr::print(raw_ostream &O) const { O << "Expr: " << *Expr; }
334 #endif
335 
336 //===----------------------------------------------------------------------===//
337 // DIELabel Implementation
338 //===----------------------------------------------------------------------===//
339 
340 /// EmitValue - Emit label value.
341 ///
343  AP->EmitLabelReference(Label, SizeOf(AP, Form),
344  Form == dwarf::DW_FORM_strp ||
345  Form == dwarf::DW_FORM_sec_offset ||
346  Form == dwarf::DW_FORM_ref_addr);
347 }
348 
349 /// SizeOf - Determine size of label value in bytes.
350 ///
351 unsigned DIELabel::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
352  if (Form == dwarf::DW_FORM_data4) return 4;
353  if (Form == dwarf::DW_FORM_sec_offset) return 4;
354  if (Form == dwarf::DW_FORM_strp) return 4;
355  return AP->getDataLayout().getPointerSize();
356 }
357 
358 #ifndef NDEBUG
359 void DIELabel::print(raw_ostream &O) const { O << "Lbl: " << Label->getName(); }
360 #endif
361 
362 //===----------------------------------------------------------------------===//
363 // DIEDelta Implementation
364 //===----------------------------------------------------------------------===//
365 
366 /// EmitValue - Emit delta value.
367 ///
369  AP->EmitLabelDifference(LabelHi, LabelLo, SizeOf(AP, Form));
370 }
371 
372 /// SizeOf - Determine size of delta value in bytes.
373 ///
374 unsigned DIEDelta::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
375  if (Form == dwarf::DW_FORM_data4) return 4;
376  if (Form == dwarf::DW_FORM_sec_offset) return 4;
377  if (Form == dwarf::DW_FORM_strp) return 4;
378  return AP->getDataLayout().getPointerSize();
379 }
380 
381 #ifndef NDEBUG
382 void DIEDelta::print(raw_ostream &O) const {
383  O << "Del: " << LabelHi->getName() << "-" << LabelLo->getName();
384 }
385 #endif
386 
387 //===----------------------------------------------------------------------===//
388 // DIEString Implementation
389 //===----------------------------------------------------------------------===//
390 
391 /// EmitValue - Emit string value.
392 ///
394  assert(
395  (Form == dwarf::DW_FORM_strp || Form == dwarf::DW_FORM_GNU_str_index) &&
396  "Expected valid string form");
397 
398  // Index of string in symbol table.
399  if (Form == dwarf::DW_FORM_GNU_str_index) {
400  DIEInteger(S.getIndex()).EmitValue(AP, Form);
401  return;
402  }
403 
404  // Relocatable symbol.
405  assert(Form == dwarf::DW_FORM_strp);
407  DIELabel(S.getSymbol()).EmitValue(AP, Form);
408  return;
409  }
410 
411  // Offset into symbol table.
412  DIEInteger(S.getOffset()).EmitValue(AP, Form);
413 }
414 
415 /// SizeOf - Determine size of delta value in bytes.
416 ///
417 unsigned DIEString::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
418  assert(
419  (Form == dwarf::DW_FORM_strp || Form == dwarf::DW_FORM_GNU_str_index) &&
420  "Expected valid string form");
421 
422  // Index of string in symbol table.
423  if (Form == dwarf::DW_FORM_GNU_str_index)
424  return DIEInteger(S.getIndex()).SizeOf(AP, Form);
425 
426  // Relocatable symbol.
428  return DIELabel(S.getSymbol()).SizeOf(AP, Form);
429 
430  // Offset into symbol table.
431  return DIEInteger(S.getOffset()).SizeOf(AP, Form);
432 }
433 
434 #ifndef NDEBUG
436  O << "String: " << S.getString();
437 }
438 #endif
439 
440 //===----------------------------------------------------------------------===//
441 // DIEEntry Implementation
442 //===----------------------------------------------------------------------===//
443 
444 /// EmitValue - Emit debug information entry offset.
445 ///
447 
448  if (Form == dwarf::DW_FORM_ref_addr) {
449  const DwarfDebug *DD = AP->getDwarfDebug();
450  unsigned Addr = Entry->getOffset();
451  assert(!DD->useSplitDwarf() && "TODO: dwo files can't have relocations.");
452  // For DW_FORM_ref_addr, output the offset from beginning of debug info
453  // section. Entry->getOffset() returns the offset from start of the
454  // compile unit.
455  DwarfCompileUnit *CU = DD->lookupUnit(Entry->getUnit());
456  assert(CU && "CUDie should belong to a CU.");
457  Addr += CU->getDebugInfoOffset();
459  AP->EmitLabelPlusOffset(CU->getSectionSym(), Addr,
461  else
462  AP->OutStreamer->EmitIntValue(Addr, DIEEntry::getRefAddrSize(AP));
463  } else
464  AP->EmitInt32(Entry->getOffset());
465 }
466 
468  // DWARF4: References that use the attribute form DW_FORM_ref_addr are
469  // specified to be four bytes in the DWARF 32-bit format and eight bytes
470  // in the DWARF 64-bit format, while DWARF Version 2 specifies that such
471  // references have the same size as an address on the target system.
472  const DwarfDebug *DD = AP->getDwarfDebug();
473  assert(DD && "Expected Dwarf Debug info to be available");
474  if (DD->getDwarfVersion() == 2)
475  return AP->getDataLayout().getPointerSize();
476  return sizeof(int32_t);
477 }
478 
479 #ifndef NDEBUG
480 void DIEEntry::print(raw_ostream &O) const {
481  O << format("Die: 0x%lx", (long)(intptr_t)&Entry);
482 }
483 #endif
484 
485 //===----------------------------------------------------------------------===//
486 // DIETypeSignature Implementation
487 //===----------------------------------------------------------------------===//
489  dwarf::Form Form) const {
490  assert(Form == dwarf::DW_FORM_ref_sig8);
491  Asm->OutStreamer->EmitIntValue(Unit->getTypeSignature(), 8);
492 }
493 
494 #ifndef NDEBUG
496  O << format("Type Unit: 0x%lx", Unit->getTypeSignature());
497 }
498 #endif
499 
500 //===----------------------------------------------------------------------===//
501 // DIELoc Implementation
502 //===----------------------------------------------------------------------===//
503 
504 /// ComputeSize - calculate the size of the location expression.
505 ///
506 unsigned DIELoc::ComputeSize(const AsmPrinter *AP) const {
507  if (!Size) {
508  for (const auto &V : Values)
509  Size += V.SizeOf(AP);
510  }
511 
512  return Size;
513 }
514 
515 /// EmitValue - Emit location data.
516 ///
518  switch (Form) {
519  default: llvm_unreachable("Improper form for block");
520  case dwarf::DW_FORM_block1: Asm->EmitInt8(Size); break;
521  case dwarf::DW_FORM_block2: Asm->EmitInt16(Size); break;
522  case dwarf::DW_FORM_block4: Asm->EmitInt32(Size); break;
525  Asm->EmitULEB128(Size); break;
526  }
527 
528  for (const auto &V : Values)
529  V.EmitValue(Asm);
530 }
531 
532 /// SizeOf - Determine size of location data in bytes.
533 ///
534 unsigned DIELoc::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
535  switch (Form) {
536  case dwarf::DW_FORM_block1: return Size + sizeof(int8_t);
537  case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);
538  case dwarf::DW_FORM_block4: return Size + sizeof(int32_t);
541  return Size + getULEB128Size(Size);
542  default: llvm_unreachable("Improper form for block");
543  }
544 }
545 
546 #ifndef NDEBUG
547 void DIELoc::print(raw_ostream &O) const {
548  O << "ExprLoc: ";
549  DIE::print(O, 5);
550 }
551 #endif
552 
553 //===----------------------------------------------------------------------===//
554 // DIEBlock Implementation
555 //===----------------------------------------------------------------------===//
556 
557 /// ComputeSize - calculate the size of the block.
558 ///
559 unsigned DIEBlock::ComputeSize(const AsmPrinter *AP) const {
560  if (!Size) {
561  for (const auto &V : Values)
562  Size += V.SizeOf(AP);
563  }
564 
565  return Size;
566 }
567 
568 /// EmitValue - Emit block data.
569 ///
571  switch (Form) {
572  default: llvm_unreachable("Improper form for block");
573  case dwarf::DW_FORM_block1: Asm->EmitInt8(Size); break;
574  case dwarf::DW_FORM_block2: Asm->EmitInt16(Size); break;
575  case dwarf::DW_FORM_block4: Asm->EmitInt32(Size); break;
576  case dwarf::DW_FORM_block: Asm->EmitULEB128(Size); break;
577  }
578 
579  for (const auto &V : Values)
580  V.EmitValue(Asm);
581 }
582 
583 /// SizeOf - Determine size of block data in bytes.
584 ///
585 unsigned DIEBlock::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
586  switch (Form) {
587  case dwarf::DW_FORM_block1: return Size + sizeof(int8_t);
588  case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);
589  case dwarf::DW_FORM_block4: return Size + sizeof(int32_t);
590  case dwarf::DW_FORM_block: return Size + getULEB128Size(Size);
591  default: llvm_unreachable("Improper form for block");
592  }
593 }
594 
595 #ifndef NDEBUG
596 void DIEBlock::print(raw_ostream &O) const {
597  O << "Blk: ";
598  DIE::print(O, 5);
599 }
600 #endif
601 
602 //===----------------------------------------------------------------------===//
603 // DIELocList Implementation
604 //===----------------------------------------------------------------------===//
605 
606 unsigned DIELocList::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
607  if (Form == dwarf::DW_FORM_data4)
608  return 4;
609  if (Form == dwarf::DW_FORM_sec_offset)
610  return 4;
611  return AP->getDataLayout().getPointerSize();
612 }
613 
614 /// EmitValue - Emit label value.
615 ///
617  DwarfDebug *DD = AP->getDwarfDebug();
618  MCSymbol *Label = DD->getDebugLocs().getList(Index).Label;
619  AP->emitDwarfSymbolReference(Label, /*ForceOffset*/ DD->useSplitDwarf());
620 }
621 
622 #ifndef NDEBUG
623 void DIELocList::print(raw_ostream &O) const { O << "LocList: " << Index; }
624 #endif
DIEAbbrev generateAbbrev() const
Generate the abbreviation for this DIE.
Definition: DIE.cpp:110
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit block data.
Definition: DIE.cpp:570
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit debug information entry offset.
Definition: DIE.cpp:446
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
Definition: AsmPrinter.h:83
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit string value.
Definition: DIE.cpp:393
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:39
void print(raw_ostream &O) const
Definition: DIE.cpp:333
const DataLayout & getDataLayout() const
Return information about data layout.
Definition: AsmPrinter.cpp:139
void EmitInt8(int Value) const
Emit a byte directive and value.
void print(raw_ostream &O) const
Definition: DIE.cpp:359
void EmitValue(const AsmPrinter *AP) const
EmitValue - Emit value via the Dwarf writer.
Definition: DIE.cpp:194
void EmitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset, unsigned Size, bool IsSectionRelative=false) const
Emit something like ".long Label+Offset" where the size in bytes of the directive is specified by Siz...
void EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size) const
Emit something like ".long Hi-Lo" where the size in bytes of the directive is specified by Size and H...
child_range children()
Definition: DIE.h:673
Collects and handles dwarf debug information.
Definition: DwarfDebug.h:207
const char * AttributeString(unsigned Attribute)
Definition: Dwarf.cpp:46
void print(raw_ostream &O) const
Definition: DIE.cpp:219
void EmitInt32(int Value) const
Emit a long directive and value.
void EmitLabelReference(const MCSymbol *Label, unsigned Size, bool IsSectionRelative=false) const
Emit something like ".long Label" where the size in bytes of the directive is specified by Size and L...
Definition: AsmPrinter.h:391
void AddAttribute(dwarf::Attribute Attribute, dwarf::Form Form)
AddAttribute - Adds another set of attribute information to the abbreviation.
Definition: DIE.h:91
void print(raw_ostream &O, unsigned IndentCount=0) const
Definition: DIE.cpp:148
void Profile(FoldingSetNodeID &ID) const
Profile - Used to gather unique data for the abbreviation folding set.
Definition: DIE.cpp:53
DIEAbbrevData - Dwarf abbreviation data, describes one attribute of a Dwarf abbreviation.
Definition: DIE.h:35
void print(raw_ostream &O) const
Definition: DIE.cpp:495
dwarf::Form getForm() const
Definition: DIE.h:49
void dump() const
Definition: DIE.cpp:231
const char * TagString(unsigned Tag)
Definition: Dwarf.cpp:21
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:98
unsigned Offset
Offset - Offset in debug info section.
Definition: DIE.h:629
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of delta value in bytes.
Definition: DIE.cpp:417
void AddInteger(signed I)
Definition: FoldingSet.cpp:60
void dump()
Definition: DIE.cpp:189
const List & getList(size_t LI) const
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit location data.
Definition: DIE.cpp:517
static unsigned getRefAddrSize(const AsmPrinter *AP)
Returns size of a ref_addr entry.
Definition: DIE.cpp:467
void print(raw_ostream &O) const
Definition: DIE.cpp:596
raw_ostream & write_hex(unsigned long long N)
Output N in hexadecimal, without any prefix or padding.
void emitDwarfSymbolReference(const MCSymbol *Label, bool ForceOffset=false) const
Emit a reference to a symbol for use in dwarf.
void EmitInt16(int Value) const
Emit a short directive and value.
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit expression value.
Definition: DIE.cpp:319
unsigned Size
Size - Size of instance + children.
Definition: DIE.h:633
dwarf::Tag getTag() const
Definition: DIE.h:663
void print(raw_ostream &O) const
Definition: DIE.cpp:623
format_object< Ts...> format(const char *Fmt, const Ts &...Vals)
These are helper functions used to produce formatted output.
Definition: Format.h:111
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
Definition: FoldingSet.h:297
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of label value in bytes.
Definition: DIE.cpp:351
bool useSplitDwarf() const
Returns whether or not to change the current debug info for the split dwarf proposal support...
Definition: DwarfDebug.h:573
bool hasChildren() const
Definition: DIE.h:666
const MCAsmInfo * MAI
Target Asm Printer information.
Definition: AsmPrinter.h:74
const DIE * getUnitOrNull() const
Similar to getUnit, returns null when DIE is not added to an owner yet.
Definition: DIE.cpp:127
DIEValue findAttribute(dwarf::Attribute Attribute) const
Find a value in the DIE with the attribute given.
Definition: DIE.cpp:138
void EmitULEB128(uint64_t Value, const char *Desc=nullptr, unsigned PadTo=0) const
Emit the specified unsigned leb128 value.
DIE - A structured debug information entry.
Definition: DIE.h:623
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit delta value.
Definition: DIE.cpp:368
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:66
void print(raw_ostream &O) const
Definition: DIE.cpp:547
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of integer value in bytes.
Definition: DIE.cpp:278
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of block data in bytes.
Definition: DIE.cpp:585
DwarfDebug * getDwarfDebug()
Definition: AsmPrinter.h:147
DIEValueList Values
Attribute values.
Definition: DIE.h:648
DIELabel - A label DIE.
Definition: DIE.h:175
void print(raw_ostream &O) const
Definition: DIE.cpp:382
unsigned getULEB128Size(uint64_t Value)
Utility function to get the size of the ULEB128-encoded value.
Definition: LEB128.cpp:20
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit label value.
Definition: DIE.cpp:616
DIE * getParent() const
Definition: DIE.h:694
dwarf::Attribute getAttribute() const
Definition: DIE.h:48
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of expression value in bytes.
Definition: DIE.cpp:325
const DebugLocStream & getDebugLocs() const
Returns the entries for the .debug_loc section.
Definition: DwarfDebug.h:583
unsigned getOffset() const
Definition: DIE.h:664
DwarfCompileUnit * lookupUnit(const DIE *CU) const
Find the DwarfCompileUnit for the given CU Die.
Definition: DwarfDebug.h:604
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const
Definition: DIE.cpp:488
void print(raw_ostream &O) const
Definition: DIE.cpp:435
void Profile(FoldingSetNodeID &ID) const
Profile - Used to gather unique data for the abbreviation folding set.
Definition: DIE.cpp:40
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:123
unsigned SizeOf(const AsmPrinter *AP) const
SizeOf - Return the size of a value in bytes.
Definition: DIE.cpp:206
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of location data in bytes.
Definition: DIE.cpp:534
DIEInteger - An integer value DIE.
Definition: DIE.h:112
DIEAbbrev - Dwarf abbreviation, describes the organization of a debug information object...
Definition: DIE.h:59
StringRef getName() const
getName - Get the symbol name.
Definition: MCSymbol.h:205
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit integer of appropriate size.
Definition: DIE.cpp:242
void EmitSLEB128(int64_t Value, const char *Desc=nullptr) const
Emit the specified signed leb128 value.
void print(raw_ostream &O) const
Definition: DIE.cpp:307
dwarf::Tag Tag
Tag - Dwarf tag code.
Definition: DIE.h:639
#define I(x, y, z)
Definition: MD5.cpp:54
#define N
void print(raw_ostream &O)
Definition: DIE.cpp:90
const char * FormEncodingString(unsigned Encoding)
Definition: Dwarf.cpp:208
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
Definition: DIE.cpp:606
unsigned getSLEB128Size(int64_t Value)
Utility function to get the size of the SLEB128-encoded value.
Definition: LEB128.cpp:30
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit label value.
Definition: DIE.cpp:342
unsigned ComputeSize(const AsmPrinter *AP) const
ComputeSize - Calculate the size of the location expression.
Definition: DIE.cpp:559
const char * ChildrenString(unsigned Children)
Definition: Dwarf.cpp:38
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:38
unsigned ComputeSize(const AsmPrinter *AP) const
ComputeSize - Calculate the size of the location expression.
Definition: DIE.cpp:506
void Emit(const AsmPrinter *AP) const
Emit - Print the abbreviation using the specified asm printer.
Definition: DIE.cpp:64
const DIE * getUnit() const
Climb up the parent chain to get the compile or type unit DIE this DIE belongs to.
Definition: DIE.cpp:119
value_range values()
Definition: DIE.h:683
uint64_t getTypeSignature() const
Definition: DwarfUnit.h:395
unsigned getPointerSize(unsigned AS=0) const
Layout pointer size FIXME: The defaults need to be removed once all of the backends/clients are updat...
Definition: DataLayout.cpp:593
unsigned getDwarfVersion() const
Returns the Dwarf Version.
Definition: DwarfDebug.h:576
void print(raw_ostream &O) const
Definition: DIE.cpp:480
void dump()
Definition: DIE.cpp:107
bool doesDwarfUseRelocationsAcrossSections() const
Definition: MCAsmInfo.h:527
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of delta value in bytes.
Definition: DIE.cpp:374