LLVM  15.0.0git
DIE.h
Go to the documentation of this file.
1 //===- lib/CodeGen/DIE.h - DWARF Info Entries -------------------*- C++ -*-===//
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 #ifndef LLVM_CODEGEN_DIE_H
14 #define LLVM_CODEGEN_DIE_H
15 
16 #include "llvm/ADT/FoldingSet.h"
18 #include "llvm/ADT/PointerUnion.h"
19 #include "llvm/ADT/SmallVector.h"
20 #include "llvm/ADT/StringRef.h"
21 #include "llvm/ADT/iterator.h"
25 #include "llvm/Support/AlignOf.h"
26 #include "llvm/Support/Allocator.h"
27 #include <cassert>
28 #include <cstddef>
29 #include <cstdint>
30 #include <iterator>
31 #include <new>
32 #include <type_traits>
33 #include <utility>
34 #include <vector>
35 
36 namespace llvm {
37 
38 class AsmPrinter;
39 class DIE;
40 class DIEUnit;
41 class DwarfCompileUnit;
42 class MCExpr;
43 class MCSection;
44 class MCSymbol;
45 class raw_ostream;
46 
47 //===--------------------------------------------------------------------===//
48 /// Dwarf abbreviation data, describes one attribute of a Dwarf abbreviation.
50  /// Dwarf attribute code.
52 
53  /// Dwarf form code.
54  dwarf::Form Form;
55 
56  /// Dwarf attribute value for DW_FORM_implicit_const
57  int64_t Value = 0;
58 
59 public:
61  : Attribute(A), Form(F) {}
63  : Attribute(A), Form(dwarf::DW_FORM_implicit_const), Value(V) {}
64 
65  /// Accessors.
66  /// @{
68  dwarf::Form getForm() const { return Form; }
69  int64_t getValue() const { return Value; }
70  /// @}
71 
72  /// Used to gather unique data for the abbreviation folding set.
73  void Profile(FoldingSetNodeID &ID) const;
74 };
75 
76 //===--------------------------------------------------------------------===//
77 /// Dwarf abbreviation, describes the organization of a debug information
78 /// object.
79 class DIEAbbrev : public FoldingSetNode {
80  /// Unique number for node.
81  unsigned Number = 0;
82 
83  /// Dwarf tag code.
84  dwarf::Tag Tag;
85 
86  /// Whether or not this node has children.
87  ///
88  /// This cheats a bit in all of the uses since the values in the standard
89  /// are 0 and 1 for no children and children respectively.
90  bool Children;
91 
92  /// Raw data bytes for abbreviation.
94 
95 public:
96  DIEAbbrev(dwarf::Tag T, bool C) : Tag(T), Children(C) {}
97 
98  /// Accessors.
99  /// @{
100  dwarf::Tag getTag() const { return Tag; }
101  unsigned getNumber() const { return Number; }
102  bool hasChildren() const { return Children; }
103  const SmallVectorImpl<DIEAbbrevData> &getData() const { return Data; }
104  void setChildrenFlag(bool hasChild) { Children = hasChild; }
105  void setNumber(unsigned N) { Number = N; }
106  /// @}
107 
108  /// Adds another set of attribute information to the abbreviation.
110  Data.push_back(DIEAbbrevData(Attribute, Form));
111  }
112 
113  /// Adds attribute with DW_FORM_implicit_const value
115  Data.push_back(DIEAbbrevData(Attribute, Value));
116  }
117 
118  /// Used to gather unique data for the abbreviation folding set.
119  void Profile(FoldingSetNodeID &ID) const;
120 
121  /// Print the abbreviation using the specified asm printer.
122  void Emit(const AsmPrinter *AP) const;
123 
124  void print(raw_ostream &O) const;
125  void dump() const;
126 };
127 
128 //===--------------------------------------------------------------------===//
129 /// Helps unique DIEAbbrev objects and assigns abbreviation numbers.
130 ///
131 /// This class will unique the DIE abbreviations for a llvm::DIE object and
132 /// assign a unique abbreviation number to each unique DIEAbbrev object it
133 /// finds. The resulting collection of DIEAbbrev objects can then be emitted
134 /// into the .debug_abbrev section.
136  /// The bump allocator to use when creating DIEAbbrev objects in the uniqued
137  /// storage container.
138  BumpPtrAllocator &Alloc;
139  /// FoldingSet that uniques the abbreviations.
140  FoldingSet<DIEAbbrev> AbbreviationsSet;
141  /// A list of all the unique abbreviations in use.
142  std::vector<DIEAbbrev *> Abbreviations;
143 
144 public:
145  DIEAbbrevSet(BumpPtrAllocator &A) : Alloc(A) {}
146  ~DIEAbbrevSet();
147 
148  /// Generate the abbreviation declaration for a DIE and return a pointer to
149  /// the generated abbreviation.
150  ///
151  /// \param Die the debug info entry to generate the abbreviation for.
152  /// \returns A reference to the uniqued abbreviation declaration that is
153  /// owned by this class.
155 
156  /// Print all abbreviations using the specified asm printer.
157  void Emit(const AsmPrinter *AP, MCSection *Section) const;
158 };
159 
160 //===--------------------------------------------------------------------===//
161 /// An integer value DIE.
162 ///
163 class DIEInteger {
164  uint64_t Integer;
165 
166 public:
167  explicit DIEInteger(uint64_t I) : Integer(I) {}
168 
169  /// Choose the best form for integer.
170  static dwarf::Form BestForm(bool IsSigned, uint64_t Int) {
171  if (IsSigned) {
172  const int64_t SignedInt = Int;
173  if ((char)Int == SignedInt)
174  return dwarf::DW_FORM_data1;
175  if ((short)Int == SignedInt)
176  return dwarf::DW_FORM_data2;
177  if ((int)Int == SignedInt)
178  return dwarf::DW_FORM_data4;
179  } else {
180  if ((unsigned char)Int == Int)
181  return dwarf::DW_FORM_data1;
182  if ((unsigned short)Int == Int)
183  return dwarf::DW_FORM_data2;
184  if ((unsigned int)Int == Int)
185  return dwarf::DW_FORM_data4;
186  }
187  return dwarf::DW_FORM_data8;
188  }
189 
190  uint64_t getValue() const { return Integer; }
191  void setValue(uint64_t Val) { Integer = Val; }
192 
193  void emitValue(const AsmPrinter *Asm, dwarf::Form Form) const;
194  unsigned sizeOf(const dwarf::FormParams &FormParams, dwarf::Form Form) const;
195 
196  void print(raw_ostream &O) const;
197 };
198 
199 //===--------------------------------------------------------------------===//
200 /// An expression DIE.
201 class DIEExpr {
202  const MCExpr *Expr;
203 
204 public:
205  explicit DIEExpr(const MCExpr *E) : Expr(E) {}
206 
207  /// Get MCExpr.
208  const MCExpr *getValue() const { return Expr; }
209 
210  void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
211  unsigned sizeOf(const dwarf::FormParams &FormParams, dwarf::Form Form) const;
212 
213  void print(raw_ostream &O) const;
214 };
215 
216 //===--------------------------------------------------------------------===//
217 /// A label DIE.
218 class DIELabel {
219  const MCSymbol *Label;
220 
221 public:
222  explicit DIELabel(const MCSymbol *L) : Label(L) {}
223 
224  /// Get MCSymbol.
225  const MCSymbol *getValue() const { return Label; }
226 
227  void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
228  unsigned sizeOf(const dwarf::FormParams &FormParams, dwarf::Form Form) const;
229 
230  void print(raw_ostream &O) const;
231 };
232 
233 //===--------------------------------------------------------------------===//
234 /// A BaseTypeRef DIE.
236  const DwarfCompileUnit *CU;
237  const uint64_t Index;
238  static constexpr unsigned ULEB128PadSize = 4;
239 
240 public:
241  explicit DIEBaseTypeRef(const DwarfCompileUnit *TheCU, uint64_t Idx)
242  : CU(TheCU), Index(Idx) {}
243 
244  /// EmitValue - Emit base type reference.
245  void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
246  /// sizeOf - Determine size of the base type reference in bytes.
247  unsigned sizeOf(const dwarf::FormParams &, dwarf::Form) const;
248 
249  void print(raw_ostream &O) const;
250  uint64_t getIndex() const { return Index; }
251 };
252 
253 //===--------------------------------------------------------------------===//
254 /// A simple label difference DIE.
255 ///
256 class DIEDelta {
257  const MCSymbol *LabelHi;
258  const MCSymbol *LabelLo;
259 
260 public:
261  DIEDelta(const MCSymbol *Hi, const MCSymbol *Lo) : LabelHi(Hi), LabelLo(Lo) {}
262 
263  void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
264  unsigned sizeOf(const dwarf::FormParams &FormParams, dwarf::Form Form) const;
265 
266  void print(raw_ostream &O) const;
267 };
268 
269 //===--------------------------------------------------------------------===//
270 /// A container for string pool string values.
271 ///
272 /// This class is used with the DW_FORM_strp and DW_FORM_GNU_str_index forms.
273 class DIEString {
275 
276 public:
278 
279  /// Grab the string out of the object.
280  StringRef getString() const { return S.getString(); }
281 
282  void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
283  unsigned sizeOf(const dwarf::FormParams &FormParams, dwarf::Form Form) const;
284 
285  void print(raw_ostream &O) const;
286 };
287 
288 //===--------------------------------------------------------------------===//
289 /// A container for inline string values.
290 ///
291 /// This class is used with the DW_FORM_string form.
293  StringRef S;
294 
295 public:
296  template <typename Allocator>
297  explicit DIEInlineString(StringRef Str, Allocator &A) : S(Str.copy(A)) {}
298 
299  ~DIEInlineString() = default;
300 
301  /// Grab the string out of the object.
302  StringRef getString() const { return S; }
303 
304  void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
305  unsigned sizeOf(const dwarf::FormParams &, dwarf::Form) const;
306 
307  void print(raw_ostream &O) const;
308 };
309 
310 //===--------------------------------------------------------------------===//
311 /// A pointer to another debug information entry. An instance of this class can
312 /// also be used as a proxy for a debug information entry not yet defined
313 /// (ie. types.)
314 class DIEEntry {
315  DIE *Entry;
316 
317 public:
318  DIEEntry() = delete;
319  explicit DIEEntry(DIE &E) : Entry(&E) {}
320 
321  DIE &getEntry() const { return *Entry; }
322 
323  void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
324  unsigned sizeOf(const dwarf::FormParams &FormParams, dwarf::Form Form) const;
325 
326  void print(raw_ostream &O) const;
327 };
328 
329 //===--------------------------------------------------------------------===//
330 /// Represents a pointer to a location list in the debug_loc
331 /// section.
332 class DIELocList {
333  /// Index into the .debug_loc vector.
334  size_t Index;
335 
336 public:
337  DIELocList(size_t I) : Index(I) {}
338 
339  /// Grab the current index out.
340  size_t getValue() const { return Index; }
341 
342  void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
343  unsigned sizeOf(const dwarf::FormParams &FormParams, dwarf::Form Form) const;
344 
345  void print(raw_ostream &O) const;
346 };
347 
348 //===--------------------------------------------------------------------===//
349 /// A BaseTypeRef DIE.
351  DIEInteger Addr;
352  DIEDelta Offset;
353 
354 public:
355  explicit DIEAddrOffset(uint64_t Idx, const MCSymbol *Hi, const MCSymbol *Lo)
356  : Addr(Idx), Offset(Hi, Lo) {}
357 
358  void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
359  unsigned sizeOf(const dwarf::FormParams &FormParams, dwarf::Form Form) const;
360 
361  void print(raw_ostream &O) const;
362 };
363 
364 //===--------------------------------------------------------------------===//
365 /// A debug information entry value. Some of these roughly correlate
366 /// to DWARF attribute classes.
367 class DIEBlock;
368 class DIELoc;
369 class DIEValue {
370 public:
371  enum Type {
373 #define HANDLE_DIEVALUE(T) is##T,
374 #include "llvm/CodeGen/DIEValue.def"
375  };
376 
377 private:
378  /// Type of data stored in the value.
379  Type Ty = isNone;
380  dwarf::Attribute Attribute = (dwarf::Attribute)0;
381  dwarf::Form Form = (dwarf::Form)0;
382 
383  /// Storage for the value.
384  ///
385  /// All values that aren't standard layout (or are larger than 8 bytes)
386  /// should be stored by reference instead of by value.
387  using ValTy =
388  AlignedCharArrayUnion<DIEInteger, DIEString, DIEExpr, DIELabel,
389  DIEDelta *, DIEEntry, DIEBlock *, DIELoc *,
390  DIELocList, DIEBaseTypeRef *, DIEAddrOffset *>;
391 
392  static_assert(sizeof(ValTy) <= sizeof(uint64_t) ||
393  sizeof(ValTy) <= sizeof(void *),
394  "Expected all large types to be stored via pointer");
395 
396  /// Underlying stored value.
397  ValTy Val;
398 
399  template <class T> void construct(T V) {
400  static_assert(std::is_standard_layout<T>::value ||
401  std::is_pointer<T>::value,
402  "Expected standard layout or pointer");
403  new (reinterpret_cast<void *>(&Val)) T(V);
404  }
405 
406  template <class T> T *get() { return reinterpret_cast<T *>(&Val); }
407  template <class T> const T *get() const {
408  return reinterpret_cast<const T *>(&Val);
409  }
410  template <class T> void destruct() { get<T>()->~T(); }
411 
412  /// Destroy the underlying value.
413  ///
414  /// This should get optimized down to a no-op. We could skip it if we could
415  /// add a static assert on \a std::is_trivially_copyable(), but we currently
416  /// support versions of GCC that don't understand that.
417  void destroyVal() {
418  switch (Ty) {
419  case isNone:
420  return;
421 #define HANDLE_DIEVALUE_SMALL(T) \
422  case is##T: \
423  destruct<DIE##T>(); \
424  return;
425 #define HANDLE_DIEVALUE_LARGE(T) \
426  case is##T: \
427  destruct<const DIE##T *>(); \
428  return;
429 #include "llvm/CodeGen/DIEValue.def"
430  }
431  }
432 
433  /// Copy the underlying value.
434  ///
435  /// This should get optimized down to a simple copy. We need to actually
436  /// construct the value, rather than calling memcpy, to satisfy strict
437  /// aliasing rules.
438  void copyVal(const DIEValue &X) {
439  switch (Ty) {
440  case isNone:
441  return;
442 #define HANDLE_DIEVALUE_SMALL(T) \
443  case is##T: \
444  construct<DIE##T>(*X.get<DIE##T>()); \
445  return;
446 #define HANDLE_DIEVALUE_LARGE(T) \
447  case is##T: \
448  construct<const DIE##T *>(*X.get<const DIE##T *>()); \
449  return;
450 #include "llvm/CodeGen/DIEValue.def"
451  }
452  }
453 
454 public:
455  DIEValue() = default;
456 
457  DIEValue(const DIEValue &X) : Ty(X.Ty), Attribute(X.Attribute), Form(X.Form) {
458  copyVal(X);
459  }
460 
462  destroyVal();
463  Ty = X.Ty;
464  Attribute = X.Attribute;
465  Form = X.Form;
466  copyVal(X);
467  return *this;
468  }
469 
470  ~DIEValue() { destroyVal(); }
471 
472 #define HANDLE_DIEVALUE_SMALL(T) \
473  DIEValue(dwarf::Attribute Attribute, dwarf::Form Form, const DIE##T &V) \
474  : Ty(is##T), Attribute(Attribute), Form(Form) { \
475  construct<DIE##T>(V); \
476  }
477 #define HANDLE_DIEVALUE_LARGE(T) \
478  DIEValue(dwarf::Attribute Attribute, dwarf::Form Form, const DIE##T *V) \
479  : Ty(is##T), Attribute(Attribute), Form(Form) { \
480  assert(V && "Expected valid value"); \
481  construct<const DIE##T *>(V); \
482  }
483 #include "llvm/CodeGen/DIEValue.def"
484 
485  /// Accessors.
486  /// @{
487  Type getType() const { return Ty; }
489  dwarf::Form getForm() const { return Form; }
490  explicit operator bool() const { return Ty; }
491  /// @}
492 
493 #define HANDLE_DIEVALUE_SMALL(T) \
494  const DIE##T &getDIE##T() const { \
495  assert(getType() == is##T && "Expected " #T); \
496  return *get<DIE##T>(); \
497  }
498 #define HANDLE_DIEVALUE_LARGE(T) \
499  const DIE##T &getDIE##T() const { \
500  assert(getType() == is##T && "Expected " #T); \
501  return **get<const DIE##T *>(); \
502  }
503 #include "llvm/CodeGen/DIEValue.def"
504 
505  /// Emit value via the Dwarf writer.
506  void emitValue(const AsmPrinter *AP) const;
507 
508  /// Return the size of a value in bytes.
509  unsigned sizeOf(const dwarf::FormParams &FormParams) const;
510 
511  void print(raw_ostream &O) const;
512  void dump() const;
513 };
514 
517 
519 
521  return Next.getInt() ? nullptr : Next.getPointer();
522  }
523 };
524 
527 
528  Node *Last = nullptr;
529 
530  bool empty() const { return !Last; }
531 
532  void push_back(Node &N) {
533  assert(N.Next.getPointer() == &N && "Expected unlinked node");
534  assert(N.Next.getInt() == true && "Expected unlinked node");
535 
536  if (Last) {
537  N.Next = Last->Next;
538  Last->Next.setPointerAndInt(&N, false);
539  }
540  Last = &N;
541  }
542 
543  void push_front(Node &N) {
544  assert(N.Next.getPointer() == &N && "Expected unlinked node");
545  assert(N.Next.getInt() == true && "Expected unlinked node");
546 
547  if (Last) {
548  N.Next.setPointerAndInt(Last->Next.getPointer(), false);
549  Last->Next.setPointerAndInt(&N, true);
550  } else {
551  Last = &N;
552  }
553  }
554 };
555 
556 template <class T> class IntrusiveBackList : IntrusiveBackListBase {
557 public:
559 
562  T &back() { return *static_cast<T *>(Last); }
563  const T &back() const { return *static_cast<T *>(Last); }
564  T &front() {
565  return *static_cast<T *>(Last ? Last->Next.getPointer() : nullptr);
566  }
567  const T &front() const {
568  return *static_cast<T *>(Last ? Last->Next.getPointer() : nullptr);
569  }
570 
572  if (Other.empty())
573  return;
574 
575  T *FirstNode = static_cast<T *>(Other.Last->Next.getPointer());
576  T *IterNode = FirstNode;
577  do {
578  // Keep a pointer to the node and increment the iterator.
579  T *TmpNode = IterNode;
580  IterNode = static_cast<T *>(IterNode->Next.getPointer());
581 
582  // Unlink the node and push it back to this list.
583  TmpNode->Next.setPointerAndInt(TmpNode, true);
584  push_back(*TmpNode);
585  } while (IterNode != FirstNode);
586 
587  Other.Last = nullptr;
588  }
589 
590  class const_iterator;
591  class iterator
592  : public iterator_facade_base<iterator, std::forward_iterator_tag, T> {
593  friend class const_iterator;
594 
595  Node *N = nullptr;
596 
597  public:
598  iterator() = default;
599  explicit iterator(T *N) : N(N) {}
600 
602  N = N->getNext();
603  return *this;
604  }
605 
606  explicit operator bool() const { return N; }
607  T &operator*() const { return *static_cast<T *>(N); }
608 
609  bool operator==(const iterator &X) const { return N == X.N; }
610  };
611 
613  : public iterator_facade_base<const_iterator, std::forward_iterator_tag,
614  const T> {
615  const Node *N = nullptr;
616 
617  public:
618  const_iterator() = default;
619  // Placate MSVC by explicitly scoping 'iterator'.
621  explicit const_iterator(const T *N) : N(N) {}
622 
624  N = N->getNext();
625  return *this;
626  }
627 
628  explicit operator bool() const { return N; }
629  const T &operator*() const { return *static_cast<const T *>(N); }
630 
631  bool operator==(const const_iterator &X) const { return N == X.N; }
632  };
633 
634  iterator begin() {
635  return Last ? iterator(static_cast<T *>(Last->Next.getPointer())) : end();
636  }
638  return const_cast<IntrusiveBackList *>(this)->begin();
639  }
640  iterator end() { return iterator(); }
641  const_iterator end() const { return const_iterator(); }
642 
643  static iterator toIterator(T &N) { return iterator(&N); }
644  static const_iterator toIterator(const T &N) { return const_iterator(&N); }
645 };
646 
647 /// A list of DIE values.
648 ///
649 /// This is a singly-linked list, but instead of reversing the order of
650 /// insertion, we keep a pointer to the back of the list so we can push in
651 /// order.
652 ///
653 /// There are two main reasons to choose a linked list over a customized
654 /// vector-like data structure.
655 ///
656 /// 1. For teardown efficiency, we want DIEs to be BumpPtrAllocated. Using a
657 /// linked list here makes this way easier to accomplish.
658 /// 2. Carrying an extra pointer per \a DIEValue isn't expensive. 45% of DIEs
659 /// have 2 or fewer values, and 90% have 5 or fewer. A vector would be
660 /// over-allocated by 50% on average anyway, the same cost as the
661 /// linked-list node.
663  struct Node : IntrusiveBackListNode {
664  DIEValue V;
665 
666  explicit Node(DIEValue V) : V(V) {}
667  };
668 
670 
671  ListTy List;
672 
673 public:
674  class const_value_iterator;
676  : public iterator_adaptor_base<value_iterator, ListTy::iterator,
677  std::forward_iterator_tag, DIEValue> {
678  friend class const_value_iterator;
679 
680  using iterator_adaptor =
682  std::forward_iterator_tag, DIEValue>;
683 
684  public:
685  value_iterator() = default;
687 
688  explicit operator bool() const { return bool(wrapped()); }
689  DIEValue &operator*() const { return wrapped()->V; }
690  };
691 
693  const_value_iterator, ListTy::const_iterator,
694  std::forward_iterator_tag, const DIEValue> {
695  using iterator_adaptor =
696  iterator_adaptor_base<const_value_iterator, ListTy::const_iterator,
697  std::forward_iterator_tag, const DIEValue>;
698 
699  public:
700  const_value_iterator() = default;
702  : iterator_adaptor(X.wrapped()) {}
703  explicit const_value_iterator(ListTy::const_iterator X)
704  : iterator_adaptor(X) {}
705 
706  explicit operator bool() const { return bool(wrapped()); }
707  const DIEValue &operator*() const { return wrapped()->V; }
708  };
709 
712 
714  List.push_back(*new (Alloc) Node(V));
715  return value_iterator(ListTy::toIterator(List.back()));
716  }
717  template <class T>
719  dwarf::Form Form, T &&Value) {
720  return addValue(Alloc, DIEValue(Attribute, Form, std::forward<T>(Value)));
721  }
722 
723  /// Take ownership of the nodes in \p Other, and append them to the back of
724  /// the list.
725  void takeValues(DIEValueList &Other) { List.takeNodes(Other.List); }
726 
728  return make_range(value_iterator(List.begin()), value_iterator(List.end()));
729  }
731  return make_range(const_value_iterator(List.begin()),
732  const_value_iterator(List.end()));
733  }
734 };
735 
736 //===--------------------------------------------------------------------===//
737 /// A structured debug information entry. Has an abbreviation which
738 /// describes its organization.
740  friend class IntrusiveBackList<DIE>;
741  friend class DIEUnit;
742 
743  /// Dwarf unit relative offset.
744  unsigned Offset = 0;
745  /// Size of instance + children.
746  unsigned Size = 0;
747  unsigned AbbrevNumber = ~0u;
748  /// Dwarf tag code.
750  /// Set to true to force a DIE to emit an abbreviation that says it has
751  /// children even when it doesn't. This is used for unit testing purposes.
752  bool ForceChildren = false;
753  /// Children DIEs.
754  IntrusiveBackList<DIE> Children;
755 
756  /// The owner is either the parent DIE for children of other DIEs, or a
757  /// DIEUnit which contains this DIE as its unit DIE.
759 
760  explicit DIE(dwarf::Tag Tag) : Tag(Tag) {}
761 
762 public:
763  DIE() = delete;
764  DIE(const DIE &RHS) = delete;
765  DIE(DIE &&RHS) = delete;
766  DIE &operator=(const DIE &RHS) = delete;
767  DIE &operator=(const DIE &&RHS) = delete;
768 
769  static DIE *get(BumpPtrAllocator &Alloc, dwarf::Tag Tag) {
770  return new (Alloc) DIE(Tag);
771  }
772 
773  // Accessors.
774  unsigned getAbbrevNumber() const { return AbbrevNumber; }
775  dwarf::Tag getTag() const { return Tag; }
776  /// Get the compile/type unit relative offset of this DIE.
777  unsigned getOffset() const {
778  // A real Offset can't be zero because the unit headers are at offset zero.
779  assert(Offset && "Offset being queried before it's been computed.");
780  return Offset;
781  }
782  unsigned getSize() const {
783  // A real Size can't be zero because it includes the non-empty abbrev code.
784  assert(Size && "Size being queried before it's been ocmputed.");
785  return Size;
786  }
787  bool hasChildren() const { return ForceChildren || !Children.empty(); }
788  void setForceChildren(bool B) { ForceChildren = B; }
789 
794 
796  return make_range(Children.begin(), Children.end());
797  }
799  return make_range(Children.begin(), Children.end());
800  }
801 
802  DIE *getParent() const;
803 
804  /// Generate the abbreviation for this DIE.
805  ///
806  /// Calculate the abbreviation for this, which should be uniqued and
807  /// eventually used to call \a setAbbrevNumber().
808  DIEAbbrev generateAbbrev() const;
809 
810  /// Set the abbreviation number for this DIE.
811  void setAbbrevNumber(unsigned I) { AbbrevNumber = I; }
812 
813  /// Get the absolute offset within the .debug_info or .debug_types section
814  /// for this DIE.
816 
817  /// Compute the offset of this DIE and all its children.
818  ///
819  /// This function gets called just before we are going to generate the debug
820  /// information and gives each DIE a chance to figure out its CU relative DIE
821  /// offset, unique its abbreviation and fill in the abbreviation code, and
822  /// return the unit offset that points to where the next DIE will be emitted
823  /// within the debug unit section. After this function has been called for all
824  /// DIE objects, the DWARF can be generated since all DIEs will be able to
825  /// properly refer to other DIE objects since all DIEs have calculated their
826  /// offsets.
827  ///
828  /// \param FormParams Used when calculating sizes.
829  /// \param AbbrevSet the abbreviation used to unique DIE abbreviations.
830  /// \param CUOffset the compile/type unit relative offset in bytes.
831  /// \returns the offset for the DIE that follows this DIE within the
832  /// current compile/type unit.
833  unsigned computeOffsetsAndAbbrevs(const dwarf::FormParams &FormParams,
834  DIEAbbrevSet &AbbrevSet, unsigned CUOffset);
835 
836  /// Climb up the parent chain to get the compile unit or type unit DIE that
837  /// this DIE belongs to.
838  ///
839  /// \returns the compile or type unit DIE that owns this DIE, or NULL if
840  /// this DIE hasn't been added to a unit DIE.
841  const DIE *getUnitDie() const;
842 
843  /// Climb up the parent chain to get the compile unit or type unit that this
844  /// DIE belongs to.
845  ///
846  /// \returns the DIEUnit that represents the compile or type unit that owns
847  /// this DIE, or NULL if this DIE hasn't been added to a unit DIE.
848  DIEUnit *getUnit() const;
849 
850  void setOffset(unsigned O) { Offset = O; }
851  void setSize(unsigned S) { Size = S; }
852 
853  /// Add a child to the DIE.
854  DIE &addChild(DIE *Child) {
855  assert(!Child->getParent() && "Child should be orphaned");
856  Child->Owner = this;
857  Children.push_back(*Child);
858  return Children.back();
859  }
860 
861  DIE &addChildFront(DIE *Child) {
862  assert(!Child->getParent() && "Child should be orphaned");
863  Child->Owner = this;
864  Children.push_front(*Child);
865  return Children.front();
866  }
867 
868  /// Find a value in the DIE with the attribute given.
869  ///
870  /// Returns a default-constructed DIEValue (where \a DIEValue::getType()
871  /// gives \a DIEValue::isNone) if no such attribute exists.
873 
874  void print(raw_ostream &O, unsigned IndentCount = 0) const;
875  void dump() const;
876 };
877 
878 //===--------------------------------------------------------------------===//
879 /// Represents a compile or type unit.
880 class DIEUnit {
881  /// The compile unit or type unit DIE. This variable must be an instance of
882  /// DIE so that we can calculate the DIEUnit from any DIE by traversing the
883  /// parent backchain and getting the Unit DIE, and then casting itself to a
884  /// DIEUnit. This allows us to be able to find the DIEUnit for any DIE without
885  /// having to store a pointer to the DIEUnit in each DIE instance.
886  DIE Die;
887  /// The section this unit will be emitted in. This may or may not be set to
888  /// a valid section depending on the client that is emitting DWARF.
889  MCSection *Section = nullptr;
890  uint64_t Offset = 0; /// .debug_info or .debug_types absolute section offset.
891 protected:
892  virtual ~DIEUnit() = default;
893 
894 public:
895  explicit DIEUnit(dwarf::Tag UnitTag);
896  DIEUnit(const DIEUnit &RHS) = delete;
897  DIEUnit(DIEUnit &&RHS) = delete;
898  void operator=(const DIEUnit &RHS) = delete;
899  void operator=(const DIEUnit &&RHS) = delete;
900  /// Set the section that this DIEUnit will be emitted into.
901  ///
902  /// This function is used by some clients to set the section. Not all clients
903  /// that emit DWARF use this section variable.
904  void setSection(MCSection *Section) {
905  assert(!this->Section);
906  this->Section = Section;
907  }
908 
910  return nullptr;
911  }
912 
913  /// Return the section that this DIEUnit will be emitted into.
914  ///
915  /// \returns Section pointer which can be NULL.
916  MCSection *getSection() const { return Section; }
917  void setDebugSectionOffset(uint64_t O) { Offset = O; }
918  uint64_t getDebugSectionOffset() const { return Offset; }
919  DIE &getUnitDie() { return Die; }
920  const DIE &getUnitDie() const { return Die; }
921 };
922 
923 struct BasicDIEUnit final : DIEUnit {
924  explicit BasicDIEUnit(dwarf::Tag UnitTag) : DIEUnit(UnitTag) {}
925 };
926 
927 //===--------------------------------------------------------------------===//
928 /// DIELoc - Represents an expression location.
929 //
930 class DIELoc : public DIEValueList {
931  mutable unsigned Size = 0; // Size in bytes excluding size header.
932 
933 public:
934  DIELoc() = default;
935 
936  /// Calculate the size of the location expression.
937  unsigned computeSize(const dwarf::FormParams &FormParams) const;
938 
939  // TODO: move setSize() and Size to DIEValueList.
940  void setSize(unsigned size) { Size = size; }
941 
942  /// BestForm - Choose the best form for data.
943  ///
944  dwarf::Form BestForm(unsigned DwarfVersion) const {
945  if (DwarfVersion > 3)
946  return dwarf::DW_FORM_exprloc;
947  // Pre-DWARF4 location expressions were blocks and not exprloc.
948  if ((unsigned char)Size == Size)
949  return dwarf::DW_FORM_block1;
950  if ((unsigned short)Size == Size)
951  return dwarf::DW_FORM_block2;
952  if ((unsigned int)Size == Size)
953  return dwarf::DW_FORM_block4;
954  return dwarf::DW_FORM_block;
955  }
956 
957  void emitValue(const AsmPrinter *Asm, dwarf::Form Form) const;
958  unsigned sizeOf(const dwarf::FormParams &, dwarf::Form Form) const;
959 
960  void print(raw_ostream &O) const;
961 };
962 
963 //===--------------------------------------------------------------------===//
964 /// DIEBlock - Represents a block of values.
965 //
966 class DIEBlock : public DIEValueList {
967  mutable unsigned Size = 0; // Size in bytes excluding size header.
968 
969 public:
970  DIEBlock() = default;
971 
972  /// Calculate the size of the location expression.
973  unsigned computeSize(const dwarf::FormParams &FormParams) const;
974 
975  // TODO: move setSize() and Size to DIEValueList.
976  void setSize(unsigned size) { Size = size; }
977 
978  /// BestForm - Choose the best form for data.
979  ///
981  if ((unsigned char)Size == Size)
982  return dwarf::DW_FORM_block1;
983  if ((unsigned short)Size == Size)
984  return dwarf::DW_FORM_block2;
985  if ((unsigned int)Size == Size)
986  return dwarf::DW_FORM_block4;
987  return dwarf::DW_FORM_block;
988  }
989 
990  void emitValue(const AsmPrinter *Asm, dwarf::Form Form) const;
991  unsigned sizeOf(const dwarf::FormParams &, dwarf::Form Form) const;
992 
993  void print(raw_ostream &O) const;
994 };
995 
996 } // end namespace llvm
997 
998 #endif // LLVM_CODEGEN_DIE_H
llvm::Check::Size
@ Size
Definition: FileCheck.h:76
llvm::IntrusiveBackList::push_front
void push_front(T &N)
Definition: DIE.h:561
llvm::DIEAbbrev::getData
const SmallVectorImpl< DIEAbbrevData > & getData() const
Definition: DIE.h:103
llvm::DIEAbbrevData::getForm
dwarf::Form getForm() const
Definition: DIE.h:68
llvm::DIEAbbrev::print
void print(raw_ostream &O) const
Definition: DIE.cpp:103
llvm::DIE::setOffset
void setOffset(unsigned O)
Definition: DIE.h:850
const_iterator
llvm::DIEExpr::sizeOf
unsigned sizeOf(const dwarf::FormParams &FormParams, dwarf::Form Form) const
SizeOf - Determine size of expression value in bytes.
Definition: DIE.cpp:465
llvm::DIEValue::print
void print(raw_ostream &O) const
Definition: DIE.cpp:346
llvm::DIEAbbrevData::DIEAbbrevData
DIEAbbrevData(dwarf::Attribute A, dwarf::Form F)
Definition: DIE.h:60
llvm::DIELabel::getValue
const MCSymbol * getValue() const
Get MCSymbol.
Definition: DIE.h:225
llvm::DIELabel::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit label value.
Definition: DIE.cpp:488
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::DIEInteger::DIEInteger
DIEInteger(uint64_t I)
Definition: DIE.h:167
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
llvm::DIE::children
const_child_range children() const
Definition: DIE.h:798
llvm::IntrusiveBackListBase::push_back
void push_back(Node &N)
Definition: DIE.h:532
llvm::DIE::DIE
DIE()=delete
llvm::IntrusiveBackList::back
T & back()
Definition: DIE.h:562
llvm::IntrusiveBackList::back
const T & back() const
Definition: DIE.h:563
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:51
StringRef.h
llvm::DwarfCompileUnit
Definition: DwarfCompileUnit.h:46
llvm::DIEValue
Definition: DIE.h:369
llvm::DIEUnit
Represents a compile or type unit.
Definition: DIE.h:880
llvm::DIEUnit::~DIEUnit
virtual ~DIEUnit()=default
.debug_info or .debug_types absolute section offset.
llvm::DIE::print
void print(raw_ostream &O, unsigned IndentCount=0) const
Definition: DIE.cpp:242
llvm::DIEAbbrev::DIEAbbrev
DIEAbbrev(dwarf::Tag T, bool C)
Definition: DIE.h:96
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:140
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1185
llvm::DIEInteger::getValue
uint64_t getValue() const
Definition: DIE.h:190
llvm::dwarf::Form
Form
Definition: Dwarf.h:132
llvm::DIEAddrOffset::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit label value.
Definition: DIE.cpp:862
llvm::DIEValueList::const_value_iterator::const_value_iterator
const_value_iterator(DIEValueList::value_iterator X)
Definition: DIE.h:701
Allocator.h
llvm::DIEValue::DIEValue
DIEValue()=default
llvm::BasicDIEUnit
Definition: DIE.h:923
llvm::DIEUnit::getCrossSectionRelativeBaseAddress
virtual const MCSymbol * getCrossSectionRelativeBaseAddress() const
Definition: DIE.h:909
llvm::DIEDelta::sizeOf
unsigned sizeOf(const dwarf::FormParams &FormParams, dwarf::Form Form) const
SizeOf - Determine size of delta value in bytes.
Definition: DIE.cpp:546
true
basic Basic Alias true
Definition: BasicAliasAnalysis.cpp:1909
llvm::DIELoc::sizeOf
unsigned sizeOf(const dwarf::FormParams &, dwarf::Form Form) const
sizeOf - Determine size of location data in bytes.
Definition: DIE.cpp:740
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:197
llvm::DIEAddrOffset
A BaseTypeRef DIE.
Definition: DIE.h:350
llvm::IntrusiveBackListBase
Definition: DIE.h:525
llvm::DIEAbbrevData::getAttribute
dwarf::Attribute getAttribute() const
Accessors.
Definition: DIE.h:67
llvm::IntrusiveBackListNode::getNext
IntrusiveBackListNode * getNext() const
Definition: DIE.h:520
llvm::iterator_adaptor_base
CRTP base class for adapting an iterator to a different type.
Definition: iterator.h:235
Integer
So we should use XX3Form_Rcr to implement intrinsic Convert DP outs ins xscvdpsp No builtin are required Round &Convert QP DP(dword[1] is set to zero) No builtin are required Round to Quad Precision Integer
Definition: README_P9.txt:366
llvm::copy
OutputIt copy(R &&Range, OutputIt Out)
Definition: STLExtras.h:1658
llvm::IntrusiveBackListBase::empty
bool empty() const
Definition: DIE.h:530
llvm::DIEString::DIEString
DIEString(DwarfStringPoolEntryRef S)
Definition: DIE.h:277
llvm::DIEBlock::computeSize
unsigned computeSize(const dwarf::FormParams &FormParams) const
Calculate the size of the location expression.
Definition: DIE.cpp:761
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::DIEInlineString::DIEInlineString
DIEInlineString(StringRef Str, Allocator &A)
Definition: DIE.h:297
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:79
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::DIEBlock::sizeOf
unsigned sizeOf(const dwarf::FormParams &, dwarf::Form Form) const
sizeOf - Determine size of block data in bytes.
Definition: DIE.cpp:792
llvm::DIELoc::DIELoc
DIELoc()=default
Node::Node
Node(Kind K_, Prec Precedence_=Prec::Primary, Cache RHSComponentCache_=Cache::No, Cache ArrayCache_=Cache::No, Cache FunctionCache_=Cache::No)
Definition: ItaniumDemangle.h:211
AlignOf.h
RHS
Value * RHS
Definition: X86PartialReduction.cpp:76
llvm::iterator_adaptor_base< value_iterator, ListTy::iterator, std::forward_iterator_tag, DIEValue >::wrapped
const ListTy::iterator & wrapped() const
Definition: iterator.h:250
llvm::IntrusiveBackListNode::IntrusiveBackListNode
IntrusiveBackListNode()
Definition: DIE.h:518
llvm::DIE::getTag
dwarf::Tag getTag() const
Definition: DIE.h:775
llvm::IntrusiveBackList::empty
bool empty() const
Definition: DIE.h:530
llvm::dwarf::Tag
Tag
Definition: Dwarf.h:105
llvm::DIEEntry::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit debug information entry offset.
Definition: DIE.cpp:648
llvm::DIEUnit::getDebugSectionOffset
uint64_t getDebugSectionOffset() const
Definition: DIE.h:918
llvm::DIEDelta::print
void print(raw_ostream &O) const
Definition: DIE.cpp:561
llvm::DIE::computeOffsetsAndAbbrevs
unsigned computeOffsetsAndAbbrevs(const dwarf::FormParams &FormParams, DIEAbbrevSet &AbbrevSet, unsigned CUOffset)
Compute the offset of this DIE and all its children.
Definition: DIE.cpp:272
llvm::DIEValueList::value_iterator::operator*
DIEValue & operator*() const
Definition: DIE.h:689
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
llvm::DwarfStringPoolEntryRef
String pool entry reference.
Definition: DwarfStringPoolEntry.h:31
llvm::dwarf::Attribute
Attribute
Attributes.
Definition: Dwarf.h:125
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::getValue
size_t getValue() const
Grab the current index out.
Definition: DIE.h:340
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::DIEInlineString::sizeOf
unsigned sizeOf(const dwarf::FormParams &, dwarf::Form) const
Definition: DIE.cpp:632
llvm::DIEValue::operator=
DIEValue & operator=(const DIEValue &X)
Definition: DIE.h:461
llvm::DIELocList::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit label value.
Definition: DIE.cpp:837
llvm::DIEValueList::values
value_range values()
Definition: DIE.h:727
llvm::DIEBaseTypeRef::DIEBaseTypeRef
DIEBaseTypeRef(const DwarfCompileUnit *TheCU, uint64_t Idx)
Definition: DIE.h:241
PointerIntPair.h
llvm::DIEValue::dump
void dump() const
Definition: DIE.cpp:359
llvm::IntrusiveBackList::const_iterator::operator++
const_iterator & operator++()
Definition: DIE.h:623
llvm::DIE::addChild
DIE & addChild(DIE *Child)
Add a child to the DIE.
Definition: DIE.h:854
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:480
llvm::DIEInteger::setValue
void setValue(uint64_t Val)
Definition: DIE.h:191
llvm::IntrusiveBackList::end
iterator end()
Definition: DIE.h:640
llvm::IntrusiveBackList::iterator::operator*
T & operator*() const
Definition: DIE.h:607
llvm::DIEValueList::const_value_iterator::operator*
const DIEValue & operator*() const
Definition: DIE.h:707
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::IntrusiveBackList::push_back
void push_back(T &N)
Definition: DIE.h:560
llvm::DIEAbbrev::setNumber
void setNumber(unsigned N)
Definition: DIE.h:105
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::DIEEntry::DIEEntry
DIEEntry()=delete
llvm::DIEBlock::BestForm
dwarf::Form BestForm() const
BestForm - Choose the best form for data.
Definition: DIE.h:980
llvm::DIELocList
Represents a pointer to a location list in the debug_loc section.
Definition: DIE.h:332
llvm::DIE::addChildFront
DIE & addChildFront(DIE *Child)
Definition: DIE.h:861
llvm::DIEValue::getForm
dwarf::Form getForm() const
Definition: DIE.h:489
llvm::DIEValueList::value_iterator
Definition: DIE.h:675
llvm::DIEAbbrev::Emit
void Emit(const AsmPrinter *AP) const
Print the abbreviation using the specified asm printer.
Definition: DIE.cpp:62
llvm::DIE::setForceChildren
void setForceChildren(bool B)
Definition: DIE.h:788
llvm::IntrusiveBackList::iterator::iterator
iterator(T *N)
Definition: DIE.h:599
llvm::DIEBaseTypeRef::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit base type reference.
Definition: DIE.cpp:520
llvm::DIEDelta
A simple label difference DIE.
Definition: DIE.h:256
llvm::DIEValueList::values
const_value_range values() const
Definition: DIE.h:730
llvm::DIEInlineString::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
Definition: DIE.cpp:623
llvm::DIEBlock::DIEBlock
DIEBlock()=default
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::DIEUnit::getUnitDie
const DIE & getUnitDie() const
Definition: DIE.h:920
llvm::DIE::dump
void dump() const
Definition: DIE.cpp:267
llvm::DIEAbbrevData
Dwarf abbreviation data, describes one attribute of a Dwarf abbreviation.
Definition: DIE.h:49
llvm::DIEString::getString
StringRef getString() const
Grab the string out of the object.
Definition: DIE.h:280
llvm::IntrusiveBackList::front
const T & front() const
Definition: DIE.h:567
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:54
llvm::DIEValueList::const_value_iterator
Definition: DIE.h:692
llvm::DIELabel::sizeOf
unsigned sizeOf(const dwarf::FormParams &FormParams, dwarf::Form Form) const
sizeOf - Determine size of label value in bytes.
Definition: DIE.cpp:496
DwarfStringPoolEntry.h
llvm::DIEAbbrevSet::~DIEAbbrevSet
~DIEAbbrevSet()
Definition: DIE.cpp:135
llvm::DIEInteger
An integer value DIE.
Definition: DIE.h:163
llvm::DIEUnit::operator=
void operator=(const DIEUnit &RHS)=delete
llvm::IntrusiveBackList::toIterator
static iterator toIterator(T &N)
Definition: DIE.h:643
llvm::DIEAbbrevSet::Emit
void Emit(const AsmPrinter *AP, MCSection *Section) const
Print all abbreviations using the specified asm printer.
Definition: DIE.cpp:164
llvm::DIEBlock
DIEBlock - Represents a block of values.
Definition: DIE.h:966
llvm::DIEValue::DIEValue
DIEValue(const DIEValue &X)
Definition: DIE.h:457
llvm::DIELocList::sizeOf
unsigned sizeOf(const dwarf::FormParams &FormParams, dwarf::Form Form) const
Definition: DIE.cpp:813
llvm::DIEEntry::sizeOf
unsigned sizeOf(const dwarf::FormParams &FormParams, dwarf::Form Form) const
Definition: DIE.cpp:681
llvm::DIEValueList::takeValues
void takeValues(DIEValueList &Other)
Take ownership of the nodes in Other, and append them to the back of the list.
Definition: DIE.h:725
llvm::DIEAbbrevData::Profile
void Profile(FoldingSetNodeID &ID) const
Used to gather unique data for the abbreviation folding set.
Definition: DIE.cpp:36
llvm::DIEBaseTypeRef::print
void print(raw_ostream &O) const
Definition: DIE.cpp:531
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:191
llvm::DIEString
A container for string pool string values.
Definition: DIE.h:273
llvm::DIE::setSize
void setSize(unsigned S)
Definition: DIE.h:851
llvm::DIE::getSize
unsigned getSize() const
Definition: DIE.h:782
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
llvm::DIEValueList::addValue
value_iterator addValue(BumpPtrAllocator &Alloc, const DIEValue &V)
Definition: DIE.h:713
llvm::DIELoc::setSize
void setSize(unsigned size)
Definition: DIE.h:940
llvm::DIELocList::print
void print(raw_ostream &O) const
Definition: DIE.cpp:848
llvm::DIEInlineString
A container for inline string values.
Definition: DIE.h:292
llvm::DIEExpr::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit expression value.
Definition: DIE.cpp:459
llvm::DIEValueList::addValue
value_iterator addValue(BumpPtrAllocator &Alloc, dwarf::Attribute Attribute, dwarf::Form Form, T &&Value)
Definition: DIE.h:718
llvm::IntrusiveBackList::const_iterator::const_iterator
const_iterator(typename IntrusiveBackList< T >::iterator X)
Definition: DIE.h:620
llvm::DIEUnit::setDebugSectionOffset
void setDebugSectionOffset(uint64_t O)
Definition: DIE.h:917
llvm::DIELoc::emitValue
void emitValue(const AsmPrinter *Asm, dwarf::Form Form) const
EmitValue - Emit location data.
Definition: DIE.cpp:722
llvm::DIE::generateAbbrev
DIEAbbrev generateAbbrev() const
Generate the abbreviation for this DIE.
Definition: DIE.cpp:180
llvm::DIEUnit::DIEUnit
DIEUnit(dwarf::Tag UnitTag)
Definition: DIE.cpp:312
llvm::DIEString::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit string value.
Definition: DIE.cpp:571
llvm::DIEDelta::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit delta value.
Definition: DIE.cpp:539
llvm::DIEString::sizeOf
unsigned sizeOf(const dwarf::FormParams &FormParams, dwarf::Form Form) const
sizeOf - Determine size of delta value in bytes.
Definition: DIE.cpp:595
llvm::IntrusiveBackList::iterator::operator++
iterator & operator++()
Definition: DIE.h:601
llvm::DIEInlineString::~DIEInlineString
~DIEInlineString()=default
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:239
llvm::DIEBlock::emitValue
void emitValue(const AsmPrinter *Asm, dwarf::Form Form) const
EmitValue - Emit block data.
Definition: DIE.cpp:772
llvm::DIE::operator=
DIE & operator=(const DIE &RHS)=delete
llvm::BasicDIEUnit::BasicDIEUnit
BasicDIEUnit(dwarf::Tag UnitTag)
Definition: DIE.h:924
uint64_t
llvm::DIEValue::getAttribute
dwarf::Attribute getAttribute() const
Definition: DIE.h:488
llvm::DIEValue::getType
Type getType() const
Accessors.
Definition: DIE.h:487
Addr
uint64_t Addr
Definition: ELFObjHandler.cpp:78
llvm::DIELabel::DIELabel
DIELabel(const MCSymbol *L)
Definition: DIE.h:222
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:63
llvm::DIEBaseTypeRef
A BaseTypeRef DIE.
Definition: DIE.h:235
iterator.h
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::DIE::getParent
DIE * getParent() const
Definition: DIE.cpp:176
llvm::iterator_facade_base
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition: iterator.h:80
llvm::DIELoc
DIELoc - Represents an expression location.
Definition: DIE.h:930
llvm::DIEUnit::getSection
MCSection * getSection() const
Return the section that this DIEUnit will be emitted into.
Definition: DIE.h:916
llvm::dwarf::FormParams
A helper struct providing information about the byte size of DW_FORM values that vary in size dependi...
Definition: Dwarf.h:653
llvm::DIEAbbrev::setChildrenFlag
void setChildrenFlag(bool hasChild)
Definition: DIE.h:104
llvm::IntrusiveBackListBase::push_front
void push_front(Node &N)
Definition: DIE.h:543
llvm::IntrusiveBackList::const_iterator::const_iterator
const_iterator(const T *N)
Definition: DIE.h:621
llvm::DIEExpr::DIEExpr
DIEExpr(const MCExpr *E)
Definition: DIE.h:205
llvm::DIEValueList::const_value_iterator::const_value_iterator
const_value_iterator(ListTy::const_iterator X)
Definition: DIE.h:703
llvm::DIEEntry::DIEEntry
DIEEntry(DIE &E)
Definition: DIE.h:319
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::IntrusiveBackList::end
const_iterator end() const
Definition: DIE.h:641
llvm::DIEValueList::value_iterator::value_iterator
value_iterator(ListTy::iterator X)
Definition: DIE.h:686
PointerUnion.h
iterator_range.h
llvm::DIEEntry
A pointer to another debug information entry.
Definition: DIE.h:314
llvm::DIEInteger::emitValue
void emitValue(const AsmPrinter *Asm, dwarf::Form Form) const
EmitValue - Emit integer of appropriate size.
Definition: DIE.cpp:370
llvm::DIEValue::emitValue
void emitValue(const AsmPrinter *AP) const
Emit value via the Dwarf writer.
Definition: DIE.cpp:321
llvm::DIEEntry::print
void print(raw_ostream &O) const
Definition: DIE.cpp:703
llvm::IntrusiveBackListNode::Next
PointerIntPair< IntrusiveBackListNode *, 1 > Next
Definition: DIE.h:516
llvm::IntrusiveBackList::const_iterator
Definition: DIE.h:612
llvm::IntrusiveBackList::const_iterator::operator*
const T & operator*() const
Definition: DIE.h:629
llvm::DIEInlineString::getString
StringRef getString() const
Grab the string out of the object.
Definition: DIE.h:302
llvm::size
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
Definition: STLExtras.h:1588
llvm::DIEAbbrev::getTag
dwarf::Tag getTag() const
Accessors.
Definition: DIE.h:100
llvm::DIEAbbrev::hasChildren
bool hasChildren() const
Definition: DIE.h:102
llvm::DIEAbbrevSet::DIEAbbrevSet
DIEAbbrevSet(BumpPtrAllocator &A)
Definition: DIE.h:145
llvm::FoldingSet
FoldingSet - This template class is used to instantiate a specialized implementation of the folding s...
Definition: FoldingSet.h:519
llvm::IntrusiveBackList::iterator::iterator
iterator()=default
llvm::DIEBaseTypeRef::sizeOf
unsigned sizeOf(const dwarf::FormParams &, dwarf::Form) const
sizeOf - Determine size of the base type reference in bytes.
Definition: DIE.cpp:526
llvm::IntrusiveBackList::toIterator
static const_iterator toIterator(const T &N)
Definition: DIE.h:644
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
Dwarf.h
this
Analysis the ScalarEvolution expression for r is this
Definition: README.txt:8
llvm::DIEExpr
An expression DIE.
Definition: DIE.h:201
llvm::FoldingSetBase::Node
Node - This class is used to maintain the singly linked bucket list in a folding set.
Definition: FoldingSet.h:135
llvm::IntrusiveBackList::takeNodes
void takeNodes(IntrusiveBackList< T > &Other)
Definition: DIE.h:571
llvm::DIEExpr::getValue
const MCExpr * getValue() const
Get MCExpr.
Definition: DIE.h:208
Number
uint32_t Number
Definition: Profile.cpp:47
llvm::DIE::children
child_range children()
Definition: DIE.h:795
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:317
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::DIE::get
static DIE * get(BumpPtrAllocator &Alloc, dwarf::Tag Tag)
Definition: DIE.h:769
llvm::DIEValue::Type
Type
Definition: DIE.h:371
llvm::IntrusiveBackList::iterator::operator==
bool operator==(const iterator &X) const
Definition: DIE.h:609
llvm::IntrusiveBackList::iterator
Definition: DIE.h:591
llvm::DIEDelta::DIEDelta
DIEDelta(const MCSymbol *Hi, const MCSymbol *Lo)
Definition: DIE.h:261
llvm::IntrusiveBackList::begin
const_iterator begin() const
Definition: DIE.h:637
llvm::DIEValue::sizeOf
unsigned sizeOf(const dwarf::FormParams &FormParams) const
Return the size of a value in bytes.
Definition: DIE.cpp:333
llvm::DIEInteger::print
void print(raw_ostream &O) const
Definition: DIE.cpp:448
llvm::PointerUnion
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
Definition: PointerUnion.h:112
FoldingSet.h
llvm::DIEValueList::value_iterator::value_iterator
value_iterator()=default
llvm::DIEEntry::getEntry
DIE & getEntry() const
Definition: DIE.h:321
llvm::IntrusiveBackListBase::Last
Node * Last
Definition: DIE.h:528
llvm::DIELabel::print
void print(raw_ostream &O) const
Definition: DIE.cpp:514
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:209
llvm::DIEBlock::print
void print(raw_ostream &O) const
Definition: DIE.cpp:805
llvm::IntrusiveBackList::const_iterator::const_iterator
const_iterator()=default
llvm::DIEAbbrev::dump
void dump() const
Definition: DIE.cpp:126
llvm::DIELoc::BestForm
dwarf::Form BestForm(unsigned DwarfVersion) const
BestForm - Choose the best form for data.
Definition: DIE.h:944
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:81
llvm::DIELoc::computeSize
unsigned computeSize(const dwarf::FormParams &FormParams) const
Calculate the size of the location expression.
Definition: DIE.cpp:711
llvm::DIEValue::isNone
@ isNone
Definition: DIE.h:372
llvm::DIEUnit::setSection
void setSection(MCSection *Section)
Set the section that this DIEUnit will be emitted into.
Definition: DIE.h:904
llvm::DIEBaseTypeRef::getIndex
uint64_t getIndex() const
Definition: DIE.h:250
llvm::IntrusiveBackListNode
Definition: DIE.h:515
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:216
llvm::DIEInteger::BestForm
static dwarf::Form BestForm(bool IsSigned, uint64_t Int)
Choose the best form for integer.
Definition: DIE.h:170
llvm::IntrusiveBackList::const_iterator::operator==
bool operator==(const const_iterator &X) const
Definition: DIE.h:631
llvm::PointerIntPair
PointerIntPair - This class implements a pair of a pointer and small integer.
Definition: PointerIntPair.h:46
llvm::DIEValue::~DIEValue
~DIEValue()
Definition: DIE.h:470
SmallVector.h
llvm::IntrusiveBackList::begin
iterator begin()
Definition: DIE.h:634
Allocator
Basic Register Allocator
Definition: RegAllocBasic.cpp:142
List
const NodeList & List
Definition: RDFGraph.cpp:199
N
#define N
llvm::DIEAddrOffset::DIEAddrOffset
DIEAddrOffset(uint64_t Idx, const MCSymbol *Hi, const MCSymbol *Lo)
Definition: DIE.h:355
llvm::DIELoc::print
void print(raw_ostream &O) const
Definition: DIE.cpp:753
llvm::IntrusiveBackList
Definition: DIE.h:556
llvm::DIE::hasChildren
bool hasChildren() const
Definition: DIE.h:787
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
llvm::DIEAddrOffset::sizeOf
unsigned sizeOf(const dwarf::FormParams &FormParams, dwarf::Form Form) const
Definition: DIE.cpp:854
llvm::HexStyle::Asm
@ Asm
0ffh
Definition: MCInstPrinter.h:34
llvm::DIEBlock::setSize
void setSize(unsigned size)
Definition: DIE.h:976
llvm::DIEInteger::sizeOf
unsigned sizeOf(const dwarf::FormParams &FormParams, dwarf::Form Form) const
sizeOf - Determine size of integer value in bytes.
Definition: DIE.cpp:426
llvm::DIEAbbrev::getNumber
unsigned getNumber() const
Definition: DIE.h:101
llvm::DIELocList::DIELocList
DIELocList(size_t I)
Definition: DIE.h:337
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::DIEValueList::const_value_iterator::const_value_iterator
const_value_iterator()=default
llvm::DIEAddrOffset::print
void print(raw_ostream &O) const
Definition: DIE.cpp:868
llvm::DIE::setAbbrevNumber
void setAbbrevNumber(unsigned I)
Set the abbreviation number for this DIE.
Definition: DIE.h:811
llvm::DIEAbbrevData::DIEAbbrevData
DIEAbbrevData(dwarf::Attribute A, int64_t V)
Definition: DIE.h:62
CU
Definition: AArch64AsmBackend.cpp:505
llvm::DIELabel
A label DIE.
Definition: DIE.h:218
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
llvm::DIEString::print
void print(raw_ostream &O) const
Definition: DIE.cpp:616
llvm::DIEUnit::getUnitDie
DIE & getUnitDie()
Definition: DIE.h:919
llvm::DIEInlineString::print
void print(raw_ostream &O) const
Definition: DIE.cpp:638
llvm::IntrusiveBackList::front
T & front()
Definition: DIE.h:564
llvm::ISD::MCSymbol
@ MCSymbol
Definition: ISDOpcodes.h:172
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1225