blob: 4d66447ec3a6ba031056ed94103edbf775193d34 [file] [log] [blame]
Eugene Zelenko6e07bfd2017-08-17 21:26:39 +00001//===- llvm/CodeGen/DwarfCompileUnit.h - Dwarf Compile Unit -----*- C++ -*-===//
David Blaikie37c52312014-10-04 15:49:50 +00002//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
David Blaikie37c52312014-10-04 15:49:50 +00006//
7//===----------------------------------------------------------------------===//
8//
9// This file contains support for writing dwarf compile unit.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H
14#define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H
15
Eugene Zelenko6e07bfd2017-08-17 21:26:39 +000016#include "DwarfDebug.h"
David Blaikie37c52312014-10-04 15:49:50 +000017#include "DwarfUnit.h"
Eugene Zelenko6e07bfd2017-08-17 21:26:39 +000018#include "llvm/ADT/ArrayRef.h"
19#include "llvm/ADT/DenseMap.h"
20#include "llvm/ADT/SmallVector.h"
21#include "llvm/ADT/StringMap.h"
22#include "llvm/ADT/StringRef.h"
Zachary Turner264b5d92017-06-07 03:48:56 +000023#include "llvm/BinaryFormat/Dwarf.h"
Yonghong Song61b189e2018-12-18 23:10:17 +000024#include "llvm/CodeGen/DbgEntityHistoryCalculator.h"
Eugene Zelenko6e07bfd2017-08-17 21:26:39 +000025#include "llvm/CodeGen/DIE.h"
26#include "llvm/CodeGen/LexicalScopes.h"
27#include "llvm/IR/DebugInfoMetadata.h"
28#include "llvm/Support/Casting.h"
29#include <algorithm>
30#include <cassert>
31#include <cstdint>
32#include <memory>
David Blaikie37c52312014-10-04 15:49:50 +000033
34namespace llvm {
35
36class AsmPrinter;
David Blaikie37c52312014-10-04 15:49:50 +000037class DwarfFile;
Eugene Zelenko6e07bfd2017-08-17 21:26:39 +000038class GlobalVariable;
39class MCExpr;
David Blaikie37c52312014-10-04 15:49:50 +000040class MCSymbol;
Eugene Zelenko6e07bfd2017-08-17 21:26:39 +000041class MDNode;
David Blaikie37c52312014-10-04 15:49:50 +000042
David Blaikiec0bb21f2017-04-22 02:18:00 +000043class DwarfCompileUnit final : public DwarfUnit {
Peter Collingbourne7c384cc2016-02-11 19:57:46 +000044 /// A numeric ID unique among all CUs in the module
45 unsigned UniqueID;
David Blaikiec4af8bf2018-10-20 07:36:39 +000046 bool HasRangeLists = false;
Peter Collingbourne7c384cc2016-02-11 19:57:46 +000047
David Blaikie37c52312014-10-04 15:49:50 +000048 /// The attribute index of DW_AT_stmt_list in the compile unit DIE, avoiding
49 /// the need to search for it in applyStmtList.
Duncan P. N. Exon Smith4fb1f9c2015-06-25 23:46:41 +000050 DIE::value_iterator StmtListValue;
David Blaikie37c52312014-10-04 15:49:50 +000051
David Blaikie7cbf58a2014-11-01 18:18:07 +000052 /// Skeleton unit associated with this unit.
Eugene Zelenko6e07bfd2017-08-17 21:26:39 +000053 DwarfCompileUnit *Skeleton = nullptr;
David Blaikie7cbf58a2014-11-01 18:18:07 +000054
David Blaikief4bdc312014-11-02 01:21:40 +000055 /// The start of the unit within its section.
56 MCSymbol *LabelBegin;
57
Amjad Aboud8bbce8a2016-02-01 14:09:41 +000058 /// The start of the unit macro info within macro section.
59 MCSymbol *MacroLabelBegin;
60
Eugene Zelenko6e07bfd2017-08-17 21:26:39 +000061 using ImportedEntityList = SmallVector<const MDNode *, 8>;
62 using ImportedEntityMap = DenseMap<const MDNode *, ImportedEntityList>;
Ivan Krasin298639a2015-10-26 21:36:35 +000063
Amjad Aboud72da9392016-04-30 01:44:07 +000064 ImportedEntityMap ImportedEntities;
Ivan Krasin298639a2015-10-26 21:36:35 +000065
David Blaikie192b45c2014-11-02 06:16:39 +000066 /// GlobalNames - A map of globally visible named entities for this unit.
67 StringMap<const DIE *> GlobalNames;
68
69 /// GlobalTypes - A map of globally visible types for this unit.
70 StringMap<const DIE *> GlobalTypes;
71
David Blaikiebc532b42014-11-03 16:40:43 +000072 // List of ranges for a given compile unit.
David Blaikie5b02a192014-11-03 23:10:59 +000073 SmallVector<RangeSpan, 2> CURanges;
David Blaikiebc532b42014-11-03 16:40:43 +000074
David Blaikiece343492014-11-03 21:15:30 +000075 // The base address of this unit, if any. Used for relative references in
76 // ranges/locs.
Eugene Zelenko6e07bfd2017-08-17 21:26:39 +000077 const MCSymbol *BaseAddress = nullptr;
David Blaikiece343492014-11-03 21:15:30 +000078
David Blaikie488393f2017-05-12 01:13:45 +000079 DenseMap<const MDNode *, DIE *> AbstractSPDies;
Hsiangkai Wang2532ac82018-08-17 15:22:04 +000080 DenseMap<const DINode *, std::unique_ptr<DbgEntity>> AbstractEntities;
David Blaikie488393f2017-05-12 01:13:45 +000081
Paul Robinson543c0e12018-05-22 17:27:31 +000082 /// DWO ID for correlating skeleton and split units.
83 uint64_t DWOId = 0;
84
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000085 /// Construct a DIE for the given DbgVariable without initializing the
David Blaikieee7df552014-10-09 17:56:36 +000086 /// DbgVariable's DIE reference.
Duncan P. N. Exon Smith827200c2015-06-25 23:52:10 +000087 DIE *constructVariableDIEImpl(const DbgVariable &DV, bool Abstract);
David Blaikieee7df552014-10-09 17:56:36 +000088
David Blaikiecafd9622014-11-02 08:51:37 +000089 bool isDwoUnit() const override;
90
David Blaikie488393f2017-05-12 01:13:45 +000091 DenseMap<const MDNode *, DIE *> &getAbstractSPDies() {
92 if (isDwoUnit() && !DD->shareAcrossDWOCUs())
93 return AbstractSPDies;
94 return DU->getAbstractSPDies();
95 }
96
Hsiangkai Wang2532ac82018-08-17 15:22:04 +000097 DenseMap<const DINode *, std::unique_ptr<DbgEntity>> &getAbstractEntities() {
David Blaikie488393f2017-05-12 01:13:45 +000098 if (isDwoUnit() && !DD->shareAcrossDWOCUs())
Hsiangkai Wang2532ac82018-08-17 15:22:04 +000099 return AbstractEntities;
100 return DU->getAbstractEntities();
David Blaikie488393f2017-05-12 01:13:45 +0000101 }
102
David Blaikie37c52312014-10-04 15:49:50 +0000103public:
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000104 DwarfCompileUnit(unsigned UID, const DICompileUnit *Node, AsmPrinter *A,
David Blaikie37c52312014-10-04 15:49:50 +0000105 DwarfDebug *DW, DwarfFile *DWU);
106
David Blaikiec4af8bf2018-10-20 07:36:39 +0000107 bool hasRangeLists() const { return HasRangeLists; }
Peter Collingbourne7c384cc2016-02-11 19:57:46 +0000108 unsigned getUniqueID() const { return UniqueID; }
Peter Collingbourne7c384cc2016-02-11 19:57:46 +0000109
David Blaikiea33cd6a2014-11-01 00:50:34 +0000110 DwarfCompileUnit *getSkeleton() const {
David Blaikiea5437b62014-11-01 19:26:05 +0000111 return Skeleton;
David Blaikiea33cd6a2014-11-01 00:50:34 +0000112 }
113
David Blaikieb3cee2f2017-05-25 18:50:28 +0000114 bool includeMinimalInlineScopes() const;
115
Rafael Espindola063d7252015-03-10 16:58:10 +0000116 void initStmtList();
David Blaikie37c52312014-10-04 15:49:50 +0000117
118 /// Apply the DW_AT_stmt_list from this compile unit to the specified DIE.
119 void applyStmtList(DIE &D);
120
Adrian Prantlbceaaa92016-12-20 02:09:43 +0000121 /// A pair of GlobalVariable and DIExpression.
122 struct GlobalExpr {
123 const GlobalVariable *Var;
124 const DIExpression *Expr;
125 };
126
Markus Lavinb86ce212019-03-19 13:16:28 +0000127 struct BaseTypeRef {
128 BaseTypeRef(unsigned BitSize, dwarf::TypeKind Encoding) :
129 BitSize(BitSize), Encoding(Encoding) {}
130 unsigned BitSize;
131 dwarf::TypeKind Encoding;
132 DIE *Die = nullptr;
133 };
134
135 std::vector<BaseTypeRef> ExprRefedBaseTypes;
136
Adrian Prantlbceaaa92016-12-20 02:09:43 +0000137 /// Get or create global variable DIE.
138 DIE *
139 getOrCreateGlobalVariableDIE(const DIGlobalVariable *GV,
140 ArrayRef<GlobalExpr> GlobalExprs);
David Blaikie37c52312014-10-04 15:49:50 +0000141
Adrian Prantl6ed57062019-04-08 19:13:55 +0000142 DIE *getOrCreateCommonBlock(const DICommonBlock *CB,
143 ArrayRef<GlobalExpr> GlobalExprs);
144
145 void addLocationAttribute(DIE *ToDIE, const DIGlobalVariable *GV,
146 ArrayRef<GlobalExpr> GlobalExprs);
147
David Blaikie37c52312014-10-04 15:49:50 +0000148 /// addLabelAddress - Add a dwarf label attribute data and value using
149 /// either DW_FORM_addr or DW_FORM_GNU_addr_index.
150 void addLabelAddress(DIE &Die, dwarf::Attribute Attribute,
151 const MCSymbol *Label);
152
153 /// addLocalLabelAddress - Add a dwarf label attribute data and value using
154 /// DW_FORM_addr only.
155 void addLocalLabelAddress(DIE &Die, dwarf::Attribute Attribute,
156 const MCSymbol *Label);
157
158 DwarfCompileUnit &getCU() override { return *this; }
159
Paul Robinson612e89d2018-01-12 19:17:50 +0000160 unsigned getOrCreateSourceID(const DIFile *File) override;
David Blaikie37c52312014-10-04 15:49:50 +0000161
Amjad Aboud72da9392016-04-30 01:44:07 +0000162 void addImportedEntity(const DIImportedEntity* IE) {
163 DIScope *Scope = IE->getScope();
Amjad Abouda5ba9912016-04-21 16:58:49 +0000164 assert(Scope && "Invalid Scope encoding!");
165 if (!isa<DILocalScope>(Scope))
166 // No need to add imported enities that are not local declaration.
167 return;
168
169 auto *LocalScope = cast<DILocalScope>(Scope)->getNonLexicalBlockFileScope();
Amjad Aboud72da9392016-04-30 01:44:07 +0000170 ImportedEntities[LocalScope].push_back(IE);
Ivan Krasin298639a2015-10-26 21:36:35 +0000171 }
172
David Blaikie37c52312014-10-04 15:49:50 +0000173 /// addRange - Add an address range to the list of ranges for this unit.
174 void addRange(RangeSpan Range);
David Blaikie14499a72014-10-04 15:58:47 +0000175
176 void attachLowHighPC(DIE &D, const MCSymbol *Begin, const MCSymbol *End);
David Blaikiecda2aa82014-10-04 16:24:00 +0000177
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000178 /// Find DIE for the given subprogram and attach appropriate
David Blaikiecda2aa82014-10-04 16:24:00 +0000179 /// DW_AT_low_pc and DW_AT_high_pc attributes. If there are global
180 /// variables in this scope then create and insert DIEs for these
181 /// variables.
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000182 DIE &updateSubprogramScopeDIE(const DISubprogram *SP);
David Blaikie9c65b132014-10-08 22:20:02 +0000183
184 void constructScopeDIE(LexicalScope *Scope,
Duncan P. N. Exon Smith827200c2015-06-25 23:52:10 +0000185 SmallVectorImpl<DIE *> &FinalChildren);
David Blaikie52400202014-10-09 00:11:39 +0000186
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000187 /// A helper function to construct a RangeSpanList for a given
David Blaikie52400202014-10-09 00:11:39 +0000188 /// lexical scope.
David Blaikie5b02a192014-11-03 23:10:59 +0000189 void addScopeRangeList(DIE &ScopeDIE, SmallVector<RangeSpan, 2> Range);
190
191 void attachRangesOrLowHighPC(DIE &D, SmallVector<RangeSpan, 2> Ranges);
David Blaikiede123752014-10-09 00:21:42 +0000192
193 void attachRangesOrLowHighPC(DIE &D,
194 const SmallVectorImpl<InsnRange> &Ranges);
Eugene Zelenko6e07bfd2017-08-17 21:26:39 +0000195
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000196 /// This scope represents inlined body of a function. Construct
David Blaikie01b48a82014-10-09 16:50:53 +0000197 /// DIE to represent this concrete inlined copy of the function.
Duncan P. N. Exon Smith827200c2015-06-25 23:52:10 +0000198 DIE *constructInlinedScopeDIE(LexicalScope *Scope);
David Blaikie0fbf8bd2014-10-09 17:08:42 +0000199
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000200 /// Construct new DW_TAG_lexical_block for this scope and
David Blaikie0fbf8bd2014-10-09 17:08:42 +0000201 /// attach DW_AT_low_pc/DW_AT_high_pc labels.
Duncan P. N. Exon Smith827200c2015-06-25 23:52:10 +0000202 DIE *constructLexicalScopeDIE(LexicalScope *Scope);
David Blaikieee7df552014-10-09 17:56:36 +0000203
204 /// constructVariableDIE - Construct a DIE for the given DbgVariable.
Duncan P. N. Exon Smith827200c2015-06-25 23:52:10 +0000205 DIE *constructVariableDIE(DbgVariable &DV, bool Abstract = false);
David Blaikie4a1a44e2014-10-09 17:56:39 +0000206
Duncan P. N. Exon Smith827200c2015-06-25 23:52:10 +0000207 DIE *constructVariableDIE(DbgVariable &DV, const LexicalScope &Scope,
208 DIE *&ObjectPointer);
David Blaikie8b2fdb82014-10-09 18:24:28 +0000209
Hsiangkai Wang2532ac82018-08-17 15:22:04 +0000210 /// Construct a DIE for the given DbgLabel.
211 DIE *constructLabelDIE(DbgLabel &DL, const LexicalScope &Scope);
212
David Blaikie8b2fdb82014-10-09 18:24:28 +0000213 /// A helper function to create children of a Scope DIE.
214 DIE *createScopeChildrenDIE(LexicalScope *Scope,
Duncan P. N. Exon Smith827200c2015-06-25 23:52:10 +0000215 SmallVectorImpl<DIE *> &Children,
David Blaikie2195e132017-07-27 00:06:53 +0000216 bool *HasNonScopeChildren = nullptr);
David Blaikie1d072342014-10-09 20:21:36 +0000217
Markus Lavinb86ce212019-03-19 13:16:28 +0000218 void createBaseTypeDIEs();
219
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000220 /// Construct a DIE for this subprogram scope.
Vedant Kumar5931b4e2018-10-05 20:37:17 +0000221 DIE &constructSubprogramScopeDIE(const DISubprogram *Sub,
222 LexicalScope *Scope);
David Blaikie78b65b62014-10-09 20:26:15 +0000223
224 DIE *createAndAddScopeChildren(LexicalScope *Scope, DIE &ScopeDIE);
David Blaikie58410f22014-10-10 06:39:26 +0000225
David Blaikie49be5b32014-10-31 21:57:02 +0000226 void constructAbstractSubprogramScopeDIE(LexicalScope *Scope);
David Blaikie4191cbc2014-10-10 06:39:29 +0000227
Vedant Kumar5931b4e2018-10-05 20:37:17 +0000228 /// Construct a call site entry DIE describing a call within \p Scope to a
229 /// callee described by \p CalleeSP. \p IsTail specifies whether the call is
Vedant Kumar74533bd2018-10-22 21:44:21 +0000230 /// a tail call. \p PCOffset must be non-zero for non-tail calls or be the
231 /// function-local offset to PC value after the call instruction.
Vedant Kumar5931b4e2018-10-05 20:37:17 +0000232 DIE &constructCallSiteEntryDIE(DIE &ScopeDIE, const DISubprogram &CalleeSP,
Vedant Kumar74533bd2018-10-22 21:44:21 +0000233 bool IsTail, const MCExpr *PCOffset);
Vedant Kumar5931b4e2018-10-05 20:37:17 +0000234
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000235 /// Construct import_module DIE.
Duncan P. N. Exon Smith827200c2015-06-25 23:52:10 +0000236 DIE *constructImportedEntityDIE(const DIImportedEntity *Module);
Frederic Riss987fe222014-10-24 21:31:09 +0000237
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000238 void finishSubprogramDefinition(const DISubprogram *SP);
Hsiangkai Wang2532ac82018-08-17 15:22:04 +0000239 void finishEntityDefinition(const DbgEntity *Entity);
Eugene Zelenko6e07bfd2017-08-17 21:26:39 +0000240
David Blaikie488393f2017-05-12 01:13:45 +0000241 /// Find abstract variable associated with Var.
Hsiangkai Wang760c1ab2018-09-06 02:22:06 +0000242 using InlinedEntity = DbgValueHistoryMap::InlinedEntity;
Hsiangkai Wang2532ac82018-08-17 15:22:04 +0000243 DbgEntity *getExistingAbstractEntity(const DINode *Node);
244 void createAbstractEntity(const DINode *Node, LexicalScope *Scope);
David Blaikie1d96cc22014-10-31 22:30:30 +0000245
David Blaikie7cbf58a2014-11-01 18:18:07 +0000246 /// Set the skeleton unit associated with this unit.
David Blaikiea5437b62014-11-01 19:26:05 +0000247 void setSkeleton(DwarfCompileUnit &Skel) { Skeleton = &Skel; }
David Blaikiea34568b2014-11-01 20:06:28 +0000248
Paul Robinson543c0e12018-05-22 17:27:31 +0000249 unsigned getHeaderSize() const override {
250 // DWARF v5 added the DWO ID to the header for split/skeleton units.
251 unsigned DWOIdSize =
252 DD->getDwarfVersion() >= 5 && DD->useSplitDwarf() ? sizeof(uint64_t)
253 : 0;
254 return DwarfUnit::getHeaderSize() + DWOIdSize;
255 }
David Blaikie983bfea2014-11-01 23:07:14 +0000256 unsigned getLength() {
257 return sizeof(uint32_t) + // Length field
Greg Clayton35630c32016-12-01 18:56:29 +0000258 getHeaderSize() + getUnitDie().getSize();
David Blaikie983bfea2014-11-01 23:07:14 +0000259 }
David Blaikieae57e662014-11-01 23:59:23 +0000260
Rafael Espindola063d7252015-03-10 16:58:10 +0000261 void emitHeader(bool UseOffsets) override;
David Blaikief4bdc312014-11-02 01:21:40 +0000262
David Blaikie61c127c2018-12-14 22:34:03 +0000263 /// Add the DW_AT_addr_base attribute to the unit DIE.
264 void addAddrTableBase();
265
David Blaikief4bdc312014-11-02 01:21:40 +0000266 MCSymbol *getLabelBegin() const {
David Blaikiee40caae2016-12-01 21:59:09 +0000267 assert(getSection());
David Blaikief4bdc312014-11-02 01:21:40 +0000268 return LabelBegin;
269 }
David Blaikie192b45c2014-11-02 06:16:39 +0000270
Amjad Aboud8bbce8a2016-02-01 14:09:41 +0000271 MCSymbol *getMacroLabelBegin() const {
272 return MacroLabelBegin;
273 }
274
David Blaikie192b45c2014-11-02 06:16:39 +0000275 /// Add a new global name to the compile unit.
David Blaikiea0e3c752017-02-03 00:44:18 +0000276 void addGlobalName(StringRef Name, const DIE &Die,
277 const DIScope *Context) override;
278
279 /// Add a new global name present in a type unit to this compile unit.
280 void addGlobalNameForTypeUnit(StringRef Name, const DIScope *Context);
David Blaikie192b45c2014-11-02 06:16:39 +0000281
282 /// Add a new global type to the compile unit.
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000283 void addGlobalType(const DIType *Ty, const DIE &Die,
284 const DIScope *Context) override;
David Blaikie192b45c2014-11-02 06:16:39 +0000285
David Blaikiea0e3c752017-02-03 00:44:18 +0000286 /// Add a new global type present in a type unit to this compile unit.
287 void addGlobalTypeUnitType(const DIType *Ty, const DIScope *Context);
288
David Blaikie192b45c2014-11-02 06:16:39 +0000289 const StringMap<const DIE *> &getGlobalNames() const { return GlobalNames; }
290 const StringMap<const DIE *> &getGlobalTypes() const { return GlobalTypes; }
David Blaikie7d48be22014-11-02 06:37:23 +0000291
292 /// Add DW_AT_location attribute for a DbgVariable based on provided
293 /// MachineLocation.
294 void addVariableAddress(const DbgVariable &DV, DIE &Die,
295 MachineLocation Location);
David Blaikief7435ee2014-11-02 06:46:40 +0000296 /// Add an address attribute to a die based on the location provided.
297 void addAddress(DIE &Die, dwarf::Attribute Attribute,
Adrian Prantl5883af32015-01-19 17:57:29 +0000298 const MachineLocation &Location);
David Blaikie77895fb2014-11-02 06:58:44 +0000299
300 /// Start with the address based on the location provided, and generate the
301 /// DWARF information necessary to find the actual variable (navigating the
302 /// extra location information encoded in the type) based on the starting
303 /// location. Add the DWARF information to the die.
304 void addComplexAddress(const DbgVariable &DV, DIE &Die,
305 dwarf::Attribute Attribute,
306 const MachineLocation &Location);
David Blaikie4bc08812014-11-02 07:03:19 +0000307
308 /// Add a Dwarf loclistptr attribute data and value.
309 void addLocationList(DIE &Die, dwarf::Attribute Attribute, unsigned Index);
David Blaikie02a63332014-11-02 07:06:51 +0000310 void applyVariableAttributes(const DbgVariable &Var, DIE &VariableDie);
David Blaikie97802082014-11-02 07:11:55 +0000311
312 /// Add a Dwarf expression attribute data and value.
313 void addExpr(DIELoc &Die, dwarf::Form Form, const MCExpr *Expr);
David Blaikie3363a572014-11-02 08:09:09 +0000314
Vedant Kumar74533bd2018-10-22 21:44:21 +0000315 /// Add an attribute containing an address expression to \p Die.
316 void addAddressExpr(DIE &Die, dwarf::Attribute Attribute, const MCExpr *Expr);
317
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000318 void applySubprogramAttributesToDefinition(const DISubprogram *SP,
Duncan P. N. Exon Smith2fbe1352015-04-20 22:10:08 +0000319 DIE &SPDie);
David Blaikie89a26f02014-11-03 02:41:49 +0000320
Hsiangkai Wang2532ac82018-08-17 15:22:04 +0000321 void applyLabelAttributes(const DbgLabel &Label, DIE &LabelDie);
322
David Blaikiebc532b42014-11-03 16:40:43 +0000323 /// getRanges - Get the list of ranges for this unit.
324 const SmallVectorImpl<RangeSpan> &getRanges() const { return CURanges; }
David Blaikie5b02a192014-11-03 23:10:59 +0000325 SmallVector<RangeSpan, 2> takeRanges() { return std::move(CURanges); }
David Blaikiece343492014-11-03 21:15:30 +0000326
327 void setBaseAddress(const MCSymbol *Base) { BaseAddress = Base; }
328 const MCSymbol *getBaseAddress() const { return BaseAddress; }
Peter Collingbourneb52e2362017-09-12 21:50:41 +0000329
Paul Robinson543c0e12018-05-22 17:27:31 +0000330 uint64_t getDWOId() const { return DWOId; }
331 void setDWOId(uint64_t DwoId) { DWOId = DwoId; }
332
Peter Collingbourneb52e2362017-09-12 21:50:41 +0000333 bool hasDwarfPubSections() const;
Markus Lavinb86ce212019-03-19 13:16:28 +0000334
335 void addBaseTypeRef(DIEValueList &Die, int64_t Idx);
David Blaikie37c52312014-10-04 15:49:50 +0000336};
337
Eugene Zelenko6e07bfd2017-08-17 21:26:39 +0000338} // end namespace llvm
David Blaikie37c52312014-10-04 15:49:50 +0000339
Eugene Zelenko6e07bfd2017-08-17 21:26:39 +0000340#endif // LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H