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"
41 class DwarfCompileUnit;
45 class MachineModuleInfo;
47 //===----------------------------------------------------------------------===//
48 /// \brief This class is used to record source line correspondence.
50 unsigned Line; // Source line number.
51 unsigned Column; // Source column.
52 unsigned SourceID; // Source ID number.
53 MCSymbol *Label; // Label in code ID number.
55 SrcLineInfo(unsigned L, unsigned C, unsigned S, MCSymbol *label)
56 : Line(L), Column(C), SourceID(S), Label(label) {}
59 unsigned getLine() const { return Line; }
60 unsigned getColumn() const { return Column; }
61 unsigned getSourceID() const { return SourceID; }
62 MCSymbol *getLabel() const { return Label; }
65 //===----------------------------------------------------------------------===//
66 /// \brief This class is used to track local variable information.
68 DIVariable Var; // Variable Descriptor.
69 DIE *TheDIE; // Variable DIE.
70 unsigned DotDebugLocOffset; // Offset in DotDebugLocEntries.
71 DbgVariable *AbsVar; // Corresponding Abstract variable, if any.
72 const MachineInstr *MInsn; // DBG_VALUE instruction of the variable.
77 // AbsVar may be NULL.
78 DbgVariable(DIVariable V, DbgVariable *AV, DwarfDebug *DD)
79 : Var(V), TheDIE(0), DotDebugLocOffset(~0U), AbsVar(AV), MInsn(0),
80 FrameIndex(~0), DD(DD) {}
83 DIVariable getVariable() const { return Var; }
84 void setDIE(DIE *D) { TheDIE = D; }
85 DIE *getDIE() const { return TheDIE; }
86 void setDotDebugLocOffset(unsigned O) { DotDebugLocOffset = O; }
87 unsigned getDotDebugLocOffset() const { return DotDebugLocOffset; }
88 StringRef getName() const { return Var.getName(); }
89 DbgVariable *getAbstractVariable() const { return AbsVar; }
90 const MachineInstr *getMInsn() const { return MInsn; }
91 void setMInsn(const MachineInstr *M) { MInsn = M; }
92 int getFrameIndex() const { return FrameIndex; }
93 void setFrameIndex(int FI) { FrameIndex = FI; }
94 // Translate tag to proper Dwarf tag.
95 dwarf::Tag getTag() const {
96 if (Var.getTag() == dwarf::DW_TAG_arg_variable)
97 return dwarf::DW_TAG_formal_parameter;
99 return dwarf::DW_TAG_variable;
101 /// \brief Return true if DbgVariable is artificial.
102 bool isArtificial() const {
103 if (Var.isArtificial())
105 if (getType().isArtificial())
110 bool isObjectPointer() const {
111 if (Var.isObjectPointer())
113 if (getType().isObjectPointer())
118 bool variableHasComplexAddress() const {
119 assert(Var.isVariable() && "Invalid complex DbgVariable!");
120 return Var.hasComplexAddress();
122 bool isBlockByrefVariable() const;
123 unsigned getNumAddrElements() const {
124 assert(Var.isVariable() && "Invalid complex DbgVariable!");
125 return Var.getNumAddrElements();
127 uint64_t getAddrElement(unsigned i) const { return Var.getAddrElement(i); }
128 DIType getType() const;
131 /// resolve - Look in the DwarfDebug map for the MDNode that
132 /// corresponds to the reference.
133 template <typename T> T resolve(DIRef<T> Ref) const;
136 /// \brief Collects and handles information specific to a particular
137 /// collection of units. This collection represents all of the units
138 /// that will be ultimately output into a single object file.
140 // Target of Dwarf emission, used for sizing of abbreviations.
143 // Used to uniquely define abbreviations.
144 FoldingSet<DIEAbbrev> AbbreviationsSet;
146 // A list of all the unique abbreviations in use.
147 std::vector<DIEAbbrev *> Abbreviations;
149 // A pointer to all units in the section.
150 SmallVector<std::unique_ptr<DwarfUnit>, 1> CUs;
152 // Collection of strings for this unit and assorted symbols.
153 // A String->Symbol mapping of strings used by indirect
155 typedef StringMap<std::pair<MCSymbol *, unsigned>, BumpPtrAllocator &>
158 unsigned NextStringPoolNumber;
159 std::string StringPref;
161 struct AddressPoolEntry {
164 AddressPoolEntry(unsigned Number, bool TLS) : Number(Number), TLS(TLS) {}
166 // Collection of addresses for this unit and assorted labels.
167 // A Symbol->unsigned mapping of addresses used by indirect
169 typedef DenseMap<const MCSymbol *, AddressPoolEntry> AddrPool;
170 AddrPool AddressPool;
173 DwarfFile(AsmPrinter *AP, const char *Pref, BumpPtrAllocator &DA);
177 const SmallVectorImpl<std::unique_ptr<DwarfUnit>> &getUnits() { return CUs; }
179 /// \brief Compute the size and offset of a DIE given an incoming Offset.
180 unsigned computeSizeAndOffset(DIE &Die, unsigned Offset);
182 /// \brief Compute the size and offset of all the DIEs.
183 void computeSizeAndOffsets();
185 /// \brief Define a unique number for the abbreviation.
186 void assignAbbrevNumber(DIEAbbrev &Abbrev);
188 /// \brief Add a unit to the list of CUs.
189 void addUnit(std::unique_ptr<DwarfUnit> U);
191 /// \brief Emit all of the units to the section listed with the given
192 /// abbreviation section.
193 void emitUnits(DwarfDebug *DD, const MCSymbol *ASectionSym);
195 /// \brief Emit a set of abbreviations to the specific section.
196 void emitAbbrevs(const MCSection *);
198 /// \brief Emit all of the strings to the section given.
199 void emitStrings(const MCSection *StrSection, const MCSection *OffsetSection,
200 const MCSymbol *StrSecSym);
202 /// \brief Emit all of the addresses to the section given.
203 void emitAddresses(const MCSection *AddrSection);
205 /// \brief Returns the entry into the start of the pool.
206 MCSymbol *getStringPoolSym();
208 /// \brief Returns an entry into the string pool with the given
210 MCSymbol *getStringPoolEntry(StringRef Str);
212 /// \brief Returns the index into the string pool with the given
214 unsigned getStringPoolIndex(StringRef Str);
216 /// \brief Returns the string pool.
217 StrPool *getStringPool() { return &StringPool; }
219 /// \brief Returns the index into the address pool with the given
221 unsigned getAddrPoolIndex(const MCSymbol *Sym, bool TLS = false);
223 /// \brief Returns the address pool.
224 AddrPool *getAddrPool() { return &AddressPool; }
227 /// \brief Helper used to pair up a symbol and its DWARF compile unit.
229 SymbolCU(DwarfCompileUnit *CU, const MCSymbol *Sym) : Sym(Sym), CU(CU) {}
231 DwarfCompileUnit *CU;
234 /// \brief Collects and handles dwarf debug information.
235 class DwarfDebug : public AsmPrinterHandler {
236 // Target of Dwarf emission.
239 // Collected machine module information.
240 MachineModuleInfo *MMI;
242 // All DIEValues are allocated through this allocator.
243 BumpPtrAllocator DIEValueAllocator;
245 // Handle to the compile unit used for the inline extension handling,
246 // this is just so that the DIEValue allocator has a place to store
247 // the particular elements.
248 // FIXME: Store these off of DwarfDebug instead?
249 DwarfCompileUnit *FirstCU;
251 // Maps MDNode with its corresponding DwarfCompileUnit.
252 MapVector<const MDNode *, DwarfCompileUnit *> CUMap;
254 // Maps subprogram MDNode with its corresponding DwarfCompileUnit.
255 DenseMap<const MDNode *, DwarfCompileUnit *> SPMap;
257 // Maps a CU DIE with its corresponding DwarfCompileUnit.
258 DenseMap<const DIE *, DwarfCompileUnit *> CUDieMap;
260 /// Maps MDNodes for type system with the corresponding DIEs. These DIEs can
261 /// be shared across CUs, that is why we keep the map here instead
262 /// of in DwarfCompileUnit.
263 DenseMap<const MDNode *, DIE *> MDTypeNodeToDieMap;
265 // List of all labels used in aranges generation.
266 std::vector<SymbolCU> ArangeLabels;
268 // Size of each symbol emitted (for those symbols that have a specific size).
269 DenseMap<const MCSymbol *, uint64_t> SymSize;
271 // Provides a unique id per text section.
272 typedef DenseMap<const MCSection *, SmallVector<SymbolCU, 8> > SectionMapType;
273 SectionMapType SectionMap;
275 // List of arguments for current function.
276 SmallVector<DbgVariable *, 8> CurrentFnArguments;
278 LexicalScopes LScopes;
280 // Collection of abstract subprogram DIEs.
281 DenseMap<const MDNode *, DIE *> AbstractSPDies;
283 // Collection of dbg variables of a scope.
284 typedef DenseMap<LexicalScope *, SmallVector<DbgVariable *, 8> >
286 ScopeVariablesMap ScopeVariables;
288 // Collection of abstract variables.
289 DenseMap<const MDNode *, DbgVariable *> AbstractVariables;
291 // Collection of DebugLocEntry. Stored in a linked list so that DIELocLists
292 // can refer to them in spite of insertions into this list.
293 SmallVector<DebugLocList, 4> DotDebugLocEntries;
295 // Collection of subprogram DIEs that are marked (at the end of the module)
297 SmallPtrSet<DIE *, 4> InlinedSubprogramDIEs;
299 // This is a collection of subprogram MDNodes that are processed to
301 SmallPtrSet<const MDNode *, 16> ProcessedSPNodes;
303 // Maps instruction with label emitted before instruction.
304 DenseMap<const MachineInstr *, MCSymbol *> LabelsBeforeInsn;
306 // Maps instruction with label emitted after instruction.
307 DenseMap<const MachineInstr *, MCSymbol *> LabelsAfterInsn;
309 // Every user variable mentioned by a DBG_VALUE instruction in order of
311 SmallVector<const MDNode *, 8> UserVariables;
313 // For each user variable, keep a list of DBG_VALUE instructions in order.
314 // The list can also contain normal instructions that clobber the previous
316 typedef DenseMap<const MDNode *, SmallVector<const MachineInstr *, 4> >
318 DbgValueHistoryMap DbgValues;
320 // Previous instruction's location information. This is used to determine
321 // label location to indicate scope boundries in dwarf debug info.
322 DebugLoc PrevInstLoc;
325 // This location indicates end of function prologue and beginning of function
327 DebugLoc PrologEndLoc;
329 // If nonnull, stores the current machine function we're processing.
330 const MachineFunction *CurFn;
332 // If nonnull, stores the current machine instruction we're processing.
333 const MachineInstr *CurMI;
335 // If nonnull, stores the section that the previous function was allocated to
337 const MCSection *PrevSection;
339 // If nonnull, stores the CU in which the previous subprogram was contained.
340 const DwarfCompileUnit *PrevCU;
342 // Section Symbols: these are assembler temporary labels that are emitted at
343 // the beginning of each supported dwarf section. These are used to form
344 // section offsets and are created by EmitSectionLabels.
345 MCSymbol *DwarfInfoSectionSym, *DwarfAbbrevSectionSym;
346 MCSymbol *DwarfStrSectionSym, *TextSectionSym, *DwarfDebugRangeSectionSym;
347 MCSymbol *DwarfDebugLocSectionSym, *DwarfLineSectionSym, *DwarfAddrSectionSym;
348 MCSymbol *FunctionBeginSym, *FunctionEndSym;
349 MCSymbol *DwarfInfoDWOSectionSym, *DwarfAbbrevDWOSectionSym;
350 MCSymbol *DwarfStrDWOSectionSym;
351 MCSymbol *DwarfGnuPubNamesSectionSym, *DwarfGnuPubTypesSectionSym;
353 // As an optimization, there is no need to emit an entry in the directory
354 // table for the same directory as DW_AT_comp_dir.
355 StringRef CompilationDir;
357 // Counter for assigning globally unique IDs for ranges.
358 unsigned GlobalRangeCount;
360 // Holder for the file specific debug information.
361 DwarfFile InfoHolder;
363 // Holders for the various debug information flags that we might need to
364 // have exposed. See accessor functions below for description.
366 // Holder for imported entities.
367 typedef SmallVector<std::pair<const MDNode *, const MDNode *>, 32>
369 ImportedEntityMap ScopesWithImportedEntities;
371 // Map from MDNodes for user-defined types to the type units that describe
373 DenseMap<const MDNode *, const DwarfTypeUnit *> DwarfTypeUnits;
375 // Whether to emit the pubnames/pubtypes sections.
376 bool HasDwarfPubSections;
378 // Whether or not to use AT_ranges for compilation units.
381 // Whether we emitted a function into a section other than the default
383 bool UsedNonDefaultText;
385 // Version of dwarf we're emitting.
386 unsigned DwarfVersion;
388 // Maps from a type identifier to the actual MDNode.
389 DITypeIdentifierMap TypeIdentifierMap;
391 // DWARF5 Experimental Options
392 bool HasDwarfAccelTables;
395 // Separated Dwarf Variables
396 // In general these will all be for bits that are left in the
397 // original object file, rather than things that are meant
398 // to be in the .dwo sections.
400 // Holder for the skeleton information.
401 DwarfFile SkeletonHolder;
403 /// Store file names for type units under fission in a line table header that
404 /// will be emitted into debug_line.dwo.
405 // FIXME: replace this with a map from comp_dir to table so that we can emit
406 // multiple tables during LTO each of which uses directory 0, referencing the
407 // comp_dir of all the type units that use it.
408 MCDwarfDwoLineTable SplitTypeUnitFileTable;
410 // True iff there are multiple CUs in this module.
413 MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &);
415 void addScopeVariable(LexicalScope *LS, DbgVariable *Var);
417 const SmallVectorImpl<std::unique_ptr<DwarfUnit>> &getUnits() {
418 return InfoHolder.getUnits();
421 /// \brief Find abstract variable associated with Var.
422 DbgVariable *findAbstractVariable(DIVariable &Var, DebugLoc Loc);
424 /// \brief Find DIE for the given subprogram and attach appropriate
425 /// DW_AT_low_pc and DW_AT_high_pc attributes. If there are global
426 /// variables in this scope then create and insert DIEs for these
428 DIE *updateSubprogramScopeDIE(DwarfCompileUnit &SPCU, DISubprogram SP);
430 /// \brief A helper function to check whether the DIE for a given Scope is
431 /// going to be null.
432 bool isLexicalScopeDIENull(LexicalScope *Scope);
434 /// \brief A helper function to construct a RangeSpanList for a given
436 void addScopeRangeList(DwarfCompileUnit &TheCU, DIE *ScopeDIE,
437 const SmallVectorImpl<InsnRange> &Range);
439 /// \brief Construct new DW_TAG_lexical_block for this scope and
440 /// attach DW_AT_low_pc/DW_AT_high_pc labels.
441 DIE *constructLexicalScopeDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope);
443 /// \brief This scope represents inlined body of a function. Construct
444 /// DIE to represent this concrete inlined copy of the function.
445 DIE *constructInlinedScopeDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope);
447 /// \brief Construct a DIE for this scope.
448 DIE *constructScopeDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope);
449 /// A helper function to create children of a Scope DIE.
450 DIE *createScopeChildrenDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope,
451 SmallVectorImpl<DIE *> &Children);
453 /// \brief Emit initial Dwarf sections with a label at the start of each one.
454 void emitSectionLabels();
456 /// \brief Compute the size and offset of a DIE given an incoming Offset.
457 unsigned computeSizeAndOffset(DIE *Die, unsigned Offset);
459 /// \brief Compute the size and offset of all the DIEs.
460 void computeSizeAndOffsets();
462 /// \brief Attach DW_AT_inline attribute with inlined subprogram DIEs.
463 void computeInlinedDIEs();
465 /// \brief Collect info for variables that were optimized out.
466 void collectDeadVariables();
468 /// \brief Finish off debug information after all functions have been
470 void finalizeModuleInfo();
472 /// \brief Emit labels to close any remaining sections that have been left
476 /// \brief Emit the debug info section.
477 void emitDebugInfo();
479 /// \brief Emit the abbreviation section.
480 void emitAbbreviations();
482 /// \brief Emit the last address of the section and the end of
484 void emitEndOfLineMatrix(unsigned SectionEnd);
486 /// \brief Emit visible names into a hashed accelerator table section.
487 void emitAccelNames();
489 /// \brief Emit objective C classes and categories into a hashed
490 /// accelerator table section.
491 void emitAccelObjC();
493 /// \brief Emit namespace dies into a hashed accelerator table.
494 void emitAccelNamespaces();
496 /// \brief Emit type dies into a hashed accelerator table.
497 void emitAccelTypes();
499 /// \brief Emit visible names into a debug pubnames section.
500 /// \param GnuStyle determines whether or not we want to emit
501 /// additional information into the table ala newer gcc for gdb
503 void emitDebugPubNames(bool GnuStyle = false);
505 /// \brief Emit visible types into a debug pubtypes section.
506 /// \param GnuStyle determines whether or not we want to emit
507 /// additional information into the table ala newer gcc for gdb
509 void emitDebugPubTypes(bool GnuStyle = false);
512 emitDebugPubSection(bool GnuStyle, const MCSection *PSec, StringRef Name,
513 const StringMap<const DIE *> &(DwarfUnit::*Accessor)()
516 /// \brief Emit visible names into a debug str section.
519 /// \brief Emit visible names into a debug loc section.
522 /// \brief Emit visible names into a debug loc dwo section.
523 void emitDebugLocDWO();
525 /// \brief Emit visible names into a debug aranges section.
526 void emitDebugARanges();
528 /// \brief Emit visible names into a debug ranges section.
529 void emitDebugRanges();
531 /// \brief Emit inline info using custom format.
532 void emitDebugInlineInfo();
534 /// DWARF 5 Experimental Split Dwarf Emitters
536 /// \brief Initialize common features of skeleton units.
537 void initSkeletonUnit(const DwarfUnit &U, DIE *Die,
538 std::unique_ptr<DwarfUnit> NewU);
540 /// \brief Construct the split debug info compile unit for the debug info
542 DwarfCompileUnit &constructSkeletonCU(const DwarfCompileUnit &CU);
544 /// \brief Construct the split debug info compile unit for the debug info
546 DwarfTypeUnit &constructSkeletonTU(DwarfTypeUnit &TU);
548 /// \brief Emit the debug info dwo section.
549 void emitDebugInfoDWO();
551 /// \brief Emit the debug abbrev dwo section.
552 void emitDebugAbbrevDWO();
554 /// \brief Emit the debug line dwo section.
555 void emitDebugLineDWO();
557 /// \brief Emit the debug str dwo section.
558 void emitDebugStrDWO();
560 /// Flags to let the linker know we have emitted new style pubnames. Only
561 /// emit it here if we don't have a skeleton CU for split dwarf.
562 void addGnuPubAttributes(DwarfUnit &U, DIE *D) const;
564 /// \brief Create new DwarfCompileUnit for the given metadata node with tag
565 /// DW_TAG_compile_unit.
566 DwarfCompileUnit &constructDwarfCompileUnit(DICompileUnit DIUnit);
568 /// \brief Construct subprogram DIE.
569 void constructSubprogramDIE(DwarfCompileUnit &TheCU, const MDNode *N);
571 /// \brief Construct imported_module or imported_declaration DIE.
572 void constructImportedEntityDIE(DwarfCompileUnit &TheCU, const MDNode *N);
574 /// \brief Construct import_module DIE.
575 void constructImportedEntityDIE(DwarfCompileUnit &TheCU, const MDNode *N,
578 /// \brief Construct import_module DIE.
579 void constructImportedEntityDIE(DwarfCompileUnit &TheCU,
580 const DIImportedEntity &Module, DIE *Context);
582 /// \brief Register a source line with debug info. Returns the unique
583 /// label that was emitted and which provides correspondence to the
584 /// source line list.
585 void recordSourceLine(unsigned Line, unsigned Col, const MDNode *Scope,
588 /// \brief Indentify instructions that are marking the beginning of or
589 /// ending of a scope.
590 void identifyScopeMarkers();
592 /// \brief If Var is an current function argument that add it in
593 /// CurrentFnArguments list.
594 bool addCurrentFnArgument(DbgVariable *Var, LexicalScope *Scope);
596 /// \brief Populate LexicalScope entries with variables' info.
597 void collectVariableInfo(SmallPtrSet<const MDNode *, 16> &ProcessedVars);
599 /// \brief Collect variable information from the side table maintained
601 void collectVariableInfoFromMMITable(SmallPtrSet<const MDNode *, 16> &P);
603 /// \brief Ensure that a label will be emitted before MI.
604 void requestLabelBeforeInsn(const MachineInstr *MI) {
605 LabelsBeforeInsn.insert(std::make_pair(MI, (MCSymbol *)0));
608 /// \brief Return Label preceding the instruction.
609 MCSymbol *getLabelBeforeInsn(const MachineInstr *MI);
611 /// \brief Ensure that a label will be emitted after MI.
612 void requestLabelAfterInsn(const MachineInstr *MI) {
613 LabelsAfterInsn.insert(std::make_pair(MI, (MCSymbol *)0));
616 /// \brief Return Label immediately following the instruction.
617 MCSymbol *getLabelAfterInsn(const MachineInstr *MI);
619 void attachLowHighPC(DwarfCompileUnit &Unit, DIE *D, MCSymbol *Begin,
623 //===--------------------------------------------------------------------===//
624 // Main entry points.
626 DwarfDebug(AsmPrinter *A, Module *M);
628 void insertDIE(const MDNode *TypeMD, DIE *Die) {
629 MDTypeNodeToDieMap.insert(std::make_pair(TypeMD, Die));
631 DIE *getDIE(const MDNode *TypeMD) {
632 return MDTypeNodeToDieMap.lookup(TypeMD);
635 /// \brief Emit all Dwarf sections that should come prior to the
639 /// \brief Emit all Dwarf sections that should come after the content.
640 void endModule() override;
642 /// \brief Gather pre-function debug information.
643 void beginFunction(const MachineFunction *MF) override;
645 /// \brief Gather and emit post-function debug information.
646 void endFunction(const MachineFunction *MF) override;
648 /// \brief Process beginning of an instruction.
649 void beginInstruction(const MachineInstr *MI) override;
651 /// \brief Process end of an instruction.
652 void endInstruction() override;
654 /// \brief Add a DIE to the set of types that we're going to pull into
656 void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier,
657 DIE *Die, DICompositeType CTy);
659 /// \brief Add a label so that arange data can be generated for it.
660 void addArangeLabel(SymbolCU SCU) { ArangeLabels.push_back(SCU); }
662 /// \brief For symbols that have a size designated (e.g. common symbols),
663 /// this tracks that size.
664 void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override {
668 /// \brief Recursively Emits a debug information entry.
669 void emitDIE(DIE &Die);
671 // Experimental DWARF5 features.
673 /// \brief Returns whether or not to emit tables that dwarf consumers can
674 /// use to accelerate lookup.
675 bool useDwarfAccelTables() const { return HasDwarfAccelTables; }
677 /// \brief Returns whether or not to change the current debug info for the
678 /// split dwarf proposal support.
679 bool useSplitDwarf() const { return HasSplitDwarf; }
681 /// Returns the Dwarf Version.
682 unsigned getDwarfVersion() const { return DwarfVersion; }
684 /// Returns the section symbol for the .debug_loc section.
685 MCSymbol *getDebugLocSym() const { return DwarfDebugLocSectionSym; }
687 /// Returns the previous section that was emitted into.
688 const MCSection *getPrevSection() const { return PrevSection; }
690 /// Returns the previous CU that was being updated
691 const DwarfCompileUnit *getPrevCU() const { return PrevCU; }
693 /// Returns the entries for the .debug_loc section.
694 const SmallVectorImpl<DebugLocList> &
695 getDebugLocEntries() const {
696 return DotDebugLocEntries;
699 /// \brief Emit an entry for the debug loc section. This can be used to
700 /// handle an entry that's going to be emitted into the debug loc section.
701 void emitDebugLocEntry(ByteStreamer &Streamer, const DebugLocEntry &Entry);
703 /// Emit the location for a debug loc entry, including the size header.
704 void emitDebugLocEntryLocation(const DebugLocEntry &Entry);
706 /// Find the MDNode for the given reference.
707 template <typename T> T resolve(DIRef<T> Ref) const {
708 return Ref.resolve(TypeIdentifierMap);
711 /// \brief Return the TypeIdentifierMap.
712 const DITypeIdentifierMap &getTypeIdentifierMap() const {
713 return TypeIdentifierMap;
716 /// Find the DwarfCompileUnit for the given CU Die.
717 DwarfCompileUnit *lookupUnit(const DIE *CU) const {
718 return CUDieMap.lookup(CU);
720 /// isSubprogramContext - Return true if Context is either a subprogram
721 /// or another context nested inside a subprogram.
722 bool isSubprogramContext(const MDNode *Context);
724 } // End of namespace llvm