LLVM  13.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 AsmPrinter *AP, 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 AsmPrinter *AP, 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 AsmPrinter *AP, 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 AsmPrinter *AP, dwarf::Form 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 AsmPrinter *AP, 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 AsmPrinter *AP, 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 AsmPrinter *AP, dwarf::Form 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 AsmPrinter *AP, 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 AsmPrinter *AP, 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 AsmPrinter *AP, 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 AsmPrinter *AP) 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 =
697  std::forward_iterator_tag, const DIEValue>;
698 
699  public:
700  const_value_iterator() = default;
702  : iterator_adaptor(X.wrapped()) {}
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 { return Offset; }
778  unsigned getSize() const { return Size; }
779  bool hasChildren() const { return ForceChildren || !Children.empty(); }
780  void setForceChildren(bool B) { ForceChildren = B; }
781 
786 
788  return make_range(Children.begin(), Children.end());
789  }
791  return make_range(Children.begin(), Children.end());
792  }
793 
794  DIE *getParent() const;
795 
796  /// Generate the abbreviation for this DIE.
797  ///
798  /// Calculate the abbreviation for this, which should be uniqued and
799  /// eventually used to call \a setAbbrevNumber().
800  DIEAbbrev generateAbbrev() const;
801 
802  /// Set the abbreviation number for this DIE.
803  void setAbbrevNumber(unsigned I) { AbbrevNumber = I; }
804 
805  /// Get the absolute offset within the .debug_info or .debug_types section
806  /// for this DIE.
807  uint64_t getDebugSectionOffset() const;
808 
809  /// Compute the offset of this DIE and all its children.
810  ///
811  /// This function gets called just before we are going to generate the debug
812  /// information and gives each DIE a chance to figure out its CU relative DIE
813  /// offset, unique its abbreviation and fill in the abbreviation code, and
814  /// return the unit offset that points to where the next DIE will be emitted
815  /// within the debug unit section. After this function has been called for all
816  /// DIE objects, the DWARF can be generated since all DIEs will be able to
817  /// properly refer to other DIE objects since all DIEs have calculated their
818  /// offsets.
819  ///
820  /// \param AP AsmPrinter to use when calculating sizes.
821  /// \param AbbrevSet the abbreviation used to unique DIE abbreviations.
822  /// \param CUOffset the compile/type unit relative offset in bytes.
823  /// \returns the offset for the DIE that follows this DIE within the
824  /// current compile/type unit.
825  unsigned computeOffsetsAndAbbrevs(const AsmPrinter *AP,
826  DIEAbbrevSet &AbbrevSet, unsigned CUOffset);
827 
828  /// Climb up the parent chain to get the compile unit or type unit DIE that
829  /// this DIE belongs to.
830  ///
831  /// \returns the compile or type unit DIE that owns this DIE, or NULL if
832  /// this DIE hasn't been added to a unit DIE.
833  const DIE *getUnitDie() const;
834 
835  /// Climb up the parent chain to get the compile unit or type unit that this
836  /// DIE belongs to.
837  ///
838  /// \returns the DIEUnit that represents the compile or type unit that owns
839  /// this DIE, or NULL if this DIE hasn't been added to a unit DIE.
840  DIEUnit *getUnit() const;
841 
842  void setOffset(unsigned O) { Offset = O; }
843  void setSize(unsigned S) { Size = S; }
844 
845  /// Add a child to the DIE.
846  DIE &addChild(DIE *Child) {
847  assert(!Child->getParent() && "Child should be orphaned");
848  Child->Owner = this;
849  Children.push_back(*Child);
850  return Children.back();
851  }
852 
853  DIE &addChildFront(DIE *Child) {
854  assert(!Child->getParent() && "Child should be orphaned");
855  Child->Owner = this;
856  Children.push_front(*Child);
857  return Children.front();
858  }
859 
860  /// Find a value in the DIE with the attribute given.
861  ///
862  /// Returns a default-constructed DIEValue (where \a DIEValue::getType()
863  /// gives \a DIEValue::isNone) if no such attribute exists.
865 
866  void print(raw_ostream &O, unsigned IndentCount = 0) const;
867  void dump() const;
868 };
869 
870 //===--------------------------------------------------------------------===//
871 /// Represents a compile or type unit.
872 class DIEUnit {
873  /// The compile unit or type unit DIE. This variable must be an instance of
874  /// DIE so that we can calculate the DIEUnit from any DIE by traversing the
875  /// parent backchain and getting the Unit DIE, and then casting itself to a
876  /// DIEUnit. This allows us to be able to find the DIEUnit for any DIE without
877  /// having to store a pointer to the DIEUnit in each DIE instance.
878  DIE Die;
879  /// The section this unit will be emitted in. This may or may not be set to
880  /// a valid section depending on the client that is emitting DWARF.
881  MCSection *Section;
882  uint64_t Offset; /// .debug_info or .debug_types absolute section offset.
883 protected:
884  virtual ~DIEUnit() = default;
885 
886 public:
887  explicit DIEUnit(dwarf::Tag UnitTag);
888  DIEUnit(const DIEUnit &RHS) = delete;
889  DIEUnit(DIEUnit &&RHS) = delete;
890  void operator=(const DIEUnit &RHS) = delete;
891  void operator=(const DIEUnit &&RHS) = delete;
892  /// Set the section that this DIEUnit will be emitted into.
893  ///
894  /// This function is used by some clients to set the section. Not all clients
895  /// that emit DWARF use this section variable.
896  void setSection(MCSection *Section) {
897  assert(!this->Section);
898  this->Section = Section;
899  }
900 
902  return nullptr;
903  }
904 
905  /// Return the section that this DIEUnit will be emitted into.
906  ///
907  /// \returns Section pointer which can be NULL.
908  MCSection *getSection() const { return Section; }
909  void setDebugSectionOffset(uint64_t O) { Offset = O; }
910  uint64_t getDebugSectionOffset() const { return Offset; }
911  DIE &getUnitDie() { return Die; }
912  const DIE &getUnitDie() const { return Die; }
913 };
914 
915 struct BasicDIEUnit final : DIEUnit {
916  explicit BasicDIEUnit(dwarf::Tag UnitTag) : DIEUnit(UnitTag) {}
917 };
918 
919 //===--------------------------------------------------------------------===//
920 /// DIELoc - Represents an expression location.
921 //
922 class DIELoc : public DIEValueList {
923  mutable unsigned Size = 0; // Size in bytes excluding size header.
924 
925 public:
926  DIELoc() = default;
927 
928  /// ComputeSize - Calculate the size of the location expression.
929  ///
930  unsigned ComputeSize(const AsmPrinter *AP) const;
931 
932  // TODO: move setSize() and Size to DIEValueList.
933  void setSize(unsigned size) { Size = size; }
934 
935  /// BestForm - Choose the best form for data.
936  ///
937  dwarf::Form BestForm(unsigned DwarfVersion) const {
938  if (DwarfVersion > 3)
939  return dwarf::DW_FORM_exprloc;
940  // Pre-DWARF4 location expressions were blocks and not exprloc.
941  if ((unsigned char)Size == Size)
942  return dwarf::DW_FORM_block1;
943  if ((unsigned short)Size == Size)
944  return dwarf::DW_FORM_block2;
945  if ((unsigned int)Size == Size)
946  return dwarf::DW_FORM_block4;
947  return dwarf::DW_FORM_block;
948  }
949 
950  void emitValue(const AsmPrinter *Asm, dwarf::Form Form) const;
951  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
952 
953  void print(raw_ostream &O) const;
954 };
955 
956 //===--------------------------------------------------------------------===//
957 /// DIEBlock - Represents a block of values.
958 //
959 class DIEBlock : public DIEValueList {
960  mutable unsigned Size = 0; // Size in bytes excluding size header.
961 
962 public:
963  DIEBlock() = default;
964 
965  /// ComputeSize - Calculate the size of the location expression.
966  ///
967  unsigned ComputeSize(const AsmPrinter *AP) const;
968 
969  // TODO: move setSize() and Size to DIEValueList.
970  void setSize(unsigned size) { Size = size; }
971 
972  /// BestForm - Choose the best form for data.
973  ///
975  if ((unsigned char)Size == Size)
976  return dwarf::DW_FORM_block1;
977  if ((unsigned short)Size == Size)
978  return dwarf::DW_FORM_block2;
979  if ((unsigned int)Size == Size)
980  return dwarf::DW_FORM_block4;
981  return dwarf::DW_FORM_block;
982  }
983 
984  void emitValue(const AsmPrinter *Asm, dwarf::Form Form) const;
985  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
986 
987  void print(raw_ostream &O) const;
988 };
989 
990 } // end namespace llvm
991 
992 #endif // LLVM_CODEGEN_DIE_H
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
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: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::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:494
llvm
Definition: AllocatorList.h:23
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::DIEDelta::SizeOf
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of delta value in bytes.
Definition: DIE.cpp:549
llvm::DIE::children
const_child_range children() const
Definition: DIE.h:790
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:57
StringRef.h
llvm::DwarfCompileUnit
Definition: DwarfCompileUnit.h:47
llvm::DIEEntry::SizeOf
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
Definition: DIE.cpp:680
llvm::DIEValue
Definition: DIE.h:369
llvm::DIEUnit
Represents a compile or type unit.
Definition: DIE.h:872
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:247
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:146
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::DIEInteger::getValue
uint64_t getValue() const
Definition: DIE.h:190
llvm::dwarf::Form
Form
Definition: Dwarf.h:131
llvm::MipsISD::Lo
@ Lo
Definition: MipsISelLowering.h:79
llvm::DIEAddrOffset::emitValue
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const
EmitValue - Emit label value.
Definition: DIE.cpp:870
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:915
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::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:211
llvm::copy
OutputIt copy(R &&Range, OutputIt Out)
Definition: STLExtras.h:1533
llvm::IntrusiveBackListBase::empty
bool empty() const
Definition: DIE.h:530
llvm::DIEString::DIEString
DIEString(DwarfStringPoolEntryRef S)
Definition: DIE.h:277
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: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::DIELoc::DIELoc
DIELoc()=default
AlignOf.h
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::iterator_adaptor_base< value_iterator, ListTy::iterator, std::forward_iterator_tag, DIEValue >::wrapped
const ListTy::iterator & wrapped() const
Definition: iterator.h:226
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: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
llvm::DIEUnit::getDebugSectionOffset
uint64_t getDebugSectionOffset() const
Definition: DIE.h:910
llvm::DIEDelta::print
void print(raw_ostream &O) const
Definition: DIE.cpp:563
llvm::DIEValueList::value_iterator::operator*
DIEValue & operator*() const
Definition: DIE.h:689
llvm::Data
@ Data
Definition: SIMachineScheduler.h:56
llvm::DwarfStringPoolEntryRef
String pool entry reference.
Definition: DwarfStringPoolEntry.h:31
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::getValue
size_t getValue() const
Grab the current index out.
Definition: DIE.h:340
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::MipsISD::Hi
@ Hi
Definition: MipsISelLowering.h:75
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:846
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::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:78
llvm::DIEValue::dump
void dump() const
Definition: DIE.cpp:364
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:846
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
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:974
llvm::DIEInteger::SizeOf
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of integer value in bytes.
Definition: DIE.cpp:430
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:853
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:68
llvm::DIE::setForceChildren
void setForceChildren(bool B)
Definition: DIE.h:780
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:524
llvm::DIEDelta
A simple label difference DIE.
Definition: DIE.h:256
llvm::DIEValueList::values
const_value_range values() const
Definition: DIE.h:730
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::DIEBlock::DIEBlock
DIEBlock()=default
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Integer
So we should use XX3Form_Rcr to implement instrinsic 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::DIEUnit::getUnitDie
const DIE & getUnitDie() const
Definition: DIE.h:912
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::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:50
llvm::DIEValueList::const_value_iterator
Definition: DIE.h:692
DwarfStringPoolEntry.h
llvm::DIEAbbrevSet::~DIEAbbrevSet
~DIEAbbrevSet()
Definition: DIE.cpp:141
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:170
llvm::DIEBlock
DIEBlock - Represents a block of values.
Definition: DIE.h:959
Node::Node
Node(Kind K_, Cache RHSComponentCache_=Cache::No, Cache ArrayCache_=Cache::No, Cache FunctionCache_=Cache::No)
Definition: ItaniumDemangle.h:144
llvm::DIEValue::DIEValue
DIEValue(const DIEValue &X)
Definition: DIE.h:457
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: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::DIEString
A container for string pool string values.
Definition: DIE.h:273
llvm::DIE::setSize
void setSize(unsigned S)
Definition: DIE.h:843
llvm::DIE::getSize
unsigned getSize() const
Definition: DIE.h:778
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:933
llvm::DIELocList::print
void print(raw_ostream &O) const
Definition: DIE.cpp:857
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:466
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:909
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::IntrusiveBackList::iterator::operator++
iterator & operator++()
Definition: DIE.h:601
llvm::DIEInlineString::~DIEInlineString
~DIEInlineString()=default
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:132
llvm::DIEBlock::emitValue
void emitValue(const AsmPrinter *Asm, dwarf::Form Form) const
EmitValue - Emit block data.
Definition: DIE.cpp:782
llvm::DIE::operator=
DIE & operator=(const DIE &RHS)=delete
llvm::BasicDIEUnit::BasicDIEUnit
BasicDIEUnit(dwarf::Tag UnitTag)
Definition: DIE.h:916
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:80
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:67
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
llvm::DIEBaseTypeRef
A BaseTypeRef DIE.
Definition: DIE.h:235
iterator.h
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::DIE::getParent
DIE * getParent() const
Definition: DIE.cpp:182
llvm::iterator_facade_base
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition: iterator.h:66
llvm::DIELoc
DIELoc - Represents an expression location.
Definition: DIE.h:922
llvm::DIEUnit::getSection
MCSection * getSection() const
Return the section that this DIEUnit will be emitted into.
Definition: DIE.h:908
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::DIEBlock::ComputeSize
unsigned ComputeSize(const AsmPrinter *AP) const
ComputeSize - Calculate the size of the location expression.
Definition: DIE.cpp:771
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: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::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:1463
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:493
llvm::IntrusiveBackList::iterator::iterator
iterator()=default
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:57
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:133
llvm::IntrusiveBackList::takeNodes
void takeNodes(IntrusiveBackList< T > &Other)
Definition: DIE.h:571
const_iterator
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: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
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
Node
Definition: ItaniumDemangle.h:114
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::DIEInteger::print
void print(raw_ostream &O) const
Definition: DIE.cpp:455
llvm::PointerUnion
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
Definition: PointerUnion.h:149
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: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::DIEBlock::print
void print(raw_ostream &O) const
Definition: DIE.cpp:815
llvm::IntrusiveBackList::const_iterator::const_iterator
const_iterator()=default
llvm::DIEAbbrev::dump
void dump() const
Definition: DIE.cpp:132
llvm::DIELocList::SizeOf
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
Definition: DIE.cpp:823
llvm::DIELoc::BestForm
dwarf::Form BestForm(unsigned DwarfVersion) const
BestForm - Choose the best form for data.
Definition: DIE.h:937
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::DIEUnit::setSection
void setSection(MCSection *Section)
Set the section that this DIEUnit will be emitted into.
Definition: DIE.h:896
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:221
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:45
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:146
List
const NodeList & List
Definition: RDFGraph.cpp:201
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:761
llvm::IntrusiveBackList
Definition: DIE.h:556
llvm::DIE::hasChildren
bool hasChildren() const
Definition: DIE.h:779
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:43
llvm::HexStyle::Asm
@ Asm
0ffh
Definition: MCInstPrinter.h:34
llvm::DIEBlock::setSize
void setSize(unsigned size)
Definition: DIE.h:970
llvm::DIEAbbrev::getNumber
unsigned getNumber() const
Definition: DIE.h:101
llvm::DIELocList::DIELocList
DIELocList(size_t I)
Definition: DIE.h:337
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
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: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
true
basic Basic Alias true
Definition: BasicAliasAnalysis.cpp:1797
llvm::DIEAbbrevData::DIEAbbrevData
DIEAbbrevData(dwarf::Attribute A, int64_t V)
Definition: DIE.h:62
CU
Definition: AArch64AsmBackend.cpp:506
llvm::DIELabel
A label DIE.
Definition: DIE.h:218
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
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:617
llvm::DIEUnit::getUnitDie
DIE & getUnitDie()
Definition: DIE.h:911
llvm::DIEInlineString::print
void print(raw_ostream &O) const
Definition: DIE.cpp:639
llvm::IntrusiveBackList::front
T & front()
Definition: DIE.h:564
llvm::ISD::MCSymbol
@ MCSymbol
Definition: ISDOpcodes.h:165
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1167
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:38
llvm::DIEString::SizeOf
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const
SizeOf - Determine size of delta value in bytes.
Definition: DIE.cpp:597