blob: ea980dfda17ebdfe05f61cd577a3cb8b2f67b496 [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 Blaikie832c7d92019-04-24 18:09:44 +0000103 void finishNonUnitTypeDIE(DIE& D, const DICompositeType *CTy) override;
104
David Blaikie37c52312014-10-04 15:49:50 +0000105public:
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000106 DwarfCompileUnit(unsigned UID, const DICompileUnit *Node, AsmPrinter *A,
David Blaikie37c52312014-10-04 15:49:50 +0000107 DwarfDebug *DW, DwarfFile *DWU);
108
David Blaikiec4af8bf2018-10-20 07:36:39 +0000109 bool hasRangeLists() const { return HasRangeLists; }
Peter Collingbourne7c384cc2016-02-11 19:57:46 +0000110 unsigned getUniqueID() const { return UniqueID; }
Peter Collingbourne7c384cc2016-02-11 19:57:46 +0000111
David Blaikiea33cd6a2014-11-01 00:50:34 +0000112 DwarfCompileUnit *getSkeleton() const {
David Blaikiea5437b62014-11-01 19:26:05 +0000113 return Skeleton;
David Blaikiea33cd6a2014-11-01 00:50:34 +0000114 }
115
David Blaikieb3cee2f2017-05-25 18:50:28 +0000116 bool includeMinimalInlineScopes() const;
117
Rafael Espindola063d7252015-03-10 16:58:10 +0000118 void initStmtList();
David Blaikie37c52312014-10-04 15:49:50 +0000119
120 /// Apply the DW_AT_stmt_list from this compile unit to the specified DIE.
121 void applyStmtList(DIE &D);
122
Adrian Prantlbceaaa92016-12-20 02:09:43 +0000123 /// A pair of GlobalVariable and DIExpression.
124 struct GlobalExpr {
125 const GlobalVariable *Var;
126 const DIExpression *Expr;
127 };
128
Markus Lavinb86ce212019-03-19 13:16:28 +0000129 struct BaseTypeRef {
130 BaseTypeRef(unsigned BitSize, dwarf::TypeKind Encoding) :
131 BitSize(BitSize), Encoding(Encoding) {}
132 unsigned BitSize;
133 dwarf::TypeKind Encoding;
134 DIE *Die = nullptr;
135 };
136
137 std::vector<BaseTypeRef> ExprRefedBaseTypes;
138
Adrian Prantlbceaaa92016-12-20 02:09:43 +0000139 /// Get or create global variable DIE.
140 DIE *
141 getOrCreateGlobalVariableDIE(const DIGlobalVariable *GV,
142 ArrayRef<GlobalExpr> GlobalExprs);
David Blaikie37c52312014-10-04 15:49:50 +0000143
Adrian Prantl6ed57062019-04-08 19:13:55 +0000144 DIE *getOrCreateCommonBlock(const DICommonBlock *CB,
145 ArrayRef<GlobalExpr> GlobalExprs);
146
147 void addLocationAttribute(DIE *ToDIE, const DIGlobalVariable *GV,
148 ArrayRef<GlobalExpr> GlobalExprs);
149
David Blaikie37c52312014-10-04 15:49:50 +0000150 /// addLabelAddress - Add a dwarf label attribute data and value using
151 /// either DW_FORM_addr or DW_FORM_GNU_addr_index.
152 void addLabelAddress(DIE &Die, dwarf::Attribute Attribute,
153 const MCSymbol *Label);
154
155 /// addLocalLabelAddress - Add a dwarf label attribute data and value using
156 /// DW_FORM_addr only.
157 void addLocalLabelAddress(DIE &Die, dwarf::Attribute Attribute,
158 const MCSymbol *Label);
159
160 DwarfCompileUnit &getCU() override { return *this; }
161
Paul Robinson612e89d2018-01-12 19:17:50 +0000162 unsigned getOrCreateSourceID(const DIFile *File) override;
David Blaikie37c52312014-10-04 15:49:50 +0000163
Amjad Aboud72da9392016-04-30 01:44:07 +0000164 void addImportedEntity(const DIImportedEntity* IE) {
165 DIScope *Scope = IE->getScope();
Amjad Abouda5ba9912016-04-21 16:58:49 +0000166 assert(Scope && "Invalid Scope encoding!");
167 if (!isa<DILocalScope>(Scope))
168 // No need to add imported enities that are not local declaration.
169 return;
170
171 auto *LocalScope = cast<DILocalScope>(Scope)->getNonLexicalBlockFileScope();
Amjad Aboud72da9392016-04-30 01:44:07 +0000172 ImportedEntities[LocalScope].push_back(IE);
Ivan Krasin298639a2015-10-26 21:36:35 +0000173 }
174
David Blaikie37c52312014-10-04 15:49:50 +0000175 /// addRange - Add an address range to the list of ranges for this unit.
176 void addRange(RangeSpan Range);
David Blaikie14499a72014-10-04 15:58:47 +0000177
178 void attachLowHighPC(DIE &D, const MCSymbol *Begin, const MCSymbol *End);
David Blaikiecda2aa82014-10-04 16:24:00 +0000179
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000180 /// Find DIE for the given subprogram and attach appropriate
David Blaikiecda2aa82014-10-04 16:24:00 +0000181 /// DW_AT_low_pc and DW_AT_high_pc attributes. If there are global
182 /// variables in this scope then create and insert DIEs for these
183 /// variables.
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000184 DIE &updateSubprogramScopeDIE(const DISubprogram *SP);
David Blaikie9c65b132014-10-08 22:20:02 +0000185
186 void constructScopeDIE(LexicalScope *Scope,
Duncan P. N. Exon Smith827200c2015-06-25 23:52:10 +0000187 SmallVectorImpl<DIE *> &FinalChildren);
David Blaikie52400202014-10-09 00:11:39 +0000188
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000189 /// A helper function to construct a RangeSpanList for a given
David Blaikie52400202014-10-09 00:11:39 +0000190 /// lexical scope.
David Blaikie5b02a192014-11-03 23:10:59 +0000191 void addScopeRangeList(DIE &ScopeDIE, SmallVector<RangeSpan, 2> Range);
192
193 void attachRangesOrLowHighPC(DIE &D, SmallVector<RangeSpan, 2> Ranges);
David Blaikiede123752014-10-09 00:21:42 +0000194
195 void attachRangesOrLowHighPC(DIE &D,
196 const SmallVectorImpl<InsnRange> &Ranges);
Eugene Zelenko6e07bfd2017-08-17 21:26:39 +0000197
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000198 /// This scope represents inlined body of a function. Construct
David Blaikie01b48a82014-10-09 16:50:53 +0000199 /// DIE to represent this concrete inlined copy of the function.
Duncan P. N. Exon Smith827200c2015-06-25 23:52:10 +0000200 DIE *constructInlinedScopeDIE(LexicalScope *Scope);
David Blaikie0fbf8bd2014-10-09 17:08:42 +0000201
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000202 /// Construct new DW_TAG_lexical_block for this scope and
David Blaikie0fbf8bd2014-10-09 17:08:42 +0000203 /// attach DW_AT_low_pc/DW_AT_high_pc labels.
Duncan P. N. Exon Smith827200c2015-06-25 23:52:10 +0000204 DIE *constructLexicalScopeDIE(LexicalScope *Scope);
David Blaikieee7df552014-10-09 17:56:36 +0000205
206 /// constructVariableDIE - Construct a DIE for the given DbgVariable.
Duncan P. N. Exon Smith827200c2015-06-25 23:52:10 +0000207 DIE *constructVariableDIE(DbgVariable &DV, bool Abstract = false);
David Blaikie4a1a44e2014-10-09 17:56:39 +0000208
Duncan P. N. Exon Smith827200c2015-06-25 23:52:10 +0000209 DIE *constructVariableDIE(DbgVariable &DV, const LexicalScope &Scope,
210 DIE *&ObjectPointer);
David Blaikie8b2fdb82014-10-09 18:24:28 +0000211
Hsiangkai Wang2532ac82018-08-17 15:22:04 +0000212 /// Construct a DIE for the given DbgLabel.
213 DIE *constructLabelDIE(DbgLabel &DL, const LexicalScope &Scope);
214
David Blaikie8b2fdb82014-10-09 18:24:28 +0000215 /// A helper function to create children of a Scope DIE.
216 DIE *createScopeChildrenDIE(LexicalScope *Scope,
Duncan P. N. Exon Smith827200c2015-06-25 23:52:10 +0000217 SmallVectorImpl<DIE *> &Children,
David Blaikie2195e132017-07-27 00:06:53 +0000218 bool *HasNonScopeChildren = nullptr);
David Blaikie1d072342014-10-09 20:21:36 +0000219
Markus Lavinb86ce212019-03-19 13:16:28 +0000220 void createBaseTypeDIEs();
221
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000222 /// Construct a DIE for this subprogram scope.
Vedant Kumar5931b4e2018-10-05 20:37:17 +0000223 DIE &constructSubprogramScopeDIE(const DISubprogram *Sub,
224 LexicalScope *Scope);
David Blaikie78b65b62014-10-09 20:26:15 +0000225
226 DIE *createAndAddScopeChildren(LexicalScope *Scope, DIE &ScopeDIE);
David Blaikie58410f22014-10-10 06:39:26 +0000227
David Blaikie49be5b32014-10-31 21:57:02 +0000228 void constructAbstractSubprogramScopeDIE(LexicalScope *Scope);
David Blaikie4191cbc2014-10-10 06:39:29 +0000229
Vedant Kumar5931b4e2018-10-05 20:37:17 +0000230 /// Construct a call site entry DIE describing a call within \p Scope to a
231 /// callee described by \p CalleeSP. \p IsTail specifies whether the call is
Vedant Kumar74533bd2018-10-22 21:44:21 +0000232 /// a tail call. \p PCOffset must be non-zero for non-tail calls or be the
233 /// function-local offset to PC value after the call instruction.
Vedant Kumar5931b4e2018-10-05 20:37:17 +0000234 DIE &constructCallSiteEntryDIE(DIE &ScopeDIE, const DISubprogram &CalleeSP,
Vedant Kumar74533bd2018-10-22 21:44:21 +0000235 bool IsTail, const MCExpr *PCOffset);
Vedant Kumar5931b4e2018-10-05 20:37:17 +0000236
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000237 /// Construct import_module DIE.
Duncan P. N. Exon Smith827200c2015-06-25 23:52:10 +0000238 DIE *constructImportedEntityDIE(const DIImportedEntity *Module);
Frederic Riss987fe222014-10-24 21:31:09 +0000239
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000240 void finishSubprogramDefinition(const DISubprogram *SP);
Hsiangkai Wang2532ac82018-08-17 15:22:04 +0000241 void finishEntityDefinition(const DbgEntity *Entity);
Eugene Zelenko6e07bfd2017-08-17 21:26:39 +0000242
David Blaikie488393f2017-05-12 01:13:45 +0000243 /// Find abstract variable associated with Var.
Hsiangkai Wang760c1ab2018-09-06 02:22:06 +0000244 using InlinedEntity = DbgValueHistoryMap::InlinedEntity;
Hsiangkai Wang2532ac82018-08-17 15:22:04 +0000245 DbgEntity *getExistingAbstractEntity(const DINode *Node);
246 void createAbstractEntity(const DINode *Node, LexicalScope *Scope);
David Blaikie1d96cc22014-10-31 22:30:30 +0000247
David Blaikie7cbf58a2014-11-01 18:18:07 +0000248 /// Set the skeleton unit associated with this unit.
David Blaikiea5437b62014-11-01 19:26:05 +0000249 void setSkeleton(DwarfCompileUnit &Skel) { Skeleton = &Skel; }
David Blaikiea34568b2014-11-01 20:06:28 +0000250
Paul Robinson543c0e12018-05-22 17:27:31 +0000251 unsigned getHeaderSize() const override {
252 // DWARF v5 added the DWO ID to the header for split/skeleton units.
253 unsigned DWOIdSize =
254 DD->getDwarfVersion() >= 5 && DD->useSplitDwarf() ? sizeof(uint64_t)
255 : 0;
256 return DwarfUnit::getHeaderSize() + DWOIdSize;
257 }
David Blaikie983bfea2014-11-01 23:07:14 +0000258 unsigned getLength() {
259 return sizeof(uint32_t) + // Length field
Greg Clayton35630c32016-12-01 18:56:29 +0000260 getHeaderSize() + getUnitDie().getSize();
David Blaikie983bfea2014-11-01 23:07:14 +0000261 }
David Blaikieae57e662014-11-01 23:59:23 +0000262
Rafael Espindola063d7252015-03-10 16:58:10 +0000263 void emitHeader(bool UseOffsets) override;
David Blaikief4bdc312014-11-02 01:21:40 +0000264
David Blaikie61c127c2018-12-14 22:34:03 +0000265 /// Add the DW_AT_addr_base attribute to the unit DIE.
266 void addAddrTableBase();
267
David Blaikief4bdc312014-11-02 01:21:40 +0000268 MCSymbol *getLabelBegin() const {
David Blaikiee40caae2016-12-01 21:59:09 +0000269 assert(getSection());
David Blaikief4bdc312014-11-02 01:21:40 +0000270 return LabelBegin;
271 }
David Blaikie192b45c2014-11-02 06:16:39 +0000272
Amjad Aboud8bbce8a2016-02-01 14:09:41 +0000273 MCSymbol *getMacroLabelBegin() const {
274 return MacroLabelBegin;
275 }
276
David Blaikie192b45c2014-11-02 06:16:39 +0000277 /// Add a new global name to the compile unit.
David Blaikiea0e3c752017-02-03 00:44:18 +0000278 void addGlobalName(StringRef Name, const DIE &Die,
279 const DIScope *Context) override;
280
281 /// Add a new global name present in a type unit to this compile unit.
282 void addGlobalNameForTypeUnit(StringRef Name, const DIScope *Context);
David Blaikie192b45c2014-11-02 06:16:39 +0000283
284 /// Add a new global type to the compile unit.
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000285 void addGlobalType(const DIType *Ty, const DIE &Die,
286 const DIScope *Context) override;
David Blaikie192b45c2014-11-02 06:16:39 +0000287
David Blaikiea0e3c752017-02-03 00:44:18 +0000288 /// Add a new global type present in a type unit to this compile unit.
289 void addGlobalTypeUnitType(const DIType *Ty, const DIScope *Context);
290
David Blaikie192b45c2014-11-02 06:16:39 +0000291 const StringMap<const DIE *> &getGlobalNames() const { return GlobalNames; }
292 const StringMap<const DIE *> &getGlobalTypes() const { return GlobalTypes; }
David Blaikie7d48be22014-11-02 06:37:23 +0000293
294 /// Add DW_AT_location attribute for a DbgVariable based on provided
295 /// MachineLocation.
296 void addVariableAddress(const DbgVariable &DV, DIE &Die,
297 MachineLocation Location);
David Blaikief7435ee2014-11-02 06:46:40 +0000298 /// Add an address attribute to a die based on the location provided.
299 void addAddress(DIE &Die, dwarf::Attribute Attribute,
Adrian Prantl5883af32015-01-19 17:57:29 +0000300 const MachineLocation &Location);
David Blaikie77895fb2014-11-02 06:58:44 +0000301
302 /// Start with the address based on the location provided, and generate the
303 /// DWARF information necessary to find the actual variable (navigating the
304 /// extra location information encoded in the type) based on the starting
305 /// location. Add the DWARF information to the die.
306 void addComplexAddress(const DbgVariable &DV, DIE &Die,
307 dwarf::Attribute Attribute,
308 const MachineLocation &Location);
David Blaikie4bc08812014-11-02 07:03:19 +0000309
310 /// Add a Dwarf loclistptr attribute data and value.
311 void addLocationList(DIE &Die, dwarf::Attribute Attribute, unsigned Index);
David Blaikie02a63332014-11-02 07:06:51 +0000312 void applyVariableAttributes(const DbgVariable &Var, DIE &VariableDie);
David Blaikie97802082014-11-02 07:11:55 +0000313
314 /// Add a Dwarf expression attribute data and value.
315 void addExpr(DIELoc &Die, dwarf::Form Form, const MCExpr *Expr);
David Blaikie3363a572014-11-02 08:09:09 +0000316
Vedant Kumar74533bd2018-10-22 21:44:21 +0000317 /// Add an attribute containing an address expression to \p Die.
318 void addAddressExpr(DIE &Die, dwarf::Attribute Attribute, const MCExpr *Expr);
319
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000320 void applySubprogramAttributesToDefinition(const DISubprogram *SP,
Duncan P. N. Exon Smith2fbe1352015-04-20 22:10:08 +0000321 DIE &SPDie);
David Blaikie89a26f02014-11-03 02:41:49 +0000322
Hsiangkai Wang2532ac82018-08-17 15:22:04 +0000323 void applyLabelAttributes(const DbgLabel &Label, DIE &LabelDie);
324
David Blaikiebc532b42014-11-03 16:40:43 +0000325 /// getRanges - Get the list of ranges for this unit.
326 const SmallVectorImpl<RangeSpan> &getRanges() const { return CURanges; }
David Blaikie5b02a192014-11-03 23:10:59 +0000327 SmallVector<RangeSpan, 2> takeRanges() { return std::move(CURanges); }
David Blaikiece343492014-11-03 21:15:30 +0000328
329 void setBaseAddress(const MCSymbol *Base) { BaseAddress = Base; }
330 const MCSymbol *getBaseAddress() const { return BaseAddress; }
Peter Collingbourneb52e2362017-09-12 21:50:41 +0000331
Paul Robinson543c0e12018-05-22 17:27:31 +0000332 uint64_t getDWOId() const { return DWOId; }
333 void setDWOId(uint64_t DwoId) { DWOId = DwoId; }
334
Peter Collingbourneb52e2362017-09-12 21:50:41 +0000335 bool hasDwarfPubSections() const;
Markus Lavinb86ce212019-03-19 13:16:28 +0000336
337 void addBaseTypeRef(DIEValueList &Die, int64_t Idx);
David Blaikie37c52312014-10-04 15:49:50 +0000338};
339
Eugene Zelenko6e07bfd2017-08-17 21:26:39 +0000340} // end namespace llvm
David Blaikie37c52312014-10-04 15:49:50 +0000341
Eugene Zelenko6e07bfd2017-08-17 21:26:39 +0000342#endif // LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H