LLVM  14.0.0git
DIE.cpp
Go to the documentation of this file.
1 //===--- lib/CodeGen/DIE.cpp - DWARF Info Entries -------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Data structures for DWARF info entries.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "llvm/CodeGen/DIE.h"
14 #include "DwarfCompileUnit.h"
15 #include "DwarfDebug.h"
16 #include "DwarfUnit.h"
17 #include "llvm/ADT/Twine.h"
19 #include "llvm/Config/llvm-config.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 #define DEBUG_TYPE "dwarfdebug"
35 
36 //===----------------------------------------------------------------------===//
37 // DIEAbbrevData Implementation
38 //===----------------------------------------------------------------------===//
39 
40 /// Profile - Used to gather unique data for the abbreviation folding set.
41 ///
43  // Explicitly cast to an integer type for which FoldingSetNodeID has
44  // overloads. Otherwise MSVC 2010 thinks this call is ambiguous.
45  ID.AddInteger(unsigned(Attribute));
46  ID.AddInteger(unsigned(Form));
47  if (Form == dwarf::DW_FORM_implicit_const)
48  ID.AddInteger(Value);
49 }
50 
51 //===----------------------------------------------------------------------===//
52 // DIEAbbrev Implementation
53 //===----------------------------------------------------------------------===//
54 
55 /// Profile - Used to gather unique data for the abbreviation folding set.
56 ///
58  ID.AddInteger(unsigned(Tag));
59  ID.AddInteger(unsigned(Children));
60 
61  // For each attribute description.
62  for (unsigned i = 0, N = Data.size(); i < N; ++i)
63  Data[i].Profile(ID);
64 }
65 
66 /// Emit - Print the abbreviation using the specified asm printer.
67 ///
68 void DIEAbbrev::Emit(const AsmPrinter *AP) const {
69  // Emit its Dwarf tag type.
70  AP->emitULEB128(Tag, dwarf::TagString(Tag).data());
71 
72  // Emit whether it has children DIEs.
73  AP->emitULEB128((unsigned)Children, dwarf::ChildrenString(Children).data());
74 
75  // For each attribute description.
76  for (unsigned i = 0, N = Data.size(); i < N; ++i) {
77  const DIEAbbrevData &AttrData = Data[i];
78 
79  // Emit attribute type.
80  AP->emitULEB128(AttrData.getAttribute(),
82 
83  // Emit form type.
84 #ifndef NDEBUG
85  // Could be an assertion, but this way we can see the failing form code
86  // easily, which helps track down where it came from.
87  if (!dwarf::isValidFormForVersion(AttrData.getForm(),
88  AP->getDwarfVersion())) {
89  LLVM_DEBUG(dbgs() << "Invalid form " << format("0x%x", AttrData.getForm())
90  << " for DWARF version " << AP->getDwarfVersion()
91  << "\n");
92  llvm_unreachable("Invalid form for specified DWARF version");
93  }
94 #endif
95  AP->emitULEB128(AttrData.getForm(),
96  dwarf::FormEncodingString(AttrData.getForm()).data());
97 
98  // Emit value for DW_FORM_implicit_const.
99  if (AttrData.getForm() == dwarf::DW_FORM_implicit_const)
100  AP->emitSLEB128(AttrData.getValue());
101  }
102 
103  // Mark end of abbreviation.
104  AP->emitULEB128(0, "EOM(1)");
105  AP->emitULEB128(0, "EOM(2)");
106 }
107 
110  O << "Abbreviation @"
111  << format("0x%lx", (long)(intptr_t)this)
112  << " "
113  << dwarf::TagString(Tag)
114  << " "
115  << dwarf::ChildrenString(Children)
116  << '\n';
117 
118  for (unsigned i = 0, N = Data.size(); i < N; ++i) {
119  O << " "
120  << dwarf::AttributeString(Data[i].getAttribute())
121  << " "
122  << dwarf::FormEncodingString(Data[i].getForm());
123 
124  if (Data[i].getForm() == dwarf::DW_FORM_implicit_const)
125  O << " " << Data[i].getValue();
126 
127  O << '\n';
128  }
129 }
130 
131 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
133  print(dbgs());
134 }
135 #endif
136 
137 //===----------------------------------------------------------------------===//
138 // DIEAbbrevSet Implementation
139 //===----------------------------------------------------------------------===//
140 
142  for (DIEAbbrev *Abbrev : Abbreviations)
143  Abbrev->~DIEAbbrev();
144 }
145 
147 
149  DIEAbbrev Abbrev = Die.generateAbbrev();
150  Abbrev.Profile(ID);
151 
152  void *InsertPos;
153  if (DIEAbbrev *Existing =
154  AbbreviationsSet.FindNodeOrInsertPos(ID, InsertPos)) {
155  Die.setAbbrevNumber(Existing->getNumber());
156  return *Existing;
157  }
158 
159  // Move the abbreviation to the heap and assign a number.
160  DIEAbbrev *New = new (Alloc) DIEAbbrev(std::move(Abbrev));
161  Abbreviations.push_back(New);
162  New->setNumber(Abbreviations.size());
163  Die.setAbbrevNumber(Abbreviations.size());
164 
165  // Store it for lookup.
166  AbbreviationsSet.InsertNode(New, InsertPos);
167  return *New;
168 }
169 
171  if (!Abbreviations.empty()) {
172  // Start the debug abbrev section.
173  AP->OutStreamer->SwitchSection(Section);
174  AP->emitDwarfAbbrevs(Abbreviations);
175  }
176 }
177 
178 //===----------------------------------------------------------------------===//
179 // DIE Implementation
180 //===----------------------------------------------------------------------===//
181 
182 DIE *DIE::getParent() const {
183  return Owner.dyn_cast<DIE*>();
184 }
185 
187  DIEAbbrev Abbrev(Tag, hasChildren());
188  for (const DIEValue &V : values())
189  if (V.getForm() == dwarf::DW_FORM_implicit_const)
190  Abbrev.AddImplicitConstAttribute(V.getAttribute(),
191  V.getDIEInteger().getValue());
192  else
193  Abbrev.AddAttribute(V.getAttribute(), V.getForm());
194  return Abbrev;
195 }
196 
198  const DIEUnit *Unit = getUnit();
199  assert(Unit && "DIE must be owned by a DIEUnit to get its absolute offset");
200  return Unit->getDebugSectionOffset() + getOffset();
201 }
202 
203 const DIE *DIE::getUnitDie() const {
204  const DIE *p = this;
205  while (p) {
206  if (p->getTag() == dwarf::DW_TAG_compile_unit ||
207  p->getTag() == dwarf::DW_TAG_type_unit)
208  return p;
209  p = p->getParent();
210  }
211  return nullptr;
212 }
213 
215  const DIE *UnitDie = getUnitDie();
216  if (UnitDie)
217  return UnitDie->Owner.dyn_cast<DIEUnit*>();
218  return nullptr;
219 }
220 
222  // Iterate through all the attributes until we find the one we're
223  // looking for, if we can't find it return NULL.
224  for (const auto &V : values())
225  if (V.getAttribute() == Attribute)
226  return V;
227  return DIEValue();
228 }
229 
231 static void printValues(raw_ostream &O, const DIEValueList &Values,
232  StringRef Type, unsigned Size, unsigned IndentCount) {
233  O << Type << ": Size: " << Size << "\n";
234 
235  unsigned I = 0;
236  const std::string Indent(IndentCount, ' ');
237  for (const auto &V : Values.values()) {
238  O << Indent;
239  O << "Blk[" << I++ << "]";
240  O << " " << dwarf::FormEncodingString(V.getForm()) << " ";
241  V.print(O);
242  O << "\n";
243  }
244 }
245 
247 void DIE::print(raw_ostream &O, unsigned IndentCount) const {
248  const std::string Indent(IndentCount, ' ');
249  O << Indent << "Die: " << format("0x%lx", (long)(intptr_t) this)
250  << ", Offset: " << Offset << ", Size: " << Size << "\n";
251 
252  O << Indent << dwarf::TagString(getTag()) << " "
253  << dwarf::ChildrenString(hasChildren()) << "\n";
254 
255  IndentCount += 2;
256  for (const auto &V : values()) {
257  O << Indent;
258  O << dwarf::AttributeString(V.getAttribute());
259  O << " " << dwarf::FormEncodingString(V.getForm()) << " ";
260  V.print(O);
261  O << "\n";
262  }
263  IndentCount -= 2;
264 
265  for (const auto &Child : children())
266  Child.print(O, IndentCount + 4);
267 
268  O << "\n";
269 }
270 
271 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
273  print(dbgs());
274 }
275 #endif
276 
278  DIEAbbrevSet &AbbrevSet,
279  unsigned CUOffset) {
280  // Unique the abbreviation and fill in the abbreviation number so this DIE
281  // can be emitted.
282  const DIEAbbrev &Abbrev = AbbrevSet.uniqueAbbreviation(*this);
283 
284  // Set compile/type unit relative offset of this DIE.
285  setOffset(CUOffset);
286 
287  // Add the byte size of the abbreviation code.
288  CUOffset += getULEB128Size(getAbbrevNumber());
289 
290  // Add the byte size of all the DIE attribute values.
291  for (const auto &V : values())
292  CUOffset += V.SizeOf(AP);
293 
294  // Let the children compute their offsets and abbreviation numbers.
295  if (hasChildren()) {
296  (void)Abbrev;
297  assert(Abbrev.hasChildren() && "Children flag not set");
298 
299  for (auto &Child : children())
300  CUOffset = Child.computeOffsetsAndAbbrevs(AP, AbbrevSet, CUOffset);
301 
302  // Each child chain is terminated with a zero byte, adjust the offset.
303  CUOffset += sizeof(int8_t);
304  }
305 
306  // Compute the byte size of this DIE and all of its children correctly. This
307  // is needed so that top level DIE can help the compile unit set its length
308  // correctly.
309  setSize(CUOffset - getOffset());
310  return CUOffset;
311 }
312 
313 //===----------------------------------------------------------------------===//
314 // DIEUnit Implementation
315 //===----------------------------------------------------------------------===//
317  : Die(UnitTag), Section(nullptr), Offset(0) {
318  Die.Owner = this;
319  assert((UnitTag == dwarf::DW_TAG_compile_unit ||
320  UnitTag == dwarf::DW_TAG_skeleton_unit ||
321  UnitTag == dwarf::DW_TAG_type_unit ||
322  UnitTag == dwarf::DW_TAG_partial_unit) &&
323  "expected a unit TAG");
324 }
325 
326 void DIEValue::emitValue(const AsmPrinter *AP) const {
327  switch (Ty) {
328  case isNone:
329  llvm_unreachable("Expected valid DIEValue");
330 #define HANDLE_DIEVALUE(T) \
331  case is##T: \
332  getDIE##T().emitValue(AP, Form); \
333  break;
334 #include "llvm/CodeGen/DIEValue.def"
335  }
336 }
337 
338 unsigned DIEValue::SizeOf(const AsmPrinter *AP) const {
339  switch (Ty) {
340  case isNone:
341  llvm_unreachable("Expected valid DIEValue");
342 #define HANDLE_DIEVALUE(T) \
343  case is##T: \
344  return getDIE##T().SizeOf(AP, Form);
345 #include "llvm/CodeGen/DIEValue.def"
346  }
347  llvm_unreachable("Unknown DIE kind");
348 }
349 
352  switch (Ty) {
353  case isNone:
354  llvm_unreachable("Expected valid DIEValue");
355 #define HANDLE_DIEVALUE(T) \
356  case is##T: \
357  getDIE##T().print(O); \
358  break;
359 #include "llvm/CodeGen/DIEValue.def"
360  }
361 }
362 
363 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
365  print(dbgs());
366 }
367 #endif
368 
369 //===----------------------------------------------------------------------===//
370 // DIEInteger Implementation
371 //===----------------------------------------------------------------------===//
372 
373 /// EmitValue - Emit integer of appropriate size.
374 ///
376  switch (Form) {
377  case dwarf::DW_FORM_implicit_const:
378  case dwarf::DW_FORM_flag_present:
379  // Emit something to keep the lines and comments in sync.
380  // FIXME: Is there a better way to do this?
381  Asm->OutStreamer->AddBlankLine();
382  return;
383  case dwarf::DW_FORM_flag:
384  case dwarf::DW_FORM_ref1:
385  case dwarf::DW_FORM_data1:
386  case dwarf::DW_FORM_strx1:
387  case dwarf::DW_FORM_addrx1:
388  case dwarf::DW_FORM_ref2:
389  case dwarf::DW_FORM_data2:
390  case dwarf::DW_FORM_strx2:
391  case dwarf::DW_FORM_addrx2:
392  case dwarf::DW_FORM_strx3:
393  case dwarf::DW_FORM_strp:
394  case dwarf::DW_FORM_ref4:
395  case dwarf::DW_FORM_data4:
396  case dwarf::DW_FORM_ref_sup4:
397  case dwarf::DW_FORM_strx4:
398  case dwarf::DW_FORM_addrx4:
399  case dwarf::DW_FORM_ref8:
400  case dwarf::DW_FORM_ref_sig8:
401  case dwarf::DW_FORM_data8:
402  case dwarf::DW_FORM_ref_sup8:
403  case dwarf::DW_FORM_GNU_ref_alt:
404  case dwarf::DW_FORM_GNU_strp_alt:
405  case dwarf::DW_FORM_line_strp:
406  case dwarf::DW_FORM_sec_offset:
407  case dwarf::DW_FORM_strp_sup:
408  case dwarf::DW_FORM_addr:
409  case dwarf::DW_FORM_ref_addr:
410  Asm->OutStreamer->emitIntValue(Integer, SizeOf(Asm, Form));
411  return;
412  case dwarf::DW_FORM_GNU_str_index:
413  case dwarf::DW_FORM_GNU_addr_index:
414  case dwarf::DW_FORM_ref_udata:
415  case dwarf::DW_FORM_strx:
416  case dwarf::DW_FORM_addrx:
417  case dwarf::DW_FORM_rnglistx:
418  case dwarf::DW_FORM_udata:
419  Asm->emitULEB128(Integer);
420  return;
421  case dwarf::DW_FORM_sdata:
422  Asm->emitSLEB128(Integer);
423  return;
424  default: llvm_unreachable("DIE Value form not supported yet");
425  }
426 }
427 
428 /// SizeOf - Determine size of integer value in bytes.
429 ///
430 unsigned DIEInteger::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
431  assert(AP && "AsmPrinter is required to set FormParams");
432  dwarf::FormParams Params = {AP->getDwarfVersion(),
433  uint8_t(AP->getPointerSize()),
434  AP->OutStreamer->getContext().getDwarfFormat()};
435 
436  if (Optional<uint8_t> FixedSize = dwarf::getFixedFormByteSize(Form, Params))
437  return *FixedSize;
438 
439  switch (Form) {
440  case dwarf::DW_FORM_GNU_str_index:
441  case dwarf::DW_FORM_GNU_addr_index:
442  case dwarf::DW_FORM_ref_udata:
443  case dwarf::DW_FORM_strx:
444  case dwarf::DW_FORM_addrx:
445  case dwarf::DW_FORM_rnglistx:
446  case dwarf::DW_FORM_udata:
447  return getULEB128Size(Integer);
448  case dwarf::DW_FORM_sdata:
449  return getSLEB128Size(Integer);
450  default: llvm_unreachable("DIE Value form not supported yet");
451  }
452 }
453 
456  O << "Int: " << (int64_t)Integer << " 0x";
457  O.write_hex(Integer);
458 }
459 
460 //===----------------------------------------------------------------------===//
461 // DIEExpr Implementation
462 //===----------------------------------------------------------------------===//
463 
464 /// EmitValue - Emit expression value.
465 ///
467  AP->emitDebugValue(Expr, SizeOf(AP, Form));
468 }
469 
470 /// SizeOf - Determine size of expression value in bytes.
471 ///
472 unsigned DIEExpr::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
473  switch (Form) {
474  case dwarf::DW_FORM_data4:
475  return 4;
476  case dwarf::DW_FORM_data8:
477  return 8;
478  case dwarf::DW_FORM_sec_offset:
479  return AP->getDwarfOffsetByteSize();
480  default:
481  llvm_unreachable("DIE Value form not supported yet");
482  }
483 }
484 
486 void DIEExpr::print(raw_ostream &O) const { O << "Expr: " << *Expr; }
487 
488 //===----------------------------------------------------------------------===//
489 // DIELabel Implementation
490 //===----------------------------------------------------------------------===//
491 
492 /// EmitValue - Emit label value.
493 ///
495  bool IsSectionRelative = Form != dwarf::DW_FORM_addr;
496  AP->emitLabelReference(Label, SizeOf(AP, Form), IsSectionRelative);
497 }
498 
499 /// SizeOf - Determine size of label value in bytes.
500 ///
501 unsigned DIELabel::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
502  switch (Form) {
503  case dwarf::DW_FORM_data4:
504  return 4;
505  case dwarf::DW_FORM_data8:
506  return 8;
507  case dwarf::DW_FORM_sec_offset:
508  case dwarf::DW_FORM_strp:
509  return AP->getDwarfOffsetByteSize();
510  case dwarf::DW_FORM_addr:
511  return AP->MAI->getCodePointerSize();
512  default:
513  llvm_unreachable("DIE Value form not supported yet");
514  }
515 }
516 
518 void DIELabel::print(raw_ostream &O) const { O << "Lbl: " << Label->getName(); }
519 
520 //===----------------------------------------------------------------------===//
521 // DIEBaseTypeRef Implementation
522 //===----------------------------------------------------------------------===//
523 
525  uint64_t Offset = CU->ExprRefedBaseTypes[Index].Die->getOffset();
526  assert(Offset < (1ULL << (ULEB128PadSize * 7)) && "Offset wont fit");
527  AP->emitULEB128(Offset, nullptr, ULEB128PadSize);
528 }
529 
530 unsigned DIEBaseTypeRef::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
531  return ULEB128PadSize;
532 }
533 
535 void DIEBaseTypeRef::print(raw_ostream &O) const { O << "BaseTypeRef: " << Index; }
536 
537 //===----------------------------------------------------------------------===//
538 // DIEDelta Implementation
539 //===----------------------------------------------------------------------===//
540 
541 /// EmitValue - Emit delta value.
542 ///
544  AP->emitLabelDifference(LabelHi, LabelLo, SizeOf(AP, Form));
545 }
546 
547 /// SizeOf - Determine size of delta value in bytes.
548 ///
549 unsigned DIEDelta::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
550  switch (Form) {
551  case dwarf::DW_FORM_data4:
552  return 4;
553  case dwarf::DW_FORM_data8:
554  return 8;
555  case dwarf::DW_FORM_sec_offset:
556  return AP->getDwarfOffsetByteSize();
557  default:
558  llvm_unreachable("DIE Value form not supported yet");
559  }
560 }
561 
564  O << "Del: " << LabelHi->getName() << "-" << LabelLo->getName();
565 }
566 
567 //===----------------------------------------------------------------------===//
568 // DIEString Implementation
569 //===----------------------------------------------------------------------===//
570 
571 /// EmitValue - Emit string value.
572 ///
574  // Index of string in symbol table.
575  switch (Form) {
576  case dwarf::DW_FORM_GNU_str_index:
577  case dwarf::DW_FORM_strx:
578  case dwarf::DW_FORM_strx1:
579  case dwarf::DW_FORM_strx2:
580  case dwarf::DW_FORM_strx3:
581  case dwarf::DW_FORM_strx4:
582  DIEInteger(S.getIndex()).emitValue(AP, Form);
583  return;
584  case dwarf::DW_FORM_strp:
586  DIELabel(S.getSymbol()).emitValue(AP, Form);
587  else
589  return;
590  default:
591  llvm_unreachable("Expected valid string form");
592  }
593 }
594 
595 /// SizeOf - Determine size of delta value in bytes.
596 ///
597 unsigned DIEString::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
598  // Index of string in symbol table.
599  switch (Form) {
600  case dwarf::DW_FORM_GNU_str_index:
601  case dwarf::DW_FORM_strx:
602  case dwarf::DW_FORM_strx1:
603  case dwarf::DW_FORM_strx2:
604  case dwarf::DW_FORM_strx3:
605  case dwarf::DW_FORM_strx4:
606  return DIEInteger(S.getIndex()).SizeOf(AP, Form);
607  case dwarf::DW_FORM_strp:
609  return DIELabel(S.getSymbol()).SizeOf(AP, Form);
610  return DIEInteger(S.getOffset()).SizeOf(AP, Form);
611  default:
612  llvm_unreachable("Expected valid string form");
613  }
614 }
615 
618  O << "String: " << S.getString();
619 }
620 
621 //===----------------------------------------------------------------------===//
622 // DIEInlineString Implementation
623 //===----------------------------------------------------------------------===//
625  if (Form == dwarf::DW_FORM_string) {
626  AP->OutStreamer->emitBytes(S);
627  AP->emitInt8(0);
628  return;
629  }
630  llvm_unreachable("Expected valid string form");
631 }
632 
634  // Emit string bytes + NULL byte.
635  return S.size() + 1;
636 }
637 
640  O << "InlineString: " << S;
641 }
642 
643 //===----------------------------------------------------------------------===//
644 // DIEEntry Implementation
645 //===----------------------------------------------------------------------===//
646 
647 /// EmitValue - Emit debug information entry offset.
648 ///
650 
651  switch (Form) {
652  case dwarf::DW_FORM_ref1:
653  case dwarf::DW_FORM_ref2:
654  case dwarf::DW_FORM_ref4:
655  case dwarf::DW_FORM_ref8:
656  AP->OutStreamer->emitIntValue(Entry->getOffset(), SizeOf(AP, Form));
657  return;
658 
659  case dwarf::DW_FORM_ref_udata:
660  AP->emitULEB128(Entry->getOffset());
661  return;
662 
663  case dwarf::DW_FORM_ref_addr: {
664  // Get the absolute offset for this DIE within the debug info/types section.
666  if (const MCSymbol *SectionSym =
668  AP->emitLabelPlusOffset(SectionSym, Addr, SizeOf(AP, Form), true);
669  return;
670  }
671 
672  AP->OutStreamer->emitIntValue(Addr, SizeOf(AP, Form));
673  return;
674  }
675  default:
676  llvm_unreachable("Improper form for DIE reference");
677  }
678 }
679 
680 unsigned DIEEntry::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
681  switch (Form) {
682  case dwarf::DW_FORM_ref1:
683  return 1;
684  case dwarf::DW_FORM_ref2:
685  return 2;
686  case dwarf::DW_FORM_ref4:
687  return 4;
688  case dwarf::DW_FORM_ref8:
689  return 8;
690  case dwarf::DW_FORM_ref_udata:
691  return getULEB128Size(Entry->getOffset());
692  case dwarf::DW_FORM_ref_addr:
693  if (AP->getDwarfVersion() == 2)
694  return AP->MAI->getCodePointerSize();
695  switch (AP->OutStreamer->getContext().getDwarfFormat()) {
696  case dwarf::DWARF32:
697  return 4;
698  case dwarf::DWARF64:
699  return 8;
700  }
701  llvm_unreachable("Invalid DWARF format");
702 
703  default:
704  llvm_unreachable("Improper form for DIE reference");
705  }
706 }
707 
710  O << format("Die: 0x%lx", (long)(intptr_t)&Entry);
711 }
712 
713 //===----------------------------------------------------------------------===//
714 // DIELoc Implementation
715 //===----------------------------------------------------------------------===//
716 
717 /// ComputeSize - calculate the size of the location expression.
718 ///
719 unsigned DIELoc::ComputeSize(const AsmPrinter *AP) const {
720  if (!Size) {
721  for (const auto &V : values())
722  Size += V.SizeOf(AP);
723  }
724 
725  return Size;
726 }
727 
728 /// EmitValue - Emit location data.
729 ///
731  switch (Form) {
732  default: llvm_unreachable("Improper form for block");
733  case dwarf::DW_FORM_block1: Asm->emitInt8(Size); break;
734  case dwarf::DW_FORM_block2: Asm->emitInt16(Size); break;
735  case dwarf::DW_FORM_block4: Asm->emitInt32(Size); break;
736  case dwarf::DW_FORM_block:
737  case dwarf::DW_FORM_exprloc:
738  Asm->emitULEB128(Size);
739  break;
740  }
741 
742  for (const auto &V : values())
743  V.emitValue(Asm);
744 }
745 
746 /// SizeOf - Determine size of location data in bytes.
747 ///
748 unsigned DIELoc::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
749  switch (Form) {
750  case dwarf::DW_FORM_block1: return Size + sizeof(int8_t);
751  case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);
752  case dwarf::DW_FORM_block4: return Size + sizeof(int32_t);
753  case dwarf::DW_FORM_block:
754  case dwarf::DW_FORM_exprloc:
755  return Size + getULEB128Size(Size);
756  default: llvm_unreachable("Improper form for block");
757  }
758 }
759 
762  printValues(O, *this, "ExprLoc", Size, 5);
763 }
764 
765 //===----------------------------------------------------------------------===//
766 // DIEBlock Implementation
767 //===----------------------------------------------------------------------===//
768 
769 /// ComputeSize - calculate the size of the block.
770 ///
771 unsigned DIEBlock::ComputeSize(const AsmPrinter *AP) const {
772  if (!Size) {
773  for (const auto &V : values())
774  Size += V.SizeOf(AP);
775  }
776 
777  return Size;
778 }
779 
780 /// EmitValue - Emit block data.
781 ///
783  switch (Form) {
784  default: llvm_unreachable("Improper form for block");
785  case dwarf::DW_FORM_block1: Asm->emitInt8(Size); break;
786  case dwarf::DW_FORM_block2: Asm->emitInt16(Size); break;
787  case dwarf::DW_FORM_block4: Asm->emitInt32(Size); break;
788  case dwarf::DW_FORM_exprloc:
789  case dwarf::DW_FORM_block:
790  Asm->emitULEB128(Size);
791  break;
792  case dwarf::DW_FORM_string: break;
793  case dwarf::DW_FORM_data16: break;
794  }
795 
796  for (const auto &V : values())
797  V.emitValue(Asm);
798 }
799 
800 /// SizeOf - Determine size of block data in bytes.
801 ///
802 unsigned DIEBlock::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
803  switch (Form) {
804  case dwarf::DW_FORM_block1: return Size + sizeof(int8_t);
805  case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);
806  case dwarf::DW_FORM_block4: return Size + sizeof(int32_t);
807  case dwarf::DW_FORM_exprloc:
808  case dwarf::DW_FORM_block: return Size + getULEB128Size(Size);
809  case dwarf::DW_FORM_data16: return 16;
810  default: llvm_unreachable("Improper form for block");
811  }
812 }
813 
816  printValues(O, *this, "Blk", Size, 5);
817 }
818 
819 //===----------------------------------------------------------------------===//
820 // DIELocList Implementation
821 //===----------------------------------------------------------------------===//
822 
823 unsigned DIELocList::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
824  switch (Form) {
825  case dwarf::DW_FORM_loclistx:
826  return getULEB128Size(Index);
827  case dwarf::DW_FORM_data4:
828  assert(!AP->isDwarf64() &&
829  "DW_FORM_data4 is not suitable to emit a pointer to a location list "
830  "in the 64-bit DWARF format");
831  return 4;
832  case dwarf::DW_FORM_data8:
833  assert(AP->isDwarf64() &&
834  "DW_FORM_data8 is not suitable to emit a pointer to a location list "
835  "in the 32-bit DWARF format");
836  return 8;
837  case dwarf::DW_FORM_sec_offset:
838  return AP->getDwarfOffsetByteSize();
839  default:
840  llvm_unreachable("DIE Value form not supported yet");
841  }
842 }
843 
844 /// EmitValue - Emit label value.
845 ///
847  if (Form == dwarf::DW_FORM_loclistx) {
848  AP->emitULEB128(Index);
849  return;
850  }
851  DwarfDebug *DD = AP->getDwarfDebug();
852  MCSymbol *Label = DD->getDebugLocs().getList(Index).Label;
853  AP->emitDwarfSymbolReference(Label, /*ForceOffset*/ DD->useSplitDwarf());
854 }
855 
857 void DIELocList::print(raw_ostream &O) const { O << "LocList: " << Index; }
858 
859 //===----------------------------------------------------------------------===//
860 // DIEAddrOffset Implementation
861 //===----------------------------------------------------------------------===//
862 
863 unsigned DIEAddrOffset::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
864  return Addr.SizeOf(AP, dwarf::DW_FORM_addrx) +
865  Offset.SizeOf(AP, dwarf::DW_FORM_data4);
866 }
867 
868 /// EmitValue - Emit label value.
869 ///
871  Addr.emitValue(AP, dwarf::DW_FORM_addrx);
872  Offset.emitValue(AP, dwarf::DW_FORM_data4);
873 }
874 
877  O << "AddrOffset: ";
878  Addr.print(O);
879  O << " + ";
880  Offset.print(O);
881 }
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
i
i
Definition: README.txt:29
llvm::DIEAbbrevData::getForm
dwarf::Form getForm() const
Definition: DIE.h:68
AsmPrinter.h
llvm::DIEAbbrev::print
void print(raw_ostream &O) const
Definition: DIE.cpp:109
llvm::DIE::setOffset
void setOffset(unsigned O)
Definition: DIE.h:842
llvm::DIEValue::print
void print(raw_ostream &O) const
Definition: DIE.cpp:351
llvm::AsmPrinter::emitLabelDifference
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...
Definition: AsmPrinter.cpp:2417
llvm::DIELabel::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit label value.
Definition: DIE.cpp:494
LLVM_DUMP_METHOD
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition: Compiler.h:491
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::DebugLocStream::List::Label
MCSymbol * Label
Definition: DebugLocStream.h:35
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
intptr_t
llvm::DIEDelta::SizeOf
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of delta value in bytes.
Definition: DIE.cpp:549
llvm::DebugLocStream::getList
const List & getList(size_t LI) const
Definition: DebugLocStream.h:61
llvm::AsmPrinter::emitULEB128
void emitULEB128(uint64_t Value, const char *Desc=nullptr, unsigned PadTo=0) const
Emit the specified unsigned leb128 value.
Definition: AsmPrinterDwarf.cpp:47
llvm::AsmPrinter::getDwarfDebug
DwarfDebug * getDwarfDebug()
Definition: AsmPrinter.h:221
llvm::Attribute
Definition: Attributes.h:52
llvm::DIEAbbrev::Profile
void Profile(FoldingSetNodeID &ID) const
Used to gather unique data for the abbreviation folding set.
Definition: DIE.cpp:57
llvm::DIEEntry::SizeOf
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
Definition: DIE.cpp:680
llvm::AsmPrinter::MAI
const MCAsmInfo * MAI
Target Asm Printer information.
Definition: AsmPrinter.h:88
llvm::DIEValue
Definition: DIE.h:369
llvm::DIEUnit
Represents a compile or type unit.
Definition: DIE.h:872
llvm::DIE::print
void print(raw_ostream &O, unsigned IndentCount=0) const
Definition: DIE.cpp:247
llvm::DIEAbbrevSet::uniqueAbbreviation
DIEAbbrev & uniqueAbbreviation(DIE &Die)
Generate the abbreviation declaration for a DIE and return a pointer to the generated abbreviation.
Definition: DIE.cpp:146
llvm::dwarf::Form
Form
Definition: Dwarf.h:131
llvm::DIEAddrOffset::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit label value.
Definition: DIE.cpp:870
ErrorHandling.h
llvm::AsmPrinter::emitSLEB128
void emitSLEB128(int64_t Value, const char *Desc=nullptr) const
Emit the specified signed leb128 value.
Definition: AsmPrinterDwarf.cpp:40
llvm::DIEUnit::getCrossSectionRelativeBaseAddress
virtual const MCSymbol * getCrossSectionRelativeBaseAddress() const
Definition: DIE.h:901
llvm::DIE::getUnitDie
const DIE * getUnitDie() const
Climb up the parent chain to get the compile unit or type unit DIE that this DIE belongs to.
Definition: DIE.cpp:203
llvm::getULEB128Size
unsigned getULEB128Size(uint64_t Value)
Utility function to get the size of the ULEB128-encoded value.
Definition: LEB128.cpp:19
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::AsmPrinter::getDwarfOffsetByteSize
unsigned int getDwarfOffsetByteSize() const
Returns 4 for DWARF32 and 8 for DWARF64.
Definition: AsmPrinter.cpp:3613
llvm::DIEAbbrevData::getAttribute
dwarf::Attribute getAttribute() const
Accessors.
Definition: DIE.h:67
llvm::MCAsmInfo::getCodePointerSize
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
Definition: MCAsmInfo.h:536
llvm::Optional< uint8_t >
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::DIEAbbrev::AddAttribute
void AddAttribute(dwarf::Attribute Attribute, dwarf::Form Form)
Adds another set of attribute information to the abbreviation.
Definition: DIE.h:109
llvm::DIE
A structured debug information entry.
Definition: DIE.h:739
llvm::AsmPrinter::emitLabelReference
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:596
llvm::DIEExpr::SizeOf
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of expression value in bytes.
Definition: DIE.cpp:472
llvm::DIE::getTag
dwarf::Tag getTag() const
Definition: DIE.h:775
llvm::dwarf::Tag
Tag
Definition: Dwarf.h:104
llvm::DIELabel::SizeOf
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of label value in bytes.
Definition: DIE.cpp:501
llvm::DIEEntry::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit debug information entry offset.
Definition: DIE.cpp:649
Format.h
llvm::DIEDelta::print
void print(raw_ostream &O) const
Definition: DIE.cpp:563
p
the resulting code requires compare and branches when and if * p
Definition: README.txt:396
LLVM_DEBUG
#define LLVM_DEBUG(X)
Definition: Debug.h:101
llvm::DIELoc::SizeOf
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of location data in bytes.
Definition: DIE.cpp:748
llvm::dwarf::Attribute
Attribute
Attributes.
Definition: Dwarf.h:124
llvm::DIEAbbrev::AddImplicitConstAttribute
void AddImplicitConstAttribute(dwarf::Attribute Attribute, int64_t Value)
Adds attribute with DW_FORM_implicit_const value.
Definition: DIE.h:114
llvm::DIELocList::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit label value.
Definition: DIE.cpp:846
llvm::DIEValueList::values
value_range values()
Definition: DIE.h:727
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:78
llvm::DIEValue::dump
void dump() const
Definition: DIE.cpp:364
FormattedStream.h
llvm::DIEAbbrev
Dwarf abbreviation, describes the organization of a debug information object.
Definition: DIE.h:79
llvm::DIEExpr::print
void print(raw_ostream &O) const
Definition: DIE.cpp:486
llvm::DIELoc::ComputeSize
unsigned ComputeSize(const AsmPrinter *AP) const
ComputeSize - Calculate the size of the location expression.
Definition: DIE.cpp:719
MD5.h
llvm::AsmPrinter::OutStreamer
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
Definition: AsmPrinter.h:97
llvm::DIEInteger::SizeOf
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of integer value in bytes.
Definition: DIE.cpp:430
Twine.h
MCContext.h
llvm::DIEAbbrev::Emit
void Emit(const AsmPrinter *AP) const
Print the abbreviation using the specified asm printer.
Definition: DIE.cpp:68
MCSymbol.h
llvm::DIEBaseTypeRef::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit base type reference.
Definition: DIE.cpp:524
llvm::DIEAddrOffset::SizeOf
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
Definition: DIE.cpp:863
llvm::DIEInlineString::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
Definition: DIE.cpp:624
llvm::DIE::dump
void dump() const
Definition: DIE.cpp:272
llvm::DIEAbbrevData
Dwarf abbreviation data, describes one attribute of a Dwarf abbreviation.
Definition: DIE.h:49
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::DIEAbbrevSet::~DIEAbbrevSet
~DIEAbbrevSet()
Definition: DIE.cpp:141
llvm::DIEInteger
An integer value DIE.
Definition: DIE.h:163
llvm::MCSymbol::getName
StringRef getName() const
getName - Get the symbol name.
Definition: MCSymbol.h:198
llvm::DIEAbbrevSet::Emit
void Emit(const AsmPrinter *AP, MCSection *Section) const
Print all abbreviations using the specified asm printer.
Definition: DIE.cpp:170
DwarfDebug.h
llvm::AsmPrinter::emitDwarfAbbrevs
void emitDwarfAbbrevs(const T &Abbrevs) const
Emit Dwarf abbreviation table.
Definition: AsmPrinter.h:683
llvm::AsmPrinter::emitDwarfSymbolReference
void emitDwarfSymbolReference(const MCSymbol *Label, bool ForceOffset=false) const
Emit a reference to a symbol for use in dwarf.
Definition: AsmPrinterDwarf.cpp:158
llvm::AsmPrinter::emitInt8
void emitInt8(int Value) const
Emit a byte directive and value.
Definition: AsmPrinter.cpp:2401
llvm::DIEAbbrevData::Profile
void Profile(FoldingSetNodeID &ID) const
Used to gather unique data for the abbreviation folding set.
Definition: DIE.cpp:42
llvm::DIEBaseTypeRef::print
void print(raw_ostream &O) const
Definition: DIE.cpp:535
llvm::DIE::getDebugSectionOffset
uint64_t getDebugSectionOffset() const
Get the absolute offset within the .debug_info or .debug_types section for this DIE.
Definition: DIE.cpp:197
llvm::DwarfStringPoolEntryRef::getString
StringRef getString() const
Definition: DwarfStringPoolEntry.h:57
llvm::DIE::setSize
void setSize(unsigned S)
Definition: DIE.h:843
llvm::dwarf::FormEncodingString
StringRef FormEncodingString(unsigned Encoding)
Definition: Dwarf.cpp:105
llvm::AsmPrinter::getPointerSize
unsigned getPointerSize() const
Return the pointer size from the TargetMachine.
Definition: AsmPrinter.cpp:234
DIE.h
llvm::DIELocList::print
void print(raw_ostream &O) const
Definition: DIE.cpp:857
llvm::DIEExpr::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit expression value.
Definition: DIE.cpp:466
llvm::DIELoc::emitValue
void emitValue(const AsmPrinter *Asm, dwarf::Form Form) const
EmitValue - Emit location data.
Definition: DIE.cpp:730
llvm::DIE::generateAbbrev
DIEAbbrev generateAbbrev() const
Generate the abbreviation for this DIE.
Definition: DIE.cpp:186
llvm::DIEUnit::DIEUnit
DIEUnit(dwarf::Tag UnitTag)
Definition: DIE.cpp:316
llvm::DIEString::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit string value.
Definition: DIE.cpp:573
llvm::DIEInlineString::SizeOf
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
Definition: DIE.cpp:633
llvm::DIEDelta::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit delta value.
Definition: DIE.cpp:543
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:192
llvm::DIEBlock::emitValue
void emitValue(const AsmPrinter *Asm, dwarf::Form Form) const
EmitValue - Emit block data.
Definition: DIE.cpp:782
llvm::DwarfDebug
Collects and handles dwarf debug information.
Definition: DwarfDebug.h:295
llvm::AsmPrinter::emitLabelPlusOffset
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...
Definition: AsmPrinter.cpp:2425
uint64_t
Addr
uint64_t Addr
Definition: ELFObjHandler.cpp:80
LEB128.h
llvm::DIEBaseTypeRef::SizeOf
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of the base type reference in bytes.
Definition: DIE.cpp:530
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::DwarfDebug::useSplitDwarf
bool useSplitDwarf() const
Returns whether or not to change the current debug info for the split dwarf proposal support.
Definition: DwarfDebug.h:749
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::DIE::getParent
DIE * getParent() const
Definition: DIE.cpp:182
llvm::DwarfStringPoolEntryRef::getOffset
uint64_t getOffset() const
Definition: DwarfStringPoolEntry.h:50
llvm::dwarf::FormParams
A helper struct providing information about the byte size of DW_FORM values that vary in size dependi...
Definition: Dwarf.h:648
llvm::DIEBlock::ComputeSize
unsigned ComputeSize(const AsmPrinter *AP) const
ComputeSize - Calculate the size of the location expression.
Definition: DIE.cpp:771
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::DIEInteger::emitValue
void emitValue(const AsmPrinter *Asm, dwarf::Form Form) const
EmitValue - Emit integer of appropriate size.
Definition: DIE.cpp:375
llvm::DIEValue::emitValue
void emitValue(const AsmPrinter *AP) const
Emit value via the Dwarf writer.
Definition: DIE.cpp:326
llvm::DIEEntry::print
void print(raw_ostream &O) const
Definition: DIE.cpp:709
llvm::AsmPrinter::emitDebugValue
virtual void emitDebugValue(const MCExpr *Value, unsigned Size) const
Emit the directive and value for debug thread local expression.
Definition: AsmPrinter.cpp:706
llvm::DIEAbbrev::hasChildren
bool hasChildren() const
Definition: DIE.h:102
printValues
static LLVM_DUMP_METHOD void printValues(raw_ostream &O, const DIEValueList &Values, StringRef Type, unsigned Size, unsigned IndentCount)
Definition: DIE.cpp:231
llvm::DwarfDebug::getDebugLocs
const DebugLocStream & getDebugLocs() const
Returns the entries for the .debug_loc section.
Definition: DwarfDebug.h:785
MCAsmInfo.h
DataLayout.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
llvm::DIE::children
child_range children()
Definition: DIE.h:787
llvm::MCSection
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:39
llvm::FoldingSetNodeID
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
Definition: FoldingSet.h:313
llvm::MCAsmInfo::doesDwarfUseRelocationsAcrossSections
bool doesDwarfUseRelocationsAcrossSections() const
Definition: MCAsmInfo.h:784
DwarfCompileUnit.h
llvm::format
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition: Format.h:124
llvm::dwarf::ChildrenString
StringRef ChildrenString(unsigned Children)
Definition: Dwarf.cpp:62
llvm::DIEInteger::print
void print(raw_ostream &O) const
Definition: DIE.cpp:455
llvm::getSLEB128Size
unsigned getSLEB128Size(int64_t Value)
Utility function to get the size of the SLEB128-encoded value.
Definition: LEB128.cpp:29
llvm::dwarf::getFixedFormByteSize
Optional< uint8_t > getFixedFormByteSize(dwarf::Form Form, FormParams Params)
Get the fixed byte size for a given form.
Definition: Dwarf.cpp:694
llvm::DIELabel::print
void print(raw_ostream &O) const
Definition: DIE.cpp:518
llvm::DIE::getUnit
DIEUnit * getUnit() const
Climb up the parent chain to get the compile unit or type unit that this DIE belongs to.
Definition: DIE.cpp:214
llvm::DwarfStringPoolEntryRef::getSymbol
MCSymbol * getSymbol() const
Definition: DwarfStringPoolEntry.h:46
llvm::DIEBlock::print
void print(raw_ostream &O) const
Definition: DIE.cpp:815
llvm::AsmPrinter::isDwarf64
bool isDwarf64() const
Definition: AsmPrinter.cpp:3609
llvm::DwarfStringPoolEntryRef::getIndex
unsigned getIndex() const
Definition: DwarfStringPoolEntry.h:52
llvm::DIEAbbrev::dump
void dump() const
Definition: DIE.cpp:132
llvm::AsmPrinter::getDwarfVersion
uint16_t getDwarfVersion() const
Definition: AsmPrinter.cpp:3601
DwarfUnit.h
llvm::DIELocList::SizeOf
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
Definition: DIE.cpp:823
llvm::DIEAbbrevSet
Helps unique DIEAbbrev objects and assigns abbreviation numbers.
Definition: DIE.h:135
llvm::AsmPrinter
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:82
llvm::DIEValue::isNone
@ isNone
Definition: DIE.h:372
llvm::dwarf::isValidFormForVersion
bool isValidFormForVersion(Form F, unsigned Version, bool ExtensionsOk=true)
Tells whether the specified form is defined in the specified version, or is an extension if extension...
Definition: Dwarf.cpp:781
llvm::DIE::getAbbrevNumber
unsigned getAbbrevNumber() const
Definition: DIE.h:774
llvm::DIE::findAttribute
DIEValue findAttribute(dwarf::Attribute Attribute) const
Find a value in the DIE with the attribute given.
Definition: DIE.cpp:221
N
#define N
MCStreamer.h
llvm::DIELoc::print
void print(raw_ostream &O) const
Definition: DIE.cpp:761
llvm::DIE::hasChildren
bool hasChildren() const
Definition: DIE.h:779
llvm::StringRef::data
const LLVM_NODISCARD char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition: StringRef.h:149
llvm::HexStyle::Asm
@ Asm
0ffh
Definition: MCInstPrinter.h:34
llvm::dwarf::DWARF64
@ DWARF64
Definition: Dwarf.h:92
llvm::dwarf::TagString
StringRef TagString(unsigned Tag)
Definition: Dwarf.cpp:21
llvm::DIE::computeOffsetsAndAbbrevs
unsigned computeOffsetsAndAbbrevs(const AsmPrinter *AP, DIEAbbrevSet &AbbrevSet, unsigned CUOffset)
Compute the offset of this DIE and all its children.
Definition: DIE.cpp:277
llvm::DIEBlock::SizeOf
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of block data in bytes.
Definition: DIE.cpp:802
raw_ostream.h
llvm::DIE::getOffset
unsigned getOffset() const
Get the compile/type unit relative offset of this DIE.
Definition: DIE.h:777
llvm::DIEAbbrevData::getValue
int64_t getValue() const
Definition: DIE.h:69
llvm::DIEValueList
A list of DIE values.
Definition: DIE.h:662
llvm::StringRef::size
LLVM_NODISCARD size_t size() const
size - Get the string size.
Definition: StringRef.h:157
llvm::DIEAddrOffset::print
void print(raw_ostream &O) const
Definition: DIE.cpp:876
llvm::DIEValue::SizeOf
unsigned SizeOf(const AsmPrinter *AP) const
Return the size of a value in bytes.
Definition: DIE.cpp:338
llvm::DIE::setAbbrevNumber
void setAbbrevNumber(unsigned I)
Set the abbreviation number for this DIE.
Definition: DIE.h:803
CU
Definition: AArch64AsmBackend.cpp:501
llvm::DIELabel
A label DIE.
Definition: DIE.h:218
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
Debug.h
llvm::DIEString::print
void print(raw_ostream &O) const
Definition: DIE.cpp:617
llvm::dwarf::AttributeString
StringRef AttributeString(unsigned Attribute)
Definition: Dwarf.cpp:72
llvm::DIEInlineString::print
void print(raw_ostream &O) const
Definition: DIE.cpp:639
llvm::dwarf::DWARF32
@ DWARF32
Definition: Dwarf.h:92
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:37
llvm::DIEString::SizeOf
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of delta value in bytes.
Definition: DIE.cpp:597