1 //===-- llvm/CodeGen/DwarfDebug.h - Dwarf Debug Framework ------*- C++ -*--===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains support for writing dwarf debug info into asm files.
12 //===----------------------------------------------------------------------===//
14 #ifndef CODEGEN_ASMPRINTER_DWARFDEBUG_H__
15 #define CODEGEN_ASMPRINTER_DWARFDEBUG_H__
17 #include "AsmPrinterHandler.h"
19 #include "DebugLocEntry.h"
20 #include "DebugLocList.h"
21 #include "llvm/ADT/DenseMap.h"
22 #include "llvm/ADT/MapVector.h"
23 #include "llvm/ADT/SmallPtrSet.h"
24 #include "llvm/ADT/StringMap.h"
25 #include "llvm/ADT/FoldingSet.h"
26 #include "llvm/CodeGen/LexicalScopes.h"
27 #include "llvm/IR/DebugInfo.h"
28 #include "llvm/IR/DebugLoc.h"
29 #include "llvm/MC/MachineLocation.h"
30 #include "llvm/MC/MCDwarf.h"
31 #include "llvm/Support/Allocator.h"
39 class DwarfCompileUnit;
43 class MachineModuleInfo;
45 //===----------------------------------------------------------------------===//
46 /// \brief This class is used to record source line correspondence.
48 unsigned Line; // Source line number.
49 unsigned Column; // Source column.
50 unsigned SourceID; // Source ID number.
51 MCSymbol *Label; // Label in code ID number.
53 SrcLineInfo(unsigned L, unsigned C, unsigned S, MCSymbol *label)
54 : Line(L), Column(C), SourceID(S), Label(label) {}
57 unsigned getLine() const { return Line; }
58 unsigned getColumn() const { return Column; }
59 unsigned getSourceID() const { return SourceID; }
60 MCSymbol *getLabel() const { return Label; }
63 //===----------------------------------------------------------------------===//
64 /// \brief This class is used to track local variable information.
66 DIVariable Var; // Variable Descriptor.
67 DIE *TheDIE; // Variable DIE.
68 unsigned DotDebugLocOffset; // Offset in DotDebugLocEntries.
69 DbgVariable *AbsVar; // Corresponding Abstract variable, if any.
70 const MachineInstr *MInsn; // DBG_VALUE instruction of the variable.
75 // AbsVar may be NULL.
76 DbgVariable(DIVariable V, DbgVariable *AV, DwarfDebug *DD)
77 : Var(V), TheDIE(0), DotDebugLocOffset(~0U), AbsVar(AV), MInsn(0),
78 FrameIndex(~0), DD(DD) {}
81 DIVariable getVariable() const { return Var; }
82 void setDIE(DIE *D) { TheDIE = D; }
83 DIE *getDIE() const { return TheDIE; }
84 void setDotDebugLocOffset(unsigned O) { DotDebugLocOffset = O; }
85 unsigned getDotDebugLocOffset() const { return DotDebugLocOffset; }
86 StringRef getName() const { return Var.getName(); }
87 DbgVariable *getAbstractVariable() const { return AbsVar; }
88 const MachineInstr *getMInsn() const { return MInsn; }
89 void setMInsn(const MachineInstr *M) { MInsn = M; }
90 int getFrameIndex() const { return FrameIndex; }
91 void setFrameIndex(int FI) { FrameIndex = FI; }
92 // Translate tag to proper Dwarf tag.
93 dwarf::Tag getTag() const {
94 if (Var.getTag() == dwarf::DW_TAG_arg_variable)
95 return dwarf::DW_TAG_formal_parameter;
97 return dwarf::DW_TAG_variable;
99 /// \brief Return true if DbgVariable is artificial.
100 bool isArtificial() const {
101 if (Var.isArtificial())
103 if (getType().isArtificial())
108 bool isObjectPointer() const {
109 if (Var.isObjectPointer())
111 if (getType().isObjectPointer())
116 bool variableHasComplexAddress() const {
117 assert(Var.isVariable() && "Invalid complex DbgVariable!");
118 return Var.hasComplexAddress();
120 bool isBlockByrefVariable() const;
121 unsigned getNumAddrElements() const {
122 assert(Var.isVariable() && "Invalid complex DbgVariable!");
123 return Var.getNumAddrElements();
125 uint64_t getAddrElement(unsigned i) const { return Var.getAddrElement(i); }
126 DIType getType() const;
129 /// resolve - Look in the DwarfDebug map for the MDNode that
130 /// corresponds to the reference.
131 template <typename T> T resolve(DIRef<T> Ref) const;
134 /// \brief Collects and handles information specific to a particular
135 /// collection of units. This collection represents all of the units
136 /// that will be ultimately output into a single object file.
138 // Target of Dwarf emission, used for sizing of abbreviations.
141 // Used to uniquely define abbreviations.
142 FoldingSet<DIEAbbrev> AbbreviationsSet;
144 // A list of all the unique abbreviations in use.
145 std::vector<DIEAbbrev *> Abbreviations;
147 // A pointer to all units in the section.
148 SmallVector<DwarfUnit *, 1> CUs;
150 // Collection of strings for this unit and assorted symbols.
151 // A String->Symbol mapping of strings used by indirect
153 typedef StringMap<std::pair<MCSymbol *, unsigned>, BumpPtrAllocator &>
156 unsigned NextStringPoolNumber;
157 std::string StringPref;
159 struct AddressPoolEntry {
162 AddressPoolEntry(unsigned Number, bool TLS) : Number(Number), TLS(TLS) {}
164 // Collection of addresses for this unit and assorted labels.
165 // A Symbol->unsigned mapping of addresses used by indirect
167 typedef DenseMap<const MCSymbol *, AddressPoolEntry> AddrPool;
168 AddrPool AddressPool;
171 DwarfFile(AsmPrinter *AP, const char *Pref, BumpPtrAllocator &DA)
172 : Asm(AP), StringPool(DA), NextStringPoolNumber(0), StringPref(Pref) {}
176 const SmallVectorImpl<DwarfUnit *> &getUnits() { return CUs; }
178 /// \brief Compute the size and offset of a DIE given an incoming Offset.
179 unsigned computeSizeAndOffset(DIE &Die, unsigned Offset);
181 /// \brief Compute the size and offset of all the DIEs.
182 void computeSizeAndOffsets();
184 /// \brief Define a unique number for the abbreviation.
185 void assignAbbrevNumber(DIEAbbrev &Abbrev);
187 /// \brief Add a unit to the list of CUs.
188 void addUnit(DwarfUnit *CU) { CUs.push_back(CU); }
190 /// \brief Emit all of the units to the section listed with the given
191 /// abbreviation section.
192 void emitUnits(DwarfDebug *DD, const MCSymbol *ASectionSym);
194 /// \brief Emit a set of abbreviations to the specific section.
195 void emitAbbrevs(const MCSection *);
197 /// \brief Emit all of the strings to the section given.
198 void emitStrings(const MCSection *StrSection, const MCSection *OffsetSection,
199 const MCSymbol *StrSecSym);
201 /// \brief Emit all of the addresses to the section given.
202 void emitAddresses(const MCSection *AddrSection);
204 /// \brief Returns the entry into the start of the pool.
205 MCSymbol *getStringPoolSym();
207 /// \brief Returns an entry into the string pool with the given
209 MCSymbol *getStringPoolEntry(StringRef Str);
211 /// \brief Returns the index into the string pool with the given
213 unsigned getStringPoolIndex(StringRef Str);
215 /// \brief Returns the string pool.
216 StrPool *getStringPool() { return &StringPool; }
218 /// \brief Returns the index into the address pool with the given
220 unsigned getAddrPoolIndex(const MCSymbol *Sym, bool TLS = false);
222 /// \brief Returns the address pool.
223 AddrPool *getAddrPool() { return &AddressPool; }
226 /// \brief Helper used to pair up a symbol and its DWARF compile unit.
228 SymbolCU(DwarfCompileUnit *CU, const MCSymbol *Sym) : Sym(Sym), CU(CU) {}
230 DwarfCompileUnit *CU;
233 /// \brief Collects and handles dwarf debug information.
234 class DwarfDebug : public AsmPrinterHandler {
235 // Target of Dwarf emission.
238 // Collected machine module information.
239 MachineModuleInfo *MMI;
241 // All DIEValues are allocated through this allocator.
242 BumpPtrAllocator DIEValueAllocator;
244 // Handle to the compile unit used for the inline extension handling,
245 // this is just so that the DIEValue allocator has a place to store
246 // the particular elements.
247 // FIXME: Store these off of DwarfDebug instead?
248 DwarfCompileUnit *FirstCU;
250 // Maps MDNode with its corresponding DwarfCompileUnit.
251 MapVector<const MDNode *, DwarfCompileUnit *> CUMap;
253 // Maps subprogram MDNode with its corresponding DwarfCompileUnit.
254 DenseMap<const MDNode *, DwarfCompileUnit *> SPMap;
256 // Maps a CU DIE with its corresponding DwarfCompileUnit.
257 DenseMap<const DIE *, DwarfCompileUnit *> CUDieMap;
259 /// Maps MDNodes for type system with the corresponding DIEs. These DIEs can
260 /// be shared across CUs, that is why we keep the map here instead
261 /// of in DwarfCompileUnit.
262 DenseMap<const MDNode *, DIE *> MDTypeNodeToDieMap;
264 // List of all labels used in aranges generation.
265 std::vector<SymbolCU> ArangeLabels;
267 // Size of each symbol emitted (for those symbols that have a specific size).
268 DenseMap<const MCSymbol *, uint64_t> SymSize;
270 // Provides a unique id per text section.
271 typedef DenseMap<const MCSection *, SmallVector<SymbolCU, 8> > SectionMapType;
272 SectionMapType SectionMap;
274 // List of arguments for current function.
275 SmallVector<DbgVariable *, 8> CurrentFnArguments;
277 LexicalScopes LScopes;
279 // Collection of abstract subprogram DIEs.
280 DenseMap<const MDNode *, DIE *> AbstractSPDies;
282 // Collection of dbg variables of a scope.
283 typedef DenseMap<LexicalScope *, SmallVector<DbgVariable *, 8> >
285 ScopeVariablesMap ScopeVariables;
287 // Collection of abstract variables.
288 DenseMap<const MDNode *, DbgVariable *> AbstractVariables;
290 // Collection of DebugLocEntry. Stored in a linked list so that DIELocLists
291 // can refer to them in spite of insertions into this list.
292 SmallVector<DebugLocList, 4> DotDebugLocEntries;
294 // Collection of subprogram DIEs that are marked (at the end of the module)
296 SmallPtrSet<DIE *, 4> InlinedSubprogramDIEs;
298 // This is a collection of subprogram MDNodes that are processed to
300 SmallPtrSet<const MDNode *, 16> ProcessedSPNodes;
302 // Maps instruction with label emitted before instruction.
303 DenseMap<const MachineInstr *, MCSymbol *> LabelsBeforeInsn;
305 // Maps instruction with label emitted after instruction.
306 DenseMap<const MachineInstr *, MCSymbol *> LabelsAfterInsn;
308 // Every user variable mentioned by a DBG_VALUE instruction in order of
310 SmallVector<const MDNode *, 8> UserVariables;
312 // For each user variable, keep a list of DBG_VALUE instructions in order.
313 // The list can also contain normal instructions that clobber the previous
315 typedef DenseMap<const MDNode *, SmallVector<const MachineInstr *, 4> >
317 DbgValueHistoryMap DbgValues;
319 // Previous instruction's location information. This is used to determine
320 // label location to indicate scope boundries in dwarf debug info.
321 DebugLoc PrevInstLoc;
324 // This location indicates end of function prologue and beginning of function
326 DebugLoc PrologEndLoc;
328 // If nonnull, stores the current machine function we're processing.
329 const MachineFunction *CurFn;
331 // If nonnull, stores the current machine instruction we're processing.
332 const MachineInstr *CurMI;
334 // If nonnull, stores the section that the previous function was allocated to
336 const MCSection *PrevSection;
338 // If nonnull, stores the CU in which the previous subprogram was contained.
339 const DwarfCompileUnit *PrevCU;
341 // Section Symbols: these are assembler temporary labels that are emitted at
342 // the beginning of each supported dwarf section. These are used to form
343 // section offsets and are created by EmitSectionLabels.
344 MCSymbol *DwarfInfoSectionSym, *DwarfAbbrevSectionSym;
345 MCSymbol *DwarfStrSectionSym, *TextSectionSym, *DwarfDebugRangeSectionSym;
346 MCSymbol *DwarfDebugLocSectionSym, *DwarfLineSectionSym, *DwarfAddrSectionSym;
347 MCSymbol *FunctionBeginSym, *FunctionEndSym;
348 MCSymbol *DwarfInfoDWOSectionSym, *DwarfAbbrevDWOSectionSym;
349 MCSymbol *DwarfStrDWOSectionSym;
350 MCSymbol *DwarfGnuPubNamesSectionSym, *DwarfGnuPubTypesSectionSym;
352 // As an optimization, there is no need to emit an entry in the directory
353 // table for the same directory as DW_AT_comp_dir.
354 StringRef CompilationDir;
356 // Counter for assigning globally unique IDs for ranges.
357 unsigned GlobalRangeCount;
359 // Holder for the file specific debug information.
360 DwarfFile InfoHolder;
362 // Holders for the various debug information flags that we might need to
363 // have exposed. See accessor functions below for description.
365 // Holder for imported entities.
366 typedef SmallVector<std::pair<const MDNode *, const MDNode *>, 32>
368 ImportedEntityMap ScopesWithImportedEntities;
370 // Map from MDNodes for user-defined types to the type units that describe
372 DenseMap<const MDNode *, const DwarfTypeUnit *> DwarfTypeUnits;
374 // Whether to emit the pubnames/pubtypes sections.
375 bool HasDwarfPubSections;
377 // Whether or not to use AT_ranges for compilation units.
380 // Whether we emitted a function into a section other than the default
382 bool UsedNonDefaultText;
384 // Version of dwarf we're emitting.
385 unsigned DwarfVersion;
387 // Maps from a type identifier to the actual MDNode.
388 DITypeIdentifierMap TypeIdentifierMap;
390 // DWARF5 Experimental Options
391 bool HasDwarfAccelTables;
394 // Separated Dwarf Variables
395 // In general these will all be for bits that are left in the
396 // original object file, rather than things that are meant
397 // to be in the .dwo sections.
399 // Holder for the skeleton information.
400 DwarfFile SkeletonHolder;
402 /// Store file names for type units under fission in a line table header that
403 /// will be emitted into debug_line.dwo.
404 // FIXME: replace this with a map from comp_dir to table so that we can emit
405 // multiple tables during LTO each of which uses directory 0, referencing the
406 // comp_dir of all the type units that use it.
407 MCDwarfDwoLineTable SplitTypeUnitFileTable;
409 // True iff there are multiple CUs in this module.
412 MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &);
414 void addScopeVariable(LexicalScope *LS, DbgVariable *Var);
416 const SmallVectorImpl<DwarfUnit *> &getUnits() {
417 return InfoHolder.getUnits();
420 /// \brief Find abstract variable associated with Var.
421 DbgVariable *findAbstractVariable(DIVariable &Var, DebugLoc Loc);
423 /// \brief Find DIE for the given subprogram and attach appropriate
424 /// DW_AT_low_pc and DW_AT_high_pc attributes. If there are global
425 /// variables in this scope then create and insert DIEs for these
427 DIE *updateSubprogramScopeDIE(DwarfCompileUnit *SPCU, DISubprogram SP);
429 /// \brief A helper function to check whether the DIE for a given Scope is
430 /// going to be null.
431 bool isLexicalScopeDIENull(LexicalScope *Scope);
433 /// \brief A helper function to construct a RangeSpanList for a given
435 void addScopeRangeList(DwarfCompileUnit *TheCU, DIE *ScopeDIE,
436 const SmallVectorImpl<InsnRange> &Range);
438 /// \brief Construct new DW_TAG_lexical_block for this scope and
439 /// attach DW_AT_low_pc/DW_AT_high_pc labels.
440 DIE *constructLexicalScopeDIE(DwarfCompileUnit *TheCU, LexicalScope *Scope);
442 /// \brief This scope represents inlined body of a function. Construct
443 /// DIE to represent this concrete inlined copy of the function.
444 DIE *constructInlinedScopeDIE(DwarfCompileUnit *TheCU, LexicalScope *Scope);
446 /// \brief Construct a DIE for this scope.
447 DIE *constructScopeDIE(DwarfCompileUnit *TheCU, LexicalScope *Scope);
448 /// A helper function to create children of a Scope DIE.
449 DIE *createScopeChildrenDIE(DwarfCompileUnit *TheCU, LexicalScope *Scope,
450 SmallVectorImpl<DIE *> &Children);
452 /// \brief Emit initial Dwarf sections with a label at the start of each one.
453 void emitSectionLabels();
455 /// \brief Compute the size and offset of a DIE given an incoming Offset.
456 unsigned computeSizeAndOffset(DIE *Die, unsigned Offset);
458 /// \brief Compute the size and offset of all the DIEs.
459 void computeSizeAndOffsets();
461 /// \brief Attach DW_AT_inline attribute with inlined subprogram DIEs.
462 void computeInlinedDIEs();
464 /// \brief Collect info for variables that were optimized out.
465 void collectDeadVariables();
467 /// \brief Finish off debug information after all functions have been
469 void finalizeModuleInfo();
471 /// \brief Emit labels to close any remaining sections that have been left
475 /// \brief Emit the debug info section.
476 void emitDebugInfo();
478 /// \brief Emit the abbreviation section.
479 void emitAbbreviations();
481 /// \brief Emit the last address of the section and the end of
483 void emitEndOfLineMatrix(unsigned SectionEnd);
485 /// \brief Emit visible names into a hashed accelerator table section.
486 void emitAccelNames();
488 /// \brief Emit objective C classes and categories into a hashed
489 /// accelerator table section.
490 void emitAccelObjC();
492 /// \brief Emit namespace dies into a hashed accelerator table.
493 void emitAccelNamespaces();
495 /// \brief Emit type dies into a hashed accelerator table.
496 void emitAccelTypes();
498 /// \brief Emit visible names into a debug pubnames section.
499 /// \param GnuStyle determines whether or not we want to emit
500 /// additional information into the table ala newer gcc for gdb
502 void emitDebugPubNames(bool GnuStyle = false);
504 /// \brief Emit visible types into a debug pubtypes section.
505 /// \param GnuStyle determines whether or not we want to emit
506 /// additional information into the table ala newer gcc for gdb
508 void emitDebugPubTypes(bool GnuStyle = false);
511 emitDebugPubSection(bool GnuStyle, const MCSection *PSec, StringRef Name,
512 const StringMap<const DIE *> &(DwarfUnit::*Accessor)()
515 /// \brief Emit visible names into a debug str section.
518 /// \brief Emit visible names into a debug loc section.
521 /// \brief Emit visible names into a debug loc dwo section.
522 void emitDebugLocDWO();
524 /// \brief Emit visible names into a debug aranges section.
525 void emitDebugARanges();
527 /// \brief Emit visible names into a debug ranges section.
528 void emitDebugRanges();
530 /// \brief Emit inline info using custom format.
531 void emitDebugInlineInfo();
533 /// DWARF 5 Experimental Split Dwarf Emitters
535 /// \brief Initialize common features of skeleton units.
536 void initSkeletonUnit(const DwarfUnit *U, DIE *Die, DwarfUnit *NewU);
538 /// \brief Construct the split debug info compile unit for the debug info
540 DwarfCompileUnit *constructSkeletonCU(const DwarfCompileUnit *CU);
542 /// \brief Construct the split debug info compile unit for the debug info
544 DwarfTypeUnit *constructSkeletonTU(DwarfTypeUnit *TU);
546 /// \brief Emit the debug info dwo section.
547 void emitDebugInfoDWO();
549 /// \brief Emit the debug abbrev dwo section.
550 void emitDebugAbbrevDWO();
552 /// \brief Emit the debug line dwo section.
553 void emitDebugLineDWO();
555 /// \brief Emit the debug str dwo section.
556 void emitDebugStrDWO();
558 /// Flags to let the linker know we have emitted new style pubnames. Only
559 /// emit it here if we don't have a skeleton CU for split dwarf.
560 void addGnuPubAttributes(DwarfUnit *U, DIE *D) const;
562 /// \brief Create new DwarfCompileUnit for the given metadata node with tag
563 /// DW_TAG_compile_unit.
564 DwarfCompileUnit *constructDwarfCompileUnit(DICompileUnit DIUnit);
566 /// \brief Construct subprogram DIE.
567 void constructSubprogramDIE(DwarfCompileUnit *TheCU, const MDNode *N);
569 /// \brief Construct imported_module or imported_declaration DIE.
570 void constructImportedEntityDIE(DwarfCompileUnit *TheCU, const MDNode *N);
572 /// \brief Construct import_module DIE.
573 void constructImportedEntityDIE(DwarfCompileUnit *TheCU, const MDNode *N,
576 /// \brief Construct import_module DIE.
577 void constructImportedEntityDIE(DwarfCompileUnit *TheCU,
578 const DIImportedEntity &Module, DIE *Context);
580 /// \brief Register a source line with debug info. Returns the unique
581 /// label that was emitted and which provides correspondence to the
582 /// source line list.
583 void recordSourceLine(unsigned Line, unsigned Col, const MDNode *Scope,
586 /// \brief Indentify instructions that are marking the beginning of or
587 /// ending of a scope.
588 void identifyScopeMarkers();
590 /// \brief If Var is an current function argument that add it in
591 /// CurrentFnArguments list.
592 bool addCurrentFnArgument(DbgVariable *Var, LexicalScope *Scope);
594 /// \brief Populate LexicalScope entries with variables' info.
595 void collectVariableInfo(SmallPtrSet<const MDNode *, 16> &ProcessedVars);
597 /// \brief Collect variable information from the side table maintained
599 void collectVariableInfoFromMMITable(SmallPtrSet<const MDNode *, 16> &P);
601 /// \brief Ensure that a label will be emitted before MI.
602 void requestLabelBeforeInsn(const MachineInstr *MI) {
603 LabelsBeforeInsn.insert(std::make_pair(MI, (MCSymbol *)0));
606 /// \brief Return Label preceding the instruction.
607 MCSymbol *getLabelBeforeInsn(const MachineInstr *MI);
609 /// \brief Ensure that a label will be emitted after MI.
610 void requestLabelAfterInsn(const MachineInstr *MI) {
611 LabelsAfterInsn.insert(std::make_pair(MI, (MCSymbol *)0));
614 /// \brief Return Label immediately following the instruction.
615 MCSymbol *getLabelAfterInsn(const MachineInstr *MI);
617 void attachLowHighPC(DwarfCompileUnit *Unit, DIE *D, MCSymbol *Begin,
621 //===--------------------------------------------------------------------===//
622 // Main entry points.
624 DwarfDebug(AsmPrinter *A, Module *M);
626 void insertDIE(const MDNode *TypeMD, DIE *Die) {
627 MDTypeNodeToDieMap.insert(std::make_pair(TypeMD, Die));
629 DIE *getDIE(const MDNode *TypeMD) {
630 return MDTypeNodeToDieMap.lookup(TypeMD);
633 /// \brief Emit all Dwarf sections that should come prior to the
637 /// \brief Emit all Dwarf sections that should come after the content.
638 void endModule() override;
640 /// \brief Gather pre-function debug information.
641 void beginFunction(const MachineFunction *MF) override;
643 /// \brief Gather and emit post-function debug information.
644 void endFunction(const MachineFunction *MF) override;
646 /// \brief Process beginning of an instruction.
647 void beginInstruction(const MachineInstr *MI) override;
649 /// \brief Process end of an instruction.
650 void endInstruction() override;
652 /// \brief Add a DIE to the set of types that we're going to pull into
654 void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier,
655 DIE *Die, DICompositeType CTy);
657 /// \brief Add a label so that arange data can be generated for it.
658 void addArangeLabel(SymbolCU SCU) { ArangeLabels.push_back(SCU); }
660 /// \brief For symbols that have a size designated (e.g. common symbols),
661 /// this tracks that size.
662 void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override {
666 /// \brief Recursively Emits a debug information entry.
667 void emitDIE(DIE &Die);
669 // Experimental DWARF5 features.
671 /// \brief Returns whether or not to emit tables that dwarf consumers can
672 /// use to accelerate lookup.
673 bool useDwarfAccelTables() const { return HasDwarfAccelTables; }
675 /// \brief Returns whether or not to change the current debug info for the
676 /// split dwarf proposal support.
677 bool useSplitDwarf() const { return HasSplitDwarf; }
679 /// Returns the Dwarf Version.
680 unsigned getDwarfVersion() const { return DwarfVersion; }
682 /// Returns the section symbol for the .debug_loc section.
683 MCSymbol *getDebugLocSym() const { return DwarfDebugLocSectionSym; }
685 /// Returns the previous section that was emitted into.
686 const MCSection *getPrevSection() const { return PrevSection; }
688 /// Returns the previous CU that was being updated
689 const DwarfCompileUnit *getPrevCU() const { return PrevCU; }
691 /// Returns the entries for the .debug_loc section.
692 const SmallVectorImpl<DebugLocList> &
693 getDebugLocEntries() const {
694 return DotDebugLocEntries;
697 /// \brief Emit an entry for the debug loc section. This can be used to
698 /// handle an entry that's going to be emitted into the debug loc section.
699 void emitDebugLocEntry(ByteStreamer &Streamer, const DebugLocEntry &Entry);
701 /// Emit the location for a debug loc entry, including the size header.
702 void emitDebugLocEntryLocation(const DebugLocEntry &Entry);
704 /// Find the MDNode for the given reference.
705 template <typename T> T resolve(DIRef<T> Ref) const {
706 return Ref.resolve(TypeIdentifierMap);
709 /// \brief Return the TypeIdentifierMap.
710 const DITypeIdentifierMap &getTypeIdentifierMap() const {
711 return TypeIdentifierMap;
714 /// Find the DwarfCompileUnit for the given CU Die.
715 DwarfCompileUnit *lookupUnit(const DIE *CU) const {
716 return CUDieMap.lookup(CU);
718 /// isSubprogramContext - Return true if Context is either a subprogram
719 /// or another context nested inside a subprogram.
720 bool isSubprogramContext(const MDNode *Context);
722 } // End of namespace llvm