llvm.org GIT mirror llvm / 8f5464d
Service the doxygen comments in DwarfUnit and DwarfDebug. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242046 91177308-0d34-0410-b5e6-96231b3b80d8 Adrian Prantl 5 years ago
2 changed file(s) with 153 addition(s) and 150 deletion(s). Raw diff Collapse all Expand all
4848 class MachineModuleInfo;
4949
5050 //===----------------------------------------------------------------------===//
51 /// \brief This class is used to record source line correspondence.
51 /// This class is used to record source line correspondence.
5252 class SrcLineInfo {
5353 unsigned Line; // Source line number.
5454 unsigned Column; // Source column.
160160
161161 return dwarf::DW_TAG_variable;
162162 }
163 /// \brief Return true if DbgVariable is artificial.
163 /// Return true if DbgVariable is artificial.
164164 bool isArtificial() const {
165165 if (Var->isArtificial())
166166 return true;
189189 const DIType *getType() const;
190190
191191 private:
192 /// resolve - Look in the DwarfDebug map for the MDNode that
192 /// Look in the DwarfDebug map for the MDNode that
193193 /// corresponds to the reference.
194194 template T *resolve(TypedDINodeRef Ref) const;
195195 };
196196
197197
198 /// \brief Helper used to pair up a symbol and its DWARF compile unit.
198 /// Helper used to pair up a symbol and its DWARF compile unit.
199199 struct SymbolCU {
200200 SymbolCU(DwarfCompileUnit *CU, const MCSymbol *Sym) : Sym(Sym), CU(CU) {}
201201 const MCSymbol *Sym;
202202 DwarfCompileUnit *CU;
203203 };
204204
205 /// \brief Collects and handles dwarf debug information.
205 /// Collects and handles dwarf debug information.
206206 class DwarfDebug : public AsmPrinterHandler {
207 // Target of Dwarf emission.
207 /// Target of Dwarf emission.
208208 AsmPrinter *Asm;
209209
210 // Collected machine module information.
210 /// Collected machine module information.
211211 MachineModuleInfo *MMI;
212212
213 // All DIEValues are allocated through this allocator.
213 /// All DIEValues are allocated through this allocator.
214214 BumpPtrAllocator DIEValueAllocator;
215215
216 // Maps MDNode with its corresponding DwarfCompileUnit.
216 /// Maps MDNode with its corresponding DwarfCompileUnit.
217217 MapVector CUMap;
218218
219 // Maps subprogram MDNode with its corresponding DwarfCompileUnit.
219 /// Maps subprogram MDNode with its corresponding DwarfCompileUnit.
220220 MapVector SPMap;
221221
222 // Maps a CU DIE with its corresponding DwarfCompileUnit.
222 /// Maps a CU DIE with its corresponding DwarfCompileUnit.
223223 DenseMap CUDieMap;
224224
225 // List of all labels used in aranges generation.
225 /// List of all labels used in aranges generation.
226226 std::vector ArangeLabels;
227227
228 // Size of each symbol emitted (for those symbols that have a specific size).
228 /// Size of each symbol emitted (for those symbols that have a specific size).
229229 DenseMap SymSize;
230230
231231 LexicalScopes LScopes;
232232
233 // Collection of abstract variables.
233 /// Collection of abstract variables.
234234 DenseMap> AbstractVariables;
235235 SmallVector, 64> ConcreteVariables;
236236
237 // Collection of DebugLocEntry. Stored in a linked list so that DIELocLists
238 // can refer to them in spite of insertions into this list.
237 /// Collection of DebugLocEntry. Stored in a linked list so that DIELocLists
238 /// can refer to them in spite of insertions into this list.
239239 DebugLocStream DebugLocs;
240240
241 // This is a collection of subprogram MDNodes that are processed to
242 // create DIEs.
241 /// This is a collection of subprogram MDNodes that are processed to
242 /// create DIEs.
243243 SmallPtrSet ProcessedSPNodes;
244244
245 // Maps instruction with label emitted before instruction.
245 /// Maps instruction with label emitted before instruction.
246246 DenseMap LabelsBeforeInsn;
247247
248 // Maps instruction with label emitted after instruction.
248 /// Maps instruction with label emitted after instruction.
249249 DenseMap LabelsAfterInsn;
250250
251 // History of DBG_VALUE and clobber instructions for each user variable.
252 // Variables are listed in order of appearance.
251 /// History of DBG_VALUE and clobber instructions for each user
252 /// variable. Variables are listed in order of appearance.
253253 DbgValueHistoryMap DbgValues;
254254
255 // Previous instruction's location information. This is used to determine
256 // label location to indicate scope boundries in dwarf debug info.
255 /// Previous instruction's location information. This is used to
256 /// determine label location to indicate scope boundries in dwarf
257 /// debug info.
257258 DebugLoc PrevInstLoc;
258259 MCSymbol *PrevLabel;
259260
260 // This location indicates end of function prologue and beginning of function
261 // body.
261 /// This location indicates end of function prologue and beginning of
262 /// function body.
262263 DebugLoc PrologEndLoc;
263264
264 // If nonnull, stores the current machine function we're processing.
265 /// If nonnull, stores the current machine function we're processing.
265266 const MachineFunction *CurFn;
266267
267 // If nonnull, stores the current machine instruction we're processing.
268 /// If nonnull, stores the current machine instruction we're processing.
268269 const MachineInstr *CurMI;
269270
270 // If nonnull, stores the CU in which the previous subprogram was contained.
271 /// If nonnull, stores the CU in which the previous subprogram was contained.
271272 const DwarfCompileUnit *PrevCU;
272273
273 // As an optimization, there is no need to emit an entry in the directory
274 // table for the same directory as DW_AT_comp_dir.
274 /// As an optimization, there is no need to emit an entry in the directory
275 /// table for the same directory as DW_AT_comp_dir.
275276 StringRef CompilationDir;
276277
277 // Holder for the file specific debug information.
278 /// Holder for the file specific debug information.
278279 DwarfFile InfoHolder;
279280
280 // Holders for the various debug information flags that we might need to
281 // have exposed. See accessor functions below for description.
282
283 // Holder for imported entities.
281 /// Holders for the various debug information flags that we might need to
282 /// have exposed. See accessor functions below for description.
283
284 /// Holder for imported entities.
284285 typedef SmallVector, 32>
285286 ImportedEntityMap;
286287 ImportedEntityMap ScopesWithImportedEntities;
287288
288 // Map from MDNodes for user-defined types to the type units that describe
289 // them.
289 /// Map from MDNodes for user-defined types to the type units that
290 /// describe them.
290291 DenseMap DwarfTypeUnits;
291292
292293 SmallVector<
293294 std::pair, const DICompositeType *>, 1>
294295 TypeUnitsUnderConstruction;
295296
296 // Whether to emit the pubnames/pubtypes sections.
297 /// Whether to emit the pubnames/pubtypes sections.
297298 bool HasDwarfPubSections;
298299
299 // Whether or not to use AT_ranges for compilation units.
300 /// Whether or not to use AT_ranges for compilation units.
300301 bool HasCURanges;
301302
302 // Whether we emitted a function into a section other than the default
303 // text.
303 /// Whether we emitted a function into a section other than the
304 /// default text.
304305 bool UsedNonDefaultText;
305306
306 // Whether to use the GNU TLS opcode (instead of the standard opcode).
307 /// Whether to use the GNU TLS opcode (instead of the standard opcode).
307308 bool UseGNUTLSOpcode;
308309
309 // Version of dwarf we're emitting.
310 /// Version of dwarf we're emitting.
310311 unsigned DwarfVersion;
311312
312 // Maps from a type identifier to the actual MDNode.
313 /// Maps from a type identifier to the actual MDNode.
313314 DITypeIdentifierMap TypeIdentifierMap;
314315
315 // DWARF5 Experimental Options
316 /// DWARF5 Experimental Options
317 /// @{
316318 bool HasDwarfAccelTables;
317319 bool HasSplitDwarf;
318320
319 // Separated Dwarf Variables
320 // In general these will all be for bits that are left in the
321 // original object file, rather than things that are meant
322 // to be in the .dwo sections.
323
324 // Holder for the skeleton information.
321 /// Separated Dwarf Variables
322 /// In general these will all be for bits that are left in the
323 /// original object file, rather than things that are meant
324 /// to be in the .dwo sections.
325
326 /// Holder for the skeleton information.
325327 DwarfFile SkeletonHolder;
326328
327 /// Store file names for type units under fission in a line table header that
328 /// will be emitted into debug_line.dwo.
329 // FIXME: replace this with a map from comp_dir to table so that we can emit
330 // multiple tables during LTO each of which uses directory 0, referencing the
331 // comp_dir of all the type units that use it.
329 /// Store file names for type units under fission in a line table
330 /// header that will be emitted into debug_line.dwo.
331 // FIXME: replace this with a map from comp_dir to table so that we
332 // can emit multiple tables during LTO each of which uses directory
333 // 0, referencing the comp_dir of all the type units that use it.
332334 MCDwarfDwoLineTable SplitTypeUnitFileTable;
333
334 // True iff there are multiple CUs in this module.
335 /// @}
336
337 /// True iff there are multiple CUs in this module.
335338 bool SingleCU;
336339 bool IsDarwin;
337340 bool IsPS4;
353356
354357 typedef DbgValueHistoryMap::InlinedVariable InlinedVariable;
355358
356 /// \brief Find abstract variable associated with Var.
359 /// Find abstract variable associated with Var.
357360 DbgVariable *getExistingAbstractVariable(InlinedVariable IV,
358361 const DILocalVariable *&Cleansed);
359362 DbgVariable *getExistingAbstractVariable(InlinedVariable IV);
365368
366369 DbgVariable *createConcreteVariable(LexicalScope &Scope, InlinedVariable IV);
367370
368 /// \brief Construct a DIE for this abstract scope.
371 /// Construct a DIE for this abstract scope.
369372 void constructAbstractSubprogramScopeDIE(LexicalScope *Scope);
370373
371 /// \brief Compute the size and offset of a DIE given an incoming Offset.
374 /// Compute the size and offset of a DIE given an incoming Offset.
372375 unsigned computeSizeAndOffset(DIE *Die, unsigned Offset);
373376
374 /// \brief Compute the size and offset of all the DIEs.
377 /// Compute the size and offset of all the DIEs.
375378 void computeSizeAndOffsets();
376379
377 /// \brief Collect info for variables that were optimized out.
380 /// Collect info for variables that were optimized out.
378381 void collectDeadVariables();
379382
380383 void finishVariableDefinitions();
381384
382385 void finishSubprogramDefinitions();
383386
384 /// \brief Finish off debug information after all functions have been
387 /// Finish off debug information after all functions have been
385388 /// processed.
386389 void finalizeModuleInfo();
387390
388 /// \brief Emit the debug info section.
391 /// Emit the debug info section.
389392 void emitDebugInfo();
390393
391 /// \brief Emit the abbreviation section.
394 /// Emit the abbreviation section.
392395 void emitAbbreviations();
393396
394 /// \brief Emit a specified accelerator table.
397 /// Emit a specified accelerator table.
395398 void emitAccel(DwarfAccelTable &Accel, MCSection *Section,
396399 StringRef TableName);
397400
398 /// \brief Emit visible names into a hashed accelerator table section.
401 /// Emit visible names into a hashed accelerator table section.
399402 void emitAccelNames();
400403
401 /// \brief Emit objective C classes and categories into a hashed
404 /// Emit objective C classes and categories into a hashed
402405 /// accelerator table section.
403406 void emitAccelObjC();
404407
405 /// \brief Emit namespace dies into a hashed accelerator table.
408 /// Emit namespace dies into a hashed accelerator table.
406409 void emitAccelNamespaces();
407410
408 /// \brief Emit type dies into a hashed accelerator table.
411 /// Emit type dies into a hashed accelerator table.
409412 void emitAccelTypes();
410413
411 /// \brief Emit visible names into a debug pubnames section.
414 /// Emit visible names into a debug pubnames section.
412415 /// \param GnuStyle determines whether or not we want to emit
413416 /// additional information into the table ala newer gcc for gdb
414417 /// index.
415418 void emitDebugPubNames(bool GnuStyle = false);
416419
417 /// \brief Emit visible types into a debug pubtypes section.
420 /// Emit visible types into a debug pubtypes section.
418421 /// \param GnuStyle determines whether or not we want to emit
419422 /// additional information into the table ala newer gcc for gdb
420423 /// index.
424427 bool GnuStyle, MCSection *PSec, StringRef Name,
425428 const StringMap &(DwarfCompileUnit::*Accessor)() const);
426429
427 /// \brief Emit visible names into a debug str section.
430 /// Emit visible names into a debug str section.
428431 void emitDebugStr();
429432
430 /// \brief Emit visible names into a debug loc section.
433 /// Emit visible names into a debug loc section.
431434 void emitDebugLoc();
432435
433 /// \brief Emit visible names into a debug loc dwo section.
436 /// Emit visible names into a debug loc dwo section.
434437 void emitDebugLocDWO();
435438
436 /// \brief Emit visible names into a debug aranges section.
439 /// Emit visible names into a debug aranges section.
437440 void emitDebugARanges();
438441
439 /// \brief Emit visible names into a debug ranges section.
442 /// Emit visible names into a debug ranges section.
440443 void emitDebugRanges();
441444
442 /// \brief Emit inline info using custom format.
445 /// Emit inline info using custom format.
443446 void emitDebugInlineInfo();
444447
445448 /// DWARF 5 Experimental Split Dwarf Emitters
446449
447 /// \brief Initialize common features of skeleton units.
450 /// Initialize common features of skeleton units.
448451 void initSkeletonUnit(const DwarfUnit &U, DIE &Die,
449452 std::unique_ptr NewU);
450453
451 /// \brief Construct the split debug info compile unit for the debug info
454 /// Construct the split debug info compile unit for the debug info
452455 /// section.
453456 DwarfCompileUnit &constructSkeletonCU(const DwarfCompileUnit &CU);
454457
455 /// \brief Construct the split debug info compile unit for the debug info
458 /// Construct the split debug info compile unit for the debug info
456459 /// section.
457460 DwarfTypeUnit &constructSkeletonTU(DwarfTypeUnit &TU);
458461
459 /// \brief Emit the debug info dwo section.
462 /// Emit the debug info dwo section.
460463 void emitDebugInfoDWO();
461464
462 /// \brief Emit the debug abbrev dwo section.
465 /// Emit the debug abbrev dwo section.
463466 void emitDebugAbbrevDWO();
464467
465 /// \brief Emit the debug line dwo section.
468 /// Emit the debug line dwo section.
466469 void emitDebugLineDWO();
467470
468 /// \brief Emit the debug str dwo section.
471 /// Emit the debug str dwo section.
469472 void emitDebugStrDWO();
470473
471474 /// Flags to let the linker know we have emitted new style pubnames. Only
472475 /// emit it here if we don't have a skeleton CU for split dwarf.
473476 void addGnuPubAttributes(DwarfUnit &U, DIE &D) const;
474477
475 /// \brief Create new DwarfCompileUnit for the given metadata node with tag
478 /// Create new DwarfCompileUnit for the given metadata node with tag
476479 /// DW_TAG_compile_unit.
477480 DwarfCompileUnit &constructDwarfCompileUnit(const DICompileUnit *DIUnit);
478481
479 /// \brief Construct imported_module or imported_declaration DIE.
482 /// Construct imported_module or imported_declaration DIE.
480483 void constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
481484 const DIImportedEntity *N);
482485
483 /// \brief Register a source line with debug info. Returns the unique
486 /// Register a source line with debug info. Returns the unique
484487 /// label that was emitted and which provides correspondence to the
485488 /// source line list.
486489 void recordSourceLine(unsigned Line, unsigned Col, const MDNode *Scope,
487490 unsigned Flags);
488491
489 /// \brief Indentify instructions that are marking the beginning of or
492 /// Indentify instructions that are marking the beginning of or
490493 /// ending of a scope.
491494 void identifyScopeMarkers();
492495
493 /// \brief Populate LexicalScope entries with variables' info.
496 /// Populate LexicalScope entries with variables' info.
494497 void collectVariableInfo(DwarfCompileUnit &TheCU, const DISubprogram *SP,
495498 DenseSet &ProcessedVars);
496499
497 /// \brief Build the location list for all DBG_VALUEs in the
500 /// Build the location list for all DBG_VALUEs in the
498501 /// function that describe the same variable.
499502 void buildLocationList(SmallVectorImpl &DebugLoc,
500503 const DbgValueHistoryMap::InstrRanges &Ranges);
501504
502 /// \brief Collect variable information from the side table maintained
505 /// Collect variable information from the side table maintained
503506 /// by MMI.
504507 void collectVariableInfoFromMMITable(DenseSet &P);
505508
506 /// \brief Ensure that a label will be emitted before MI.
509 /// Ensure that a label will be emitted before MI.
507510 void requestLabelBeforeInsn(const MachineInstr *MI) {
508511 LabelsBeforeInsn.insert(std::make_pair(MI, nullptr));
509512 }
510513
511 /// \brief Ensure that a label will be emitted after MI.
514 /// Ensure that a label will be emitted after MI.
512515 void requestLabelAfterInsn(const MachineInstr *MI) {
513516 LabelsAfterInsn.insert(std::make_pair(MI, nullptr));
514517 }
521524
522525 ~DwarfDebug() override;
523526
524 /// \brief Emit all Dwarf sections that should come prior to the
527 /// Emit all Dwarf sections that should come prior to the
525528 /// content.
526529 void beginModule();
527530
528 /// \brief Emit all Dwarf sections that should come after the content.
531 /// Emit all Dwarf sections that should come after the content.
529532 void endModule() override;
530533
531 /// \brief Gather pre-function debug information.
534 /// Gather pre-function debug information.
532535 void beginFunction(const MachineFunction *MF) override;
533536
534 /// \brief Gather and emit post-function debug information.
537 /// Gather and emit post-function debug information.
535538 void endFunction(const MachineFunction *MF) override;
536539
537 /// \brief Process beginning of an instruction.
540 /// Process beginning of an instruction.
538541 void beginInstruction(const MachineInstr *MI) override;
539542
540 /// \brief Process end of an instruction.
543 /// Process end of an instruction.
541544 void endInstruction() override;
542545
543 /// \brief Add a DIE to the set of types that we're going to pull into
546 /// Add a DIE to the set of types that we're going to pull into
544547 /// type units.
545548 void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier,
546549 DIE &Die, const DICompositeType *CTy);
547550
548 /// \brief Add a label so that arange data can be generated for it.
551 /// Add a label so that arange data can be generated for it.
549552 void addArangeLabel(SymbolCU SCU) { ArangeLabels.push_back(SCU); }
550553
551 /// \brief For symbols that have a size designated (e.g. common symbols),
554 /// For symbols that have a size designated (e.g. common symbols),
552555 /// this tracks that size.
553556 void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override {
554557 SymSize[Sym] = Size;
555558 }
556559
557 /// \brief Returns whether to use DW_OP_GNU_push_tls_address, instead of the
560 /// Returns whether to use DW_OP_GNU_push_tls_address, instead of the
558561 /// standard DW_OP_form_tls_address opcode
559562 bool useGNUTLSOpcode() const { return UseGNUTLSOpcode; }
560563
561564 // Experimental DWARF5 features.
562565
563 /// \brief Returns whether or not to emit tables that dwarf consumers can
566 /// Returns whether or not to emit tables that dwarf consumers can
564567 /// use to accelerate lookup.
565568 bool useDwarfAccelTables() const { return HasDwarfAccelTables; }
566569
567 /// \brief Returns whether or not to change the current debug info for the
570 /// Returns whether or not to change the current debug info for the
568571 /// split dwarf proposal support.
569572 bool useSplitDwarf() const { return HasSplitDwarf; }
570573
578581 /// Returns the entries for the .debug_loc section.
579582 const DebugLocStream &getDebugLocs() const { return DebugLocs; }
580583
581 /// \brief Emit an entry for the debug loc section. This can be used to
584 /// Emit an entry for the debug loc section. This can be used to
582585 /// handle an entry that's going to be emitted into the debug loc section.
583586 void emitDebugLocEntry(ByteStreamer &Streamer,
584587 const DebugLocStream::Entry &Entry);
591594 return Ref.resolve(TypeIdentifierMap);
592595 }
593596
594 /// \brief Return the TypeIdentifierMap.
597 /// Return the TypeIdentifierMap.
595598 const DITypeIdentifierMap &getTypeIdentifierMap() const {
596599 return TypeIdentifierMap;
597600 }
626629 less_first()));
627630 }
628631
629 /// \brief A helper function to check whether the DIE for a given Scope is
632 /// A helper function to check whether the DIE for a given Scope is
630633 /// going to be null.
631634 bool isLexicalScopeDIENull(LexicalScope *Scope);
632635
633 /// \brief Return Label preceding the instruction.
636 /// Return Label preceding the instruction.
634637 MCSymbol *getLabelBeforeInsn(const MachineInstr *MI);
635638
636 /// \brief Return Label immediately following the instruction.
639 /// Return Label immediately following the instruction.
637640 MCSymbol *getLabelAfterInsn(const MachineInstr *MI);
638641
639642 // FIXME: Sink these functions down into DwarfFile/Dwarf*Unit.
112112 DwarfUnit(unsigned UID, dwarf::Tag, const DICompileUnit *CU, AsmPrinter *A,
113113 DwarfDebug *DW, DwarfFile *DWU);
114114
115 /// \brief Add a string attribute data and value.
115 /// Add a string attribute data and value.
116116 ///
117117 /// This is guaranteed to be in the local string pool instead of indirected.
118118 void addLocalString(DIE &Die, dwarf::Attribute Attribute, StringRef Str);
141141 unsigned getDebugInfoOffset() const { return DebugInfoOffset; }
142142 void setDebugInfoOffset(unsigned DbgInfoOff) { DebugInfoOffset = DbgInfoOff; }
143143
144 /// \brief Return true if this compile unit has something to write out.
144 /// Return true if this compile unit has something to write out.
145145 bool hasContent() const { return UnitDie.hasChildren(); }
146146
147 /// \brief Get string containing language specific context for a global name.
147 /// Get string containing language specific context for a global name.
148148 ///
149149 /// Walks the metadata parent chain in a language specific manner (using the
150150 /// compile unit language) and returns it as a string. This is done at the
161161 virtual void addGlobalType(const DIType *Ty, const DIE &Die,
162162 const DIScope *Context) {}
163163
164 /// \brief Add a new name to the namespace accelerator table.
164 /// Add a new name to the namespace accelerator table.
165165 void addAccelNamespace(StringRef Name, const DIE &Die);
166166
167 /// \brief Returns the DIE map slot for the specified debug variable.
167 /// Returns the DIE map slot for the specified debug variable.
168168 ///
169169 /// We delegate the request to DwarfDebug when the MDNode can be part of the
170170 /// type system, since DIEs for the type system can be shared across CUs and
171171 /// the mappings are kept in DwarfDebug.
172172 DIE *getDIE(const DINode *D) const;
173173
174 /// \brief Returns a fresh newly allocated DIELoc.
174 /// Returns a fresh newly allocated DIELoc.
175175 DIELoc *getDIELoc() { return new (DIEValueAllocator) DIELoc; }
176176
177 /// \brief Insert DIE into the map.
177 /// Insert DIE into the map.
178178 ///
179179 /// We delegate the request to DwarfDebug when the MDNode can be part of the
180180 /// type system, since DIEs for the type system can be shared across CUs and
181181 /// the mappings are kept in DwarfDebug.
182182 void insertDIE(const DINode *Desc, DIE *D);
183183
184 /// \brief Add a flag that is true to the DIE.
184 /// Add a flag that is true to the DIE.
185185 void addFlag(DIE &Die, dwarf::Attribute Attribute);
186186
187 /// \brief Add an unsigned integer attribute data and value.
187 /// Add an unsigned integer attribute data and value.
188188 void addUInt(DIE &Die, dwarf::Attribute Attribute, Optional Form,
189189 uint64_t Integer);
190190
191191 void addUInt(DIE &Block, dwarf::Form Form, uint64_t Integer);
192192
193 /// \brief Add an signed integer attribute data and value.
193 /// Add an signed integer attribute data and value.
194194 void addSInt(DIE &Die, dwarf::Attribute Attribute, Optional Form,
195195 int64_t Integer);
196196
197197 void addSInt(DIELoc &Die, Optional Form, int64_t Integer);
198198
199 /// \brief Add a string attribute data and value.
199 /// Add a string attribute data and value.
200200 ///
201201 /// We always emit a reference to the string pool instead of immediate
202202 /// strings so that DIEs have more predictable sizes. In the case of split
204204 /// into the string table.
205205 void addString(DIE &Die, dwarf::Attribute Attribute, StringRef Str);
206206
207 /// \brief Add a Dwarf label attribute data and value.
207 /// Add a Dwarf label attribute data and value.
208208 DIE::value_iterator addLabel(DIE &Die, dwarf::Attribute Attribute,
209209 dwarf::Form Form, const MCSymbol *Label);
210210
211211 void addLabel(DIELoc &Die, dwarf::Form Form, const MCSymbol *Label);
212212
213 /// \brief Add an offset into a section attribute data and value.
213 /// Add an offset into a section attribute data and value.
214214 void addSectionOffset(DIE &Die, dwarf::Attribute Attribute, uint64_t Integer);
215215
216 /// \brief Add a dwarf op address data and value using the form given and an
216 /// Add a dwarf op address data and value using the form given and an
217217 /// op of either DW_FORM_addr or DW_FORM_GNU_addr_index.
218218 void addOpAddress(DIELoc &Die, const MCSymbol *Label);
219219
220 /// \brief Add a label delta attribute data and value.
220 /// Add a label delta attribute data and value.
221221 void addLabelDelta(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi,
222222 const MCSymbol *Lo);
223223
224 /// \brief Add a DIE attribute data and value.
224 /// Add a DIE attribute data and value.
225225 void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry);
226226
227 /// \brief Add a DIE attribute data and value.
227 /// Add a DIE attribute data and value.
228228 void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIEEntry Entry);
229229
230230 void addDIETypeSignature(DIE &Die, const DwarfTypeUnit &Type);
231231
232 /// \brief Add block data.
232 /// Add block data.
233233 void addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Block);
234234
235 /// \brief Add block data.
235 /// Add block data.
236236 void addBlock(DIE &Die, dwarf::Attribute Attribute, DIEBlock *Block);
237237
238 /// \brief Add location information to specified debug information entry.
238 /// Add location information to specified debug information entry.
239239 void addSourceLine(DIE &Die, unsigned Line, StringRef File,
240240 StringRef Directory);
241241 void addSourceLine(DIE &Die, const DILocalVariable *V);
245245 void addSourceLine(DIE &Die, const DINamespace *NS);
246246 void addSourceLine(DIE &Die, const DIObjCProperty *Ty);
247247
248 /// \brief Add constant value entry in variable DIE.
248 /// Add constant value entry in variable DIE.
249249 void addConstantValue(DIE &Die, const MachineOperand &MO, const DIType *Ty);
250250 void addConstantValue(DIE &Die, const ConstantInt *CI, const DIType *Ty);
251251 void addConstantValue(DIE &Die, const APInt &Val, const DIType *Ty);
252252 void addConstantValue(DIE &Die, const APInt &Val, bool Unsigned);
253253 void addConstantValue(DIE &Die, bool Unsigned, uint64_t Val);
254254
255 /// \brief Add constant value entry in variable DIE.
255 /// Add constant value entry in variable DIE.
256256 void addConstantFPValue(DIE &Die, const MachineOperand &MO);
257257 void addConstantFPValue(DIE &Die, const ConstantFP *CFP);
258258
259 /// \brief Add a linkage name, if it isn't empty.
259 /// Add a linkage name, if it isn't empty.
260260 void addLinkageName(DIE &Die, StringRef LinkageName);
261261
262 /// \brief Add template parameters in buffer.
262 /// Add template parameters in buffer.
263263 void addTemplateParams(DIE &Buffer, DINodeArray TParams);
264264
265 /// \brief Add register operand.
265 /// Add register operand.
266266 /// \returns false if the register does not exist, e.g., because it was never
267267 /// materialized.
268268 bool addRegisterOpPiece(DIELoc &TheDie, unsigned Reg,
269269 unsigned SizeInBits = 0, unsigned OffsetInBits = 0);
270270
271 /// \brief Add register offset.
271 /// Add register offset.
272272 /// \returns false if the register does not exist, e.g., because it was never
273273 /// materialized.
274274 bool addRegisterOffset(DIELoc &TheDie, unsigned Reg, int64_t Offset);
282282 dwarf::Attribute Attribute,
283283 const MachineLocation &Location);
284284
285 /// \brief Add a new type attribute to the specified entity.
285 /// Add a new type attribute to the specified entity.
286286 ///
287287 /// This takes and attribute parameter because DW_AT_friend attributes are
288288 /// also type references.
296296 void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie,
297297 bool Minimal = false);
298298
299 /// \brief Find existing DIE or create new DIE for the given type.
299 /// Find existing DIE or create new DIE for the given type.
300300 DIE *getOrCreateTypeDIE(const MDNode *N);
301301
302 /// \brief Get context owner's DIE.
302 /// Get context owner's DIE.
303303 DIE *createTypeDIE(const DICompositeType *Ty);
304304
305 /// \brief Get context owner's DIE.
305 /// Get context owner's DIE.
306306 DIE *getOrCreateContextDIE(const DIScope *Context);
307307
308 /// \brief Construct DIEs for types that contain vtables.
308 /// Construct DIEs for types that contain vtables.
309309 void constructContainingTypeDIEs();
310310
311 /// \brief Construct function argument DIEs.
311 /// Construct function argument DIEs.
312312 void constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args);
313313
314314 /// Create a DIE with the given Tag, add the DIE to its parent, and
331331 void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy);
332332
333333 protected:
334 /// \brief Create new static data member DIE.
334 /// Create new static data member DIE.
335335 DIE *getOrCreateStaticMemberDIE(const DIDerivedType *DT);
336336
337337 /// Look up the source ID with the given directory and source file names. If
338338 /// none currently exists, create a new ID and insert it in the line table.
339339 virtual unsigned getOrCreateSourceID(StringRef File, StringRef Directory) = 0;
340340
341 /// \brief Look in the DwarfDebug map for the MDNode that corresponds to the
341 /// Look in the DwarfDebug map for the MDNode that corresponds to the
342342 /// reference.
343343 template T *resolve(TypedDINodeRef Ref) const {
344344 return DD->resolve(Ref);
357357 void constructTemplateValueParameterDIE(DIE &Buffer,
358358 const DITemplateValueParameter *TVP);
359359
360 /// \brief Return the default lower bound for an array.
360 /// Return the default lower bound for an array.
361361 ///
362362 /// If the DWARF version doesn't handle the language, return -1.
363363 int64_t getDefaultLowerBound() const;
364364
365 /// \brief Get an anonymous type for index type.
365 /// Get an anonymous type for index type.
366366 DIE *getIndexTyDie();
367367
368 /// \brief Set D as anonymous type for index which can be reused later.
368 /// Set D as anonymous type for index which can be reused later.
369369 void setIndexTyDie(DIE *D) { IndexTyDie = D; }
370370
371371 /// If this is a named finished type then include it in the list of types for