David Blaikie | 319a05f | 2013-12-02 19:33:10 +0000 | [diff] [blame] | 1 | //===-- llvm/CodeGen/DwarfUnit.h - Dwarf Compile Unit ---*- C++ -*--===// |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains support for writing dwarf compile unit. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 14 | #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFUNIT_H |
| 15 | #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFUNIT_H |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 16 | |
Eric Christopher | 9e429ae | 2013-10-05 00:27:02 +0000 | [diff] [blame] | 17 | #include "DwarfDebug.h" |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 18 | #include "llvm/ADT/DenseMap.h" |
David Blaikie | f244319 | 2013-10-21 17:28:37 +0000 | [diff] [blame] | 19 | #include "llvm/ADT/Optional.h" |
Chandler Carruth | 802d755 | 2012-12-04 07:12:27 +0000 | [diff] [blame] | 20 | #include "llvm/ADT/StringMap.h" |
Adrian Prantl | 702bf5a | 2014-03-18 02:34:52 +0000 | [diff] [blame] | 21 | #include "llvm/CodeGen/AsmPrinter.h" |
Frederic Riss | e541e0b | 2015-01-05 21:29:41 +0000 | [diff] [blame] | 22 | #include "llvm/CodeGen/DIE.h" |
Chandler Carruth | 12664a0 | 2014-03-06 00:22:06 +0000 | [diff] [blame] | 23 | #include "llvm/IR/DIBuilder.h" |
Chandler Carruth | 9a4c9e5 | 2014-03-06 00:46:21 +0000 | [diff] [blame] | 24 | #include "llvm/IR/DebugInfo.h" |
Chandler Carruth | d990388 | 2015-01-14 11:23:27 +0000 | [diff] [blame] | 25 | #include "llvm/MC/MCDwarf.h" |
David Blaikie | f3cd7c5 | 2013-06-28 20:05:04 +0000 | [diff] [blame] | 26 | #include "llvm/MC/MCExpr.h" |
David Blaikie | 7d73460 | 2013-12-06 22:33:05 +0000 | [diff] [blame] | 27 | #include "llvm/MC/MCSection.h" |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 28 | |
| 29 | namespace llvm { |
| 30 | |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 31 | class MachineLocation; |
| 32 | class MachineOperand; |
| 33 | class ConstantInt; |
David Blaikie | a39a76e | 2013-01-20 01:18:01 +0000 | [diff] [blame] | 34 | class ConstantFP; |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 35 | class DbgVariable; |
David Blaikie | 15632ae | 2014-02-12 00:31:30 +0000 | [diff] [blame] | 36 | class DwarfCompileUnit; |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 37 | |
Eric Christopher | 0f63d06 | 2013-12-03 00:45:45 +0000 | [diff] [blame] | 38 | // Data structure to hold a range for range lists. |
| 39 | class RangeSpan { |
| 40 | public: |
| 41 | RangeSpan(MCSymbol *S, MCSymbol *E) : Start(S), End(E) {} |
Eric Christopher | 270ba4a | 2013-12-04 19:06:58 +0000 | [diff] [blame] | 42 | const MCSymbol *getStart() const { return Start; } |
| 43 | const MCSymbol *getEnd() const { return End; } |
Eric Christopher | 384f3fe | 2014-03-20 19:16:16 +0000 | [diff] [blame] | 44 | void setEnd(const MCSymbol *E) { End = E; } |
Eric Christopher | 0f63d06 | 2013-12-03 00:45:45 +0000 | [diff] [blame] | 45 | |
| 46 | private: |
| 47 | const MCSymbol *Start, *End; |
| 48 | }; |
| 49 | |
| 50 | class RangeSpanList { |
| 51 | private: |
| 52 | // Index for locating within the debug_range section this particular span. |
Eric Christopher | f879064 | 2013-12-04 22:04:50 +0000 | [diff] [blame] | 53 | MCSymbol *RangeSym; |
Eric Christopher | 0f63d06 | 2013-12-03 00:45:45 +0000 | [diff] [blame] | 54 | // List of ranges. |
| 55 | SmallVector<RangeSpan, 2> Ranges; |
| 56 | |
| 57 | public: |
David Blaikie | 5b02a19 | 2014-11-03 23:10:59 +0000 | [diff] [blame] | 58 | RangeSpanList(MCSymbol *Sym, SmallVector<RangeSpan, 2> Ranges) |
| 59 | : RangeSym(Sym), Ranges(std::move(Ranges)) {} |
Eric Christopher | f879064 | 2013-12-04 22:04:50 +0000 | [diff] [blame] | 60 | MCSymbol *getSym() const { return RangeSym; } |
Eric Christopher | 0f63d06 | 2013-12-03 00:45:45 +0000 | [diff] [blame] | 61 | const SmallVectorImpl<RangeSpan> &getRanges() const { return Ranges; } |
| 62 | void addRange(RangeSpan Range) { Ranges.push_back(Range); } |
| 63 | }; |
| 64 | |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 65 | //===----------------------------------------------------------------------===// |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 66 | /// This dwarf writer support class manages information associated with a |
| 67 | /// source file. |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 68 | class DwarfUnit { |
David Blaikie | 319a05f | 2013-12-02 19:33:10 +0000 | [diff] [blame] | 69 | protected: |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 70 | /// A numeric ID unique among all CUs in the module |
Eli Bendersky | b42d146 | 2012-12-03 18:45:45 +0000 | [diff] [blame] | 71 | unsigned UniqueID; |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 72 | |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 73 | /// MDNode for the compile unit. |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 74 | const DICompileUnit *CUNode; |
David Blaikie | 7480ae6 | 2014-01-09 03:03:27 +0000 | [diff] [blame] | 75 | |
Duncan P. N. Exon Smith | 4fb1f9c | 2015-06-25 23:46:41 +0000 | [diff] [blame] | 76 | // All DIEValues are allocated through this allocator. |
| 77 | BumpPtrAllocator DIEValueAllocator; |
| 78 | |
David Blaikie | 2a80e44 | 2013-12-02 22:09:48 +0000 | [diff] [blame] | 79 | /// Unit debug information entry. |
Duncan P. N. Exon Smith | 827200c | 2015-06-25 23:52:10 +0000 | [diff] [blame] | 80 | DIE &UnitDie; |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 81 | |
David Blaikie | 2a80e44 | 2013-12-02 22:09:48 +0000 | [diff] [blame] | 82 | /// Offset of the UnitDie from beginning of debug info section. |
Eric Christopher | a16725b | 2013-11-21 01:29:16 +0000 | [diff] [blame] | 83 | unsigned DebugInfoOffset; |
| 84 | |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 85 | /// Target of Dwarf emission. |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 86 | AsmPrinter *Asm; |
| 87 | |
Eric Christopher | e698f53 | 2012-12-20 21:58:36 +0000 | [diff] [blame] | 88 | // Holders for some common dwarf information. |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 89 | DwarfDebug *DD; |
Eric Christopher | f819485 | 2013-12-05 18:06:10 +0000 | [diff] [blame] | 90 | DwarfFile *DU; |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 91 | |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 92 | /// An anonymous type for index type. Owned by UnitDie. |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 93 | DIE *IndexTyDie; |
| 94 | |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 95 | /// Tracks the mapping of unit level debug information variables to debug |
| 96 | /// information entries. |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 97 | DenseMap<const MDNode *, DIE *> MDNodeToDieMap; |
| 98 | |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 99 | /// A list of all the DIEBlocks in use. |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 100 | std::vector<DIEBlock *> DIEBlocks; |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 101 | |
| 102 | /// A list of all the DIELocs in use. |
Eric Christopher | 4a74104 | 2014-02-16 08:46:55 +0000 | [diff] [blame] | 103 | std::vector<DIELoc *> DIELocs; |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 104 | |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 105 | /// This map is used to keep track of subprogram DIEs that need |
| 106 | /// DW_AT_containing_type attribute. This attribute points to a DIE that |
Devang Patel | 8954371 | 2011-08-15 17:24:54 +0000 | [diff] [blame] | 107 | /// corresponds to the MDNode mapped with the subprogram DIE. |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 108 | DenseMap<DIE *, const DINode *> ContainingTypeMap; |
Devang Patel | 8954371 | 2011-08-15 17:24:54 +0000 | [diff] [blame] | 109 | |
David Blaikie | 03073f7 | 2013-12-06 22:14:48 +0000 | [diff] [blame] | 110 | /// The section this unit will be emitted in. |
Rafael Espindola | 0709a7b | 2015-05-21 19:20:38 +0000 | [diff] [blame] | 111 | MCSection *Section; |
David Blaikie | 03073f7 | 2013-12-06 22:14:48 +0000 | [diff] [blame] | 112 | |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 113 | DwarfUnit(unsigned UID, dwarf::Tag, const DICompileUnit *CU, AsmPrinter *A, |
David Blaikie | bd57905 | 2014-04-28 21:14:27 +0000 | [diff] [blame] | 114 | DwarfDebug *DW, DwarfFile *DWU); |
David Blaikie | 319a05f | 2013-12-02 19:33:10 +0000 | [diff] [blame] | 115 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 116 | /// Add a string attribute data and value. |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 117 | /// |
| 118 | /// This is guaranteed to be in the local string pool instead of indirected. |
David Blaikie | cafd962 | 2014-11-02 08:51:37 +0000 | [diff] [blame] | 119 | void addLocalString(DIE &Die, dwarf::Attribute Attribute, StringRef Str); |
| 120 | |
| 121 | void addIndexedString(DIE &Die, dwarf::Attribute Attribute, StringRef Str); |
| 122 | |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 123 | bool applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie); |
David Blaikie | 3a443c2 | 2014-11-04 22:12:25 +0000 | [diff] [blame] | 124 | |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 125 | public: |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 126 | virtual ~DwarfUnit(); |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 127 | |
Rafael Espindola | 0709a7b | 2015-05-21 19:20:38 +0000 | [diff] [blame] | 128 | void initSection(MCSection *Section); |
Rafael Espindola | 063d725 | 2015-03-10 16:58:10 +0000 | [diff] [blame] | 129 | |
Rafael Espindola | 0709a7b | 2015-05-21 19:20:38 +0000 | [diff] [blame] | 130 | MCSection *getSection() const { |
David Blaikie | 03073f7 | 2013-12-06 22:14:48 +0000 | [diff] [blame] | 131 | assert(Section); |
| 132 | return Section; |
| 133 | } |
| 134 | |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 135 | // Accessors. |
Adrian Prantl | 00dbc2a | 2015-01-12 22:19:26 +0000 | [diff] [blame] | 136 | AsmPrinter* getAsmPrinter() const { return Asm; } |
Eric Christopher | ca68bbf | 2013-08-26 23:58:22 +0000 | [diff] [blame] | 137 | unsigned getUniqueID() const { return UniqueID; } |
Duncan P. N. Exon Smith | 35ef22c | 2015-04-15 23:19:27 +0000 | [diff] [blame] | 138 | uint16_t getLanguage() const { return CUNode->getSourceLanguage(); } |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 139 | const DICompileUnit *getCUNode() const { return CUNode; } |
David Blaikie | bd57905 | 2014-04-28 21:14:27 +0000 | [diff] [blame] | 140 | DIE &getUnitDie() { return UnitDie; } |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 141 | |
Manman Ren | ce20d46 | 2013-10-29 22:57:10 +0000 | [diff] [blame] | 142 | unsigned getDebugInfoOffset() const { return DebugInfoOffset; } |
| 143 | void setDebugInfoOffset(unsigned DbgInfoOff) { DebugInfoOffset = DbgInfoOff; } |
| 144 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 145 | /// Return true if this compile unit has something to write out. |
Duncan P. N. Exon Smith | 8d3197f | 2015-05-28 19:56:34 +0000 | [diff] [blame] | 146 | bool hasContent() const { return UnitDie.hasChildren(); } |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 147 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 148 | /// Get string containing language specific context for a global name. |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 149 | /// |
| 150 | /// Walks the metadata parent chain in a language specific manner (using the |
| 151 | /// compile unit language) and returns it as a string. This is done at the |
| 152 | /// metadata level because DIEs may not currently have been added to the |
| 153 | /// parent context and walking the DIEs looking for names is more expensive |
| 154 | /// than walking the metadata. |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 155 | std::string getParentContextString(const DIScope *Context) const; |
Eric Christopher | 2c8b790 | 2013-10-17 02:06:06 +0000 | [diff] [blame] | 156 | |
David Blaikie | 98cf172 | 2014-11-02 06:06:14 +0000 | [diff] [blame] | 157 | /// Add a new global name to the compile unit. |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 158 | virtual void addGlobalName(StringRef Name, DIE &Die, const DIScope *Context) { |
Duncan P. N. Exon Smith | be9e4fe | 2015-04-20 18:32:29 +0000 | [diff] [blame] | 159 | } |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 160 | |
David Blaikie | 98cf172 | 2014-11-02 06:06:14 +0000 | [diff] [blame] | 161 | /// Add a new global type to the compile unit. |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 162 | virtual void addGlobalType(const DIType *Ty, const DIE &Die, |
| 163 | const DIScope *Context) {} |
David Blaikie | 98cf172 | 2014-11-02 06:06:14 +0000 | [diff] [blame] | 164 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 165 | /// Add a new name to the namespace accelerator table. |
David Blaikie | 65a7466 | 2014-04-25 18:26:14 +0000 | [diff] [blame] | 166 | void addAccelNamespace(StringRef Name, const DIE &Die); |
Eric Christopher | 9cd26af | 2013-09-20 23:22:52 +0000 | [diff] [blame] | 167 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 168 | /// Returns the DIE map slot for the specified debug variable. |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 169 | /// |
| 170 | /// We delegate the request to DwarfDebug when the MDNode can be part of the |
| 171 | /// type system, since DIEs for the type system can be shared across CUs and |
| 172 | /// the mappings are kept in DwarfDebug. |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 173 | DIE *getDIE(const DINode *D) const; |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 174 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 175 | /// Returns a fresh newly allocated DIELoc. |
Duncan P. N. Exon Smith | e7e1d0c | 2015-05-27 22:14:58 +0000 | [diff] [blame] | 176 | DIELoc *getDIELoc() { return new (DIEValueAllocator) DIELoc; } |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 177 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 178 | /// Insert DIE into the map. |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 179 | /// |
| 180 | /// We delegate the request to DwarfDebug when the MDNode can be part of the |
| 181 | /// type system, since DIEs for the type system can be shared across CUs and |
| 182 | /// the mappings are kept in DwarfDebug. |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 183 | void insertDIE(const DINode *Desc, DIE *D); |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 184 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 185 | /// Add a flag that is true to the DIE. |
David Blaikie | 65a7466 | 2014-04-25 18:26:14 +0000 | [diff] [blame] | 186 | void addFlag(DIE &Die, dwarf::Attribute Attribute); |
Eric Christopher | 48fef59 | 2012-12-20 21:58:40 +0000 | [diff] [blame] | 187 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 188 | /// Add an unsigned integer attribute data and value. |
David Blaikie | 65a7466 | 2014-04-25 18:26:14 +0000 | [diff] [blame] | 189 | void addUInt(DIE &Die, dwarf::Attribute Attribute, Optional<dwarf::Form> Form, |
David Blaikie | f244319 | 2013-10-21 17:28:37 +0000 | [diff] [blame] | 190 | uint64_t Integer); |
| 191 | |
David Blaikie | 65a7466 | 2014-04-25 18:26:14 +0000 | [diff] [blame] | 192 | void addUInt(DIE &Block, dwarf::Form Form, uint64_t Integer); |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 193 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 194 | /// Add an signed integer attribute data and value. |
David Blaikie | 65a7466 | 2014-04-25 18:26:14 +0000 | [diff] [blame] | 195 | void addSInt(DIE &Die, dwarf::Attribute Attribute, Optional<dwarf::Form> Form, |
David Blaikie | f244319 | 2013-10-21 17:28:37 +0000 | [diff] [blame] | 196 | int64_t Integer); |
| 197 | |
David Blaikie | 65a7466 | 2014-04-25 18:26:14 +0000 | [diff] [blame] | 198 | void addSInt(DIELoc &Die, Optional<dwarf::Form> Form, int64_t Integer); |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 199 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 200 | /// Add a string attribute data and value. |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 201 | /// |
| 202 | /// We always emit a reference to the string pool instead of immediate |
| 203 | /// strings so that DIEs have more predictable sizes. In the case of split |
| 204 | /// dwarf we emit an index into another table which gets us the static offset |
| 205 | /// into the string table. |
Craig Topper | 6dc4a8bc | 2014-08-30 16:48:02 +0000 | [diff] [blame] | 206 | void addString(DIE &Die, dwarf::Attribute Attribute, StringRef Str); |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 207 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 208 | /// Add a Dwarf label attribute data and value. |
Duncan P. N. Exon Smith | 4fb1f9c | 2015-06-25 23:46:41 +0000 | [diff] [blame] | 209 | DIE::value_iterator addLabel(DIE &Die, dwarf::Attribute Attribute, |
| 210 | dwarf::Form Form, const MCSymbol *Label); |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 211 | |
David Blaikie | 65a7466 | 2014-04-25 18:26:14 +0000 | [diff] [blame] | 212 | void addLabel(DIELoc &Die, dwarf::Form Form, const MCSymbol *Label); |
David Blaikie | f244319 | 2013-10-21 17:28:37 +0000 | [diff] [blame] | 213 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 214 | /// Add an offset into a section attribute data and value. |
David Blaikie | 65a7466 | 2014-04-25 18:26:14 +0000 | [diff] [blame] | 215 | void addSectionOffset(DIE &Die, dwarf::Attribute Attribute, uint64_t Integer); |
Eric Christopher | 33ff697 | 2013-11-21 23:46:41 +0000 | [diff] [blame] | 216 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 217 | /// Add a dwarf op address data and value using the form given and an |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 218 | /// op of either DW_FORM_addr or DW_FORM_GNU_addr_index. |
David Blaikie | 65a7466 | 2014-04-25 18:26:14 +0000 | [diff] [blame] | 219 | void addOpAddress(DIELoc &Die, const MCSymbol *Label); |
Eric Christopher | e9ec245 | 2013-01-18 22:11:33 +0000 | [diff] [blame] | 220 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 221 | /// Add a label delta attribute data and value. |
David Blaikie | 65a7466 | 2014-04-25 18:26:14 +0000 | [diff] [blame] | 222 | void addLabelDelta(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, |
David Blaikie | 48b1bdc | 2014-03-07 01:30:55 +0000 | [diff] [blame] | 223 | const MCSymbol *Lo); |
| 224 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 225 | /// Add a DIE attribute data and value. |
David Blaikie | 8dbcc3f | 2014-04-25 19:33:43 +0000 | [diff] [blame] | 226 | void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry); |
Eric Christopher | 48fef59 | 2012-12-20 21:58:40 +0000 | [diff] [blame] | 227 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 228 | /// Add a DIE attribute data and value. |
Duncan P. N. Exon Smith | e7e1d0c | 2015-05-27 22:14:58 +0000 | [diff] [blame] | 229 | void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIEEntry Entry); |
Manman Ren | 4dbdc90 | 2013-10-31 17:54:35 +0000 | [diff] [blame] | 230 | |
David Blaikie | 65a7466 | 2014-04-25 18:26:14 +0000 | [diff] [blame] | 231 | void addDIETypeSignature(DIE &Die, const DwarfTypeUnit &Type); |
David Blaikie | 47f615e | 2013-12-17 23:32:35 +0000 | [diff] [blame] | 232 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 233 | /// Add block data. |
David Blaikie | 65a7466 | 2014-04-25 18:26:14 +0000 | [diff] [blame] | 234 | void addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Block); |
Eric Christopher | 4a74104 | 2014-02-16 08:46:55 +0000 | [diff] [blame] | 235 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 236 | /// Add block data. |
David Blaikie | 65a7466 | 2014-04-25 18:26:14 +0000 | [diff] [blame] | 237 | void addBlock(DIE &Die, dwarf::Attribute Attribute, DIEBlock *Block); |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 238 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 239 | /// Add location information to specified debug information entry. |
David Blaikie | 65a7466 | 2014-04-25 18:26:14 +0000 | [diff] [blame] | 240 | void addSourceLine(DIE &Die, unsigned Line, StringRef File, |
David Blaikie | 101613e | 2014-02-12 00:11:25 +0000 | [diff] [blame] | 241 | StringRef Directory); |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 242 | void addSourceLine(DIE &Die, const DILocalVariable *V); |
| 243 | void addSourceLine(DIE &Die, const DIGlobalVariable *G); |
| 244 | void addSourceLine(DIE &Die, const DISubprogram *SP); |
| 245 | void addSourceLine(DIE &Die, const DIType *Ty); |
| 246 | void addSourceLine(DIE &Die, const DINamespace *NS); |
| 247 | void addSourceLine(DIE &Die, const DIObjCProperty *Ty); |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 248 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 249 | /// Add constant value entry in variable DIE. |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 250 | void addConstantValue(DIE &Die, const MachineOperand &MO, const DIType *Ty); |
| 251 | void addConstantValue(DIE &Die, const ConstantInt *CI, const DIType *Ty); |
| 252 | void addConstantValue(DIE &Die, const APInt &Val, const DIType *Ty); |
David Blaikie | 65a7466 | 2014-04-25 18:26:14 +0000 | [diff] [blame] | 253 | void addConstantValue(DIE &Die, const APInt &Val, bool Unsigned); |
David Blaikie | 60cae1b | 2014-05-11 16:08:41 +0000 | [diff] [blame] | 254 | void addConstantValue(DIE &Die, bool Unsigned, uint64_t Val); |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 255 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 256 | /// Add constant value entry in variable DIE. |
David Blaikie | 65a7466 | 2014-04-25 18:26:14 +0000 | [diff] [blame] | 257 | void addConstantFPValue(DIE &Die, const MachineOperand &MO); |
| 258 | void addConstantFPValue(DIE &Die, const ConstantFP *CFP); |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 259 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 260 | /// Add a linkage name, if it isn't empty. |
Paul Robinson | 857b443 | 2015-03-10 22:44:45 +0000 | [diff] [blame] | 261 | void addLinkageName(DIE &Die, StringRef LinkageName); |
| 262 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 263 | /// Add template parameters in buffer. |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 264 | void addTemplateParams(DIE &Buffer, DINodeArray TParams); |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 265 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 266 | /// Add register operand. |
Adrian Prantl | ab255fc | 2014-12-05 01:02:46 +0000 | [diff] [blame] | 267 | /// \returns false if the register does not exist, e.g., because it was never |
| 268 | /// materialized. |
| 269 | bool addRegisterOpPiece(DIELoc &TheDie, unsigned Reg, |
Adrian Prantl | b141683 | 2014-08-01 22:11:58 +0000 | [diff] [blame] | 270 | unsigned SizeInBits = 0, unsigned OffsetInBits = 0); |
Devang Patel | ba5fbf1 | 2011-04-26 19:06:18 +0000 | [diff] [blame] | 271 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 272 | /// Add register offset. |
Adrian Prantl | ab255fc | 2014-12-05 01:02:46 +0000 | [diff] [blame] | 273 | /// \returns false if the register does not exist, e.g., because it was never |
| 274 | /// materialized. |
| 275 | bool addRegisterOffset(DIELoc &TheDie, unsigned Reg, int64_t Offset); |
Devang Patel | ba5fbf1 | 2011-04-26 19:06:18 +0000 | [diff] [blame] | 276 | |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 277 | // FIXME: Should be reformulated in terms of addComplexAddress. |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 278 | /// Start with the address based on the location provided, and generate the |
| 279 | /// DWARF information necessary to find the actual Block variable (navigating |
| 280 | /// the Block struct) based on the starting location. Add the DWARF |
| 281 | /// information to the die. Obsolete, please use addComplexAddress instead. |
David Blaikie | 65a7466 | 2014-04-25 18:26:14 +0000 | [diff] [blame] | 282 | void addBlockByrefAddress(const DbgVariable &DV, DIE &Die, |
Eric Christopher | a07e4f5 | 2013-11-19 09:28:34 +0000 | [diff] [blame] | 283 | dwarf::Attribute Attribute, |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 284 | const MachineLocation &Location); |
| 285 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 286 | /// Add a new type attribute to the specified entity. |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 287 | /// |
| 288 | /// This takes and attribute parameter because DW_AT_friend attributes are |
| 289 | /// also type references. |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 290 | void addType(DIE &Entity, const DIType *Ty, |
Eric Christopher | a07e4f5 | 2013-11-19 09:28:34 +0000 | [diff] [blame] | 291 | dwarf::Attribute Attribute = dwarf::DW_AT_type); |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 292 | |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 293 | DIE *getOrCreateNameSpace(const DINamespace *NS); |
Adrian Prantl | 08a388b | 2015-06-30 02:13:04 +0000 | [diff] [blame] | 294 | DIE *getOrCreateModule(const DIModule *M); |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 295 | DIE *getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal = false); |
Devang Patel | 8954371 | 2011-08-15 17:24:54 +0000 | [diff] [blame] | 296 | |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 297 | void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, |
David Blaikie | 279c451 | 2014-11-02 08:18:06 +0000 | [diff] [blame] | 298 | bool Minimal = false); |
David Blaikie | 7f91686 | 2014-05-27 18:37:38 +0000 | [diff] [blame] | 299 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 300 | /// Find existing DIE or create new DIE for the given type. |
David Blaikie | d51dea6 | 2015-07-01 18:07:16 +0000 | [diff] [blame] | 301 | DIE *getOrCreateTypeDIE(const MDNode *N); |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 302 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 303 | /// Get context owner's DIE. |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 304 | DIE *createTypeDIE(const DICompositeType *Ty); |
David Blaikie | 409dd9c | 2013-11-19 23:08:21 +0000 | [diff] [blame] | 305 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 306 | /// Get context owner's DIE. |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 307 | DIE *getOrCreateContextDIE(const DIScope *Context); |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 308 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 309 | /// Construct DIEs for types that contain vtables. |
Eric Christopher | fa205ca | 2013-10-05 00:05:51 +0000 | [diff] [blame] | 310 | void constructContainingTypeDIEs(); |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 311 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 312 | /// Construct function argument DIEs. |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 313 | void constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args); |
Adrian Prantl | 69140d2 | 2014-02-25 22:27:14 +0000 | [diff] [blame] | 314 | |
Manman Ren | b987e51 | 2013-10-29 00:53:03 +0000 | [diff] [blame] | 315 | /// Create a DIE with the given Tag, add the DIE to its parent, and |
| 316 | /// call insertDIE if MD is not null. |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 317 | DIE &createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N = nullptr); |
Manman Ren | b987e51 | 2013-10-29 00:53:03 +0000 | [diff] [blame] | 318 | |
David Blaikie | 6b288cf | 2013-10-30 20:42:41 +0000 | [diff] [blame] | 319 | /// Compute the size of a header for this unit, not including the initial |
| 320 | /// length field. |
David Blaikie | bc56327 | 2013-12-13 21:33:40 +0000 | [diff] [blame] | 321 | virtual unsigned getHeaderSize() const { |
David Blaikie | 6b288cf | 2013-10-30 20:42:41 +0000 | [diff] [blame] | 322 | return sizeof(int16_t) + // DWARF version number |
| 323 | sizeof(int32_t) + // Offset Into Abbrev. Section |
| 324 | sizeof(int8_t); // Pointer Size (in bytes) |
| 325 | } |
| 326 | |
| 327 | /// Emit the header for this unit, not including the initial length field. |
Rafael Espindola | 063d725 | 2015-03-10 16:58:10 +0000 | [diff] [blame] | 328 | virtual void emitHeader(bool UseOffsets); |
David Blaikie | 6b288cf | 2013-10-30 20:42:41 +0000 | [diff] [blame] | 329 | |
David Blaikie | 15632ae | 2014-02-12 00:31:30 +0000 | [diff] [blame] | 330 | virtual DwarfCompileUnit &getCU() = 0; |
David Blaikie | d696fac | 2014-02-12 00:32:05 +0000 | [diff] [blame] | 331 | |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 332 | void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy); |
David Blaikie | e12b49a | 2014-04-26 17:27:38 +0000 | [diff] [blame] | 333 | |
David Blaikie | 319a05f | 2013-12-02 19:33:10 +0000 | [diff] [blame] | 334 | protected: |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 335 | /// Create new static data member DIE. |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 336 | DIE *getOrCreateStaticMemberDIE(const DIDerivedType *DT); |
David Blaikie | 319a05f | 2013-12-02 19:33:10 +0000 | [diff] [blame] | 337 | |
David Blaikie | 4a2f95f | 2014-03-18 01:17:26 +0000 | [diff] [blame] | 338 | /// Look up the source ID with the given directory and source file names. If |
| 339 | /// none currently exists, create a new ID and insert it in the line table. |
| 340 | virtual unsigned getOrCreateSourceID(StringRef File, StringRef Directory) = 0; |
| 341 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 342 | /// Look in the DwarfDebug map for the MDNode that corresponds to the |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 343 | /// reference. |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 344 | template <typename T> T *resolve(TypedDINodeRef<T> Ref) const { |
Duncan P. N. Exon Smith | 000fa2c | 2015-04-07 04:14:33 +0000 | [diff] [blame] | 345 | return DD->resolve(Ref); |
| 346 | } |
David Blaikie | 58410f2 | 2014-10-10 06:39:26 +0000 | [diff] [blame] | 347 | |
Eric Christopher | fa205ca | 2013-10-05 00:05:51 +0000 | [diff] [blame] | 348 | private: |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 349 | void constructTypeDIE(DIE &Buffer, const DIBasicType *BTy); |
| 350 | void constructTypeDIE(DIE &Buffer, const DIDerivedType *DTy); |
| 351 | void constructTypeDIE(DIE &Buffer, const DISubroutineType *DTy); |
| 352 | void constructSubrangeDIE(DIE &Buffer, const DISubrange *SR, DIE *IndexTy); |
| 353 | void constructArrayTypeDIE(DIE &Buffer, const DICompositeType *CTy); |
| 354 | void constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy); |
| 355 | void constructMemberDIE(DIE &Buffer, const DIDerivedType *DT); |
Manman Ren | ffc9a71 | 2013-10-23 23:05:28 +0000 | [diff] [blame] | 356 | void constructTemplateTypeParameterDIE(DIE &Buffer, |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 357 | const DITemplateTypeParameter *TP); |
Manman Ren | ffc9a71 | 2013-10-23 23:05:28 +0000 | [diff] [blame] | 358 | void constructTemplateValueParameterDIE(DIE &Buffer, |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 359 | const DITemplateValueParameter *TVP); |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 360 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 361 | /// Return the default lower bound for an array. |
Duncan P. N. Exon Smith | d89ef16 | 2015-04-20 20:29:51 +0000 | [diff] [blame] | 362 | /// |
| 363 | /// If the DWARF version doesn't handle the language, return -1. |
Eric Christopher | fa205ca | 2013-10-05 00:05:51 +0000 | [diff] [blame] | 364 | int64_t getDefaultLowerBound() const; |
| 365 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 366 | /// Get an anonymous type for index type. |
David Blaikie | 871c2d9 | 2014-11-02 03:09:13 +0000 | [diff] [blame] | 367 | DIE *getIndexTyDie(); |
Eric Christopher | fa205ca | 2013-10-05 00:05:51 +0000 | [diff] [blame] | 368 | |
Adrian Prantl | 857237e | 2015-07-13 18:25:29 +0000 | [diff] [blame^] | 369 | /// Set D as anonymous type for index which can be reused later. |
Eric Christopher | fa205ca | 2013-10-05 00:05:51 +0000 | [diff] [blame] | 370 | void setIndexTyDie(DIE *D) { IndexTyDie = D; } |
| 371 | |
David Blaikie | 2ea848b | 2013-11-19 22:51:04 +0000 | [diff] [blame] | 372 | /// If this is a named finished type then include it in the list of types for |
| 373 | /// the accelerator tables. |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 374 | void updateAcceleratorTables(const DIScope *Context, const DIType *Ty, |
Duncan P. N. Exon Smith | be9e4fe | 2015-04-20 18:32:29 +0000 | [diff] [blame] | 375 | const DIE &TyDIE); |
David Blaikie | cafd962 | 2014-11-02 08:51:37 +0000 | [diff] [blame] | 376 | |
| 377 | virtual bool isDwoUnit() const = 0; |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 378 | }; |
| 379 | |
Eric Christopher | 4287a49 | 2013-12-09 23:57:44 +0000 | [diff] [blame] | 380 | class DwarfTypeUnit : public DwarfUnit { |
David Blaikie | bc56327 | 2013-12-13 21:33:40 +0000 | [diff] [blame] | 381 | uint64_t TypeSignature; |
| 382 | const DIE *Ty; |
David Blaikie | 15632ae | 2014-02-12 00:31:30 +0000 | [diff] [blame] | 383 | DwarfCompileUnit &CU; |
David Blaikie | 8287aff | 2014-03-18 02:13:23 +0000 | [diff] [blame] | 384 | MCDwarfDwoLineTable *SplitLineTable; |
David Blaikie | 319a05f | 2013-12-02 19:33:10 +0000 | [diff] [blame] | 385 | |
David Blaikie | cafd962 | 2014-11-02 08:51:37 +0000 | [diff] [blame] | 386 | unsigned getOrCreateSourceID(StringRef File, StringRef Directory) override; |
| 387 | bool isDwoUnit() const override; |
| 388 | |
David Blaikie | 319a05f | 2013-12-02 19:33:10 +0000 | [diff] [blame] | 389 | public: |
David Blaikie | bd57905 | 2014-04-28 21:14:27 +0000 | [diff] [blame] | 390 | DwarfTypeUnit(unsigned UID, DwarfCompileUnit &CU, AsmPrinter *A, |
| 391 | DwarfDebug *DW, DwarfFile *DWU, |
David Blaikie | 8287aff | 2014-03-18 02:13:23 +0000 | [diff] [blame] | 392 | MCDwarfDwoLineTable *SplitLineTable = nullptr); |
David Blaikie | 319a05f | 2013-12-02 19:33:10 +0000 | [diff] [blame] | 393 | |
David Blaikie | bc56327 | 2013-12-13 21:33:40 +0000 | [diff] [blame] | 394 | void setTypeSignature(uint64_t Signature) { TypeSignature = Signature; } |
David Blaikie | 47f615e | 2013-12-17 23:32:35 +0000 | [diff] [blame] | 395 | uint64_t getTypeSignature() const { return TypeSignature; } |
David Blaikie | bc56327 | 2013-12-13 21:33:40 +0000 | [diff] [blame] | 396 | void setType(const DIE *Ty) { this->Ty = Ty; } |
| 397 | |
David Blaikie | bc56327 | 2013-12-13 21:33:40 +0000 | [diff] [blame] | 398 | /// Emit the header for this unit, not including the initial length field. |
Rafael Espindola | 063d725 | 2015-03-10 16:58:10 +0000 | [diff] [blame] | 399 | void emitHeader(bool UseOffsets) override; |
Craig Topper | 7315602 | 2014-03-02 09:09:27 +0000 | [diff] [blame] | 400 | unsigned getHeaderSize() const override { |
David Blaikie | bc56327 | 2013-12-13 21:33:40 +0000 | [diff] [blame] | 401 | return DwarfUnit::getHeaderSize() + sizeof(uint64_t) + // Type Signature |
| 402 | sizeof(uint32_t); // Type DIE Offset |
| 403 | } |
Craig Topper | 7315602 | 2014-03-02 09:09:27 +0000 | [diff] [blame] | 404 | DwarfCompileUnit &getCU() override { return CU; } |
David Blaikie | 319a05f | 2013-12-02 19:33:10 +0000 | [diff] [blame] | 405 | }; |
Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 406 | } // end llvm namespace |
Devang Patel | 5eb4319 | 2011-04-12 17:40:32 +0000 | [diff] [blame] | 407 | #endif |