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__
18 #include "llvm/ADT/DenseMap.h"
19 #include "llvm/ADT/FoldingSet.h"
20 #include "llvm/ADT/SetVector.h"
21 #include "llvm/ADT/SmallPtrSet.h"
22 #include "llvm/ADT/StringMap.h"
23 #include "llvm/CodeGen/AsmPrinter.h"
24 #include "llvm/CodeGen/LexicalScopes.h"
25 #include "llvm/DebugInfo.h"
26 #include "llvm/MC/MachineLocation.h"
27 #include "llvm/Support/Allocator.h"
28 #include "llvm/Support/DebugLoc.h"
36 class MachineFrameInfo;
37 class MachineModuleInfo;
40 class MCObjectFileInfo;
46 //===----------------------------------------------------------------------===//
47 /// \brief This class is used to record source line correspondence.
49 unsigned Line; // Source line number.
50 unsigned Column; // Source column.
51 unsigned SourceID; // Source ID number.
52 MCSymbol *Label; // Label in code ID number.
54 SrcLineInfo(unsigned L, unsigned C, unsigned S, MCSymbol *label)
55 : Line(L), Column(C), SourceID(S), Label(label) {}
58 unsigned getLine() const { return Line; }
59 unsigned getColumn() const { return Column; }
60 unsigned getSourceID() const { return SourceID; }
61 MCSymbol *getLabel() const { return Label; }
64 /// \brief This struct describes location entries emitted in the .debug_loc
66 class DotDebugLocEntry {
67 // Begin and end symbols for the address range that this location is valid.
68 const MCSymbol *Begin;
71 // Type of entry that this represents.
78 enum EntryType EntryKind;
82 const ConstantFP *CFP;
83 const ConstantInt *CIP;
86 // The location in the machine frame.
89 // The variable to which this location entry corresponds.
90 const MDNode *Variable;
92 // Whether this location has been merged.
96 DotDebugLocEntry() : Begin(0), End(0), Variable(0), Merged(false) {
99 DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, MachineLocation &L,
101 : Begin(B), End(E), Loc(L), Variable(V), Merged(false) {
103 EntryKind = E_Location;
105 DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, int64_t i)
106 : Begin(B), End(E), Variable(0), Merged(false) {
108 EntryKind = E_Integer;
110 DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, const ConstantFP *FPtr)
111 : Begin(B), End(E), Variable(0), Merged(false) {
112 Constants.CFP = FPtr;
113 EntryKind = E_ConstantFP;
115 DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E,
116 const ConstantInt *IPtr)
117 : Begin(B), End(E), Variable(0), Merged(false) {
118 Constants.CIP = IPtr;
119 EntryKind = E_ConstantInt;
122 /// \brief Empty entries are also used as a trigger to emit temp label. Such
123 /// labels are referenced is used to find debug_loc offset for a given DIE.
124 bool isEmpty() { return Begin == 0 && End == 0; }
125 bool isMerged() { return Merged; }
126 void Merge(DotDebugLocEntry *Next) {
127 if (!(Begin && Loc == Next->Loc && End == Next->Begin))
132 bool isLocation() const { return EntryKind == E_Location; }
133 bool isInt() const { return EntryKind == E_Integer; }
134 bool isConstantFP() const { return EntryKind == E_ConstantFP; }
135 bool isConstantInt() const { return EntryKind == E_ConstantInt; }
136 int64_t getInt() const { return Constants.Int; }
137 const ConstantFP *getConstantFP() const { return Constants.CFP; }
138 const ConstantInt *getConstantInt() const { return Constants.CIP; }
139 const MDNode *getVariable() const { return Variable; }
140 const MCSymbol *getBeginSym() const { return Begin; }
141 const MCSymbol *getEndSym() const { return End; }
142 MachineLocation getLoc() const { return Loc; }
145 //===----------------------------------------------------------------------===//
146 /// \brief This class is used to track local variable information.
148 DIVariable Var; // Variable Descriptor.
149 DIE *TheDIE; // Variable DIE.
150 unsigned DotDebugLocOffset; // Offset in DotDebugLocEntries.
151 DbgVariable *AbsVar; // Corresponding Abstract variable, if any.
152 const MachineInstr *MInsn; // DBG_VALUE instruction of the variable.
156 // AbsVar may be NULL.
157 DbgVariable(DIVariable V, DbgVariable *AV, DwarfDebug *DD)
158 : Var(V), TheDIE(0), DotDebugLocOffset(~0U), AbsVar(AV), MInsn(0),
159 FrameIndex(~0), DD(DD) {}
162 DIVariable getVariable() const { return Var; }
163 void setDIE(DIE *D) { TheDIE = D; }
164 DIE *getDIE() const { return TheDIE; }
165 void setDotDebugLocOffset(unsigned O) { DotDebugLocOffset = O; }
166 unsigned getDotDebugLocOffset() const { return DotDebugLocOffset; }
167 StringRef getName() const { return Var.getName(); }
168 DbgVariable *getAbstractVariable() const { return AbsVar; }
169 const MachineInstr *getMInsn() const { return MInsn; }
170 void setMInsn(const MachineInstr *M) { MInsn = M; }
171 int getFrameIndex() const { return FrameIndex; }
172 void setFrameIndex(int FI) { FrameIndex = FI; }
173 // Translate tag to proper Dwarf tag.
174 uint16_t getTag() const {
175 if (Var.getTag() == dwarf::DW_TAG_arg_variable)
176 return dwarf::DW_TAG_formal_parameter;
178 return dwarf::DW_TAG_variable;
180 /// \brief Return true if DbgVariable is artificial.
181 bool isArtificial() const {
182 if (Var.isArtificial())
184 if (getType().isArtificial())
189 bool isObjectPointer() const {
190 if (Var.isObjectPointer())
192 if (getType().isObjectPointer())
197 bool variableHasComplexAddress() const {
198 assert(Var.isVariable() && "Invalid complex DbgVariable!");
199 return Var.hasComplexAddress();
201 bool isBlockByrefVariable() const {
202 assert(Var.isVariable() && "Invalid complex DbgVariable!");
203 return Var.isBlockByrefVariable();
205 unsigned getNumAddrElements() const {
206 assert(Var.isVariable() && "Invalid complex DbgVariable!");
207 return Var.getNumAddrElements();
209 uint64_t getAddrElement(unsigned i) const {
210 return Var.getAddrElement(i);
212 DIType getType() const;
215 /// resolve - Look in the DwarfDebug map for the MDNode that
216 /// corresponds to the reference.
217 template <typename T> T resolve(DIRef<T> Ref) const;
220 /// \brief Collects and handles information specific to a particular
221 /// collection of units.
223 // Target of Dwarf emission, used for sizing of abbreviations.
226 // Used to uniquely define abbreviations.
227 FoldingSet<DIEAbbrev> *AbbreviationsSet;
229 // A list of all the unique abbreviations in use.
230 std::vector<DIEAbbrev *> &Abbreviations;
232 // A pointer to all units in the section.
233 SmallVector<CompileUnit *, 1> CUs;
235 // Collection of strings for this unit and assorted symbols.
236 // A String->Symbol mapping of strings used by indirect
238 typedef StringMap<std::pair<MCSymbol*, unsigned>,
239 BumpPtrAllocator&> StrPool;
241 unsigned NextStringPoolNumber;
242 std::string StringPref;
244 // Collection of addresses for this unit and assorted labels.
245 // A Symbol->unsigned mapping of addresses used by indirect
247 typedef DenseMap<const MCExpr *, unsigned> AddrPool;
248 AddrPool AddressPool;
249 unsigned NextAddrPoolNumber;
252 DwarfUnits(AsmPrinter *AP, FoldingSet<DIEAbbrev> *AS,
253 std::vector<DIEAbbrev *> &A, const char *Pref,
254 BumpPtrAllocator &DA)
255 : Asm(AP), AbbreviationsSet(AS), Abbreviations(A), StringPool(DA),
256 NextStringPoolNumber(0), StringPref(Pref), AddressPool(),
257 NextAddrPoolNumber(0) {}
259 /// \brief Compute the size and offset of a DIE given an incoming Offset.
260 unsigned computeSizeAndOffset(DIE *Die, unsigned Offset);
262 /// \brief Compute the size and offset of all the DIEs.
263 void computeSizeAndOffsets();
265 /// \brief Define a unique number for the abbreviation.
266 void assignAbbrevNumber(DIEAbbrev &Abbrev);
268 /// \brief Add a unit to the list of CUs.
269 void addUnit(CompileUnit *CU) { CUs.push_back(CU); }
271 /// \brief Emit all of the units to the section listed with the given
272 /// abbreviation section.
273 void emitUnits(DwarfDebug *DD, const MCSection *USection,
274 const MCSection *ASection, const MCSymbol *ASectionSym);
276 /// \brief Emit all of the strings to the section given.
277 void emitStrings(const MCSection *StrSection, const MCSection *OffsetSection,
278 const MCSymbol *StrSecSym);
280 /// \brief Emit all of the addresses to the section given.
281 void emitAddresses(const MCSection *AddrSection);
283 /// \brief Returns the entry into the start of the pool.
284 MCSymbol *getStringPoolSym();
286 /// \brief Returns an entry into the string pool with the given
288 MCSymbol *getStringPoolEntry(StringRef Str);
290 /// \brief Returns the index into the string pool with the given
292 unsigned getStringPoolIndex(StringRef Str);
294 /// \brief Returns the string pool.
295 StrPool *getStringPool() { return &StringPool; }
297 /// \brief Returns the index into the address pool with the given
299 unsigned getAddrPoolIndex(const MCExpr *Sym);
300 unsigned getAddrPoolIndex(const MCSymbol *Sym);
302 /// \brief Returns the address pool.
303 AddrPool *getAddrPool() { return &AddressPool; }
306 /// \brief Helper used to pair up a symbol and its DWARF compile unit.
308 SymbolCU(CompileUnit *CU, const MCSymbol *Sym) : Sym(Sym), CU(CU) {}
313 /// \brief Collects and handles dwarf debug information.
315 // Target of Dwarf emission.
318 // Collected machine module information.
319 MachineModuleInfo *MMI;
321 // All DIEValues are allocated through this allocator.
322 BumpPtrAllocator DIEValueAllocator;
324 // Handle to the a compile unit used for the inline extension handling.
325 CompileUnit *FirstCU;
327 // Maps MDNode with its corresponding CompileUnit.
328 DenseMap <const MDNode *, CompileUnit *> CUMap;
330 // Maps subprogram MDNode with its corresponding CompileUnit.
331 DenseMap <const MDNode *, CompileUnit *> SPMap;
333 // Maps a CU DIE with its corresponding CompileUnit.
334 DenseMap <const DIE *, CompileUnit *> CUDieMap;
336 /// Maps MDNodes for type sysstem with the corresponding DIEs. These DIEs can
337 /// be shared across CUs, that is why we keep the map here instead
338 /// of in CompileUnit.
339 DenseMap<const MDNode *, DIE *> MDTypeNodeToDieMap;
341 // Used to uniquely define abbreviations.
342 FoldingSet<DIEAbbrev> AbbreviationsSet;
344 // A list of all the unique abbreviations in use.
345 std::vector<DIEAbbrev *> Abbreviations;
347 // Stores the current file ID for a given compile unit.
348 DenseMap <unsigned, unsigned> FileIDCUMap;
349 // Source id map, i.e. CUID, source filename and directory,
350 // separated by a zero byte, mapped to a unique id.
351 StringMap<unsigned, BumpPtrAllocator&> SourceIdMap;
353 // List of all labels used in aranges generation.
354 std::vector<SymbolCU> ArangeLabels;
356 // Size of each symbol emitted (for those symbols that have a specific size).
357 DenseMap <const MCSymbol *, uint64_t> SymSize;
359 // Provides a unique id per text section.
360 typedef DenseMap<const MCSection *, SmallVector<SymbolCU, 8> > SectionMapType;
361 SectionMapType SectionMap;
363 // List of arguments for current function.
364 SmallVector<DbgVariable *, 8> CurrentFnArguments;
366 LexicalScopes LScopes;
368 // Collection of abstract subprogram DIEs.
369 DenseMap<const MDNode *, DIE *> AbstractSPDies;
371 // Collection of dbg variables of a scope.
372 typedef DenseMap<LexicalScope *,
373 SmallVector<DbgVariable *, 8> > ScopeVariablesMap;
374 ScopeVariablesMap ScopeVariables;
376 // Collection of abstract variables.
377 DenseMap<const MDNode *, DbgVariable *> AbstractVariables;
379 // Collection of DotDebugLocEntry.
380 SmallVector<DotDebugLocEntry, 4> DotDebugLocEntries;
382 // Collection of subprogram DIEs that are marked (at the end of the module)
384 SmallPtrSet<DIE *, 4> InlinedSubprogramDIEs;
386 // This is a collection of subprogram MDNodes that are processed to
388 SmallPtrSet<const MDNode *, 16> ProcessedSPNodes;
390 // Maps instruction with label emitted before instruction.
391 DenseMap<const MachineInstr *, MCSymbol *> LabelsBeforeInsn;
393 // Maps instruction with label emitted after instruction.
394 DenseMap<const MachineInstr *, MCSymbol *> LabelsAfterInsn;
396 // Every user variable mentioned by a DBG_VALUE instruction in order of
398 SmallVector<const MDNode*, 8> UserVariables;
400 // For each user variable, keep a list of DBG_VALUE instructions in order.
401 // The list can also contain normal instructions that clobber the previous
403 typedef DenseMap<const MDNode*, SmallVector<const MachineInstr*, 4> >
405 DbgValueHistoryMap DbgValues;
407 SmallVector<const MCSymbol *, 8> DebugRangeSymbols;
409 // Previous instruction's location information. This is used to determine
410 // label location to indicate scope boundries in dwarf debug info.
411 DebugLoc PrevInstLoc;
414 // This location indicates end of function prologue and beginning of function
416 DebugLoc PrologEndLoc;
418 // Section Symbols: these are assembler temporary labels that are emitted at
419 // the beginning of each supported dwarf section. These are used to form
420 // section offsets and are created by EmitSectionLabels.
421 MCSymbol *DwarfInfoSectionSym, *DwarfAbbrevSectionSym;
422 MCSymbol *DwarfStrSectionSym, *TextSectionSym, *DwarfDebugRangeSectionSym;
423 MCSymbol *DwarfDebugLocSectionSym, *DwarfLineSectionSym, *DwarfAddrSectionSym;
424 MCSymbol *FunctionBeginSym, *FunctionEndSym;
425 MCSymbol *DwarfAbbrevDWOSectionSym, *DwarfStrDWOSectionSym;
426 MCSymbol *DwarfGnuPubNamesSectionSym, *DwarfGnuPubTypesSectionSym;
428 // As an optimization, there is no need to emit an entry in the directory
429 // table for the same directory as DW_AT_comp_dir.
430 StringRef CompilationDir;
432 // Counter for assigning globally unique IDs for CUs.
433 unsigned GlobalCUIndexCount;
435 // Holder for the file specific debug information.
436 DwarfUnits InfoHolder;
438 // Holders for the various debug information flags that we might need to
439 // have exposed. See accessor functions below for description.
441 // Holder for imported entities.
442 typedef SmallVector<std::pair<const MDNode *, const MDNode *>, 32>
444 ImportedEntityMap ScopesWithImportedEntities;
446 // Holder for types that are going to be extracted out into a type unit.
447 DenseMap<const MDNode *, std::pair<uint64_t, SmallVectorImpl<DIE*>* > > TypeUnits;
449 // Whether to emit the pubnames/pubtypes sections.
450 bool HasDwarfPubSections;
452 // Version of dwarf we're emitting.
453 unsigned DwarfVersion;
455 // DWARF5 Experimental Options
456 bool HasDwarfAccelTables;
459 // Separated Dwarf Variables
460 // In general these will all be for bits that are left in the
461 // original object file, rather than things that are meant
462 // to be in the .dwo sections.
464 // The CUs left in the original object file for separated debug info.
465 SmallVector<CompileUnit *, 1> SkeletonCUs;
467 // Used to uniquely define abbreviations for the skeleton emission.
468 FoldingSet<DIEAbbrev> SkeletonAbbrevSet;
470 // A list of all the unique abbreviations in use.
471 std::vector<DIEAbbrev *> SkeletonAbbrevs;
473 // Holder for the skeleton information.
474 DwarfUnits SkeletonHolder;
476 // Maps from a type identifier to the actual MDNode.
477 DITypeIdentifierMap TypeIdentifierMap;
481 void addScopeVariable(LexicalScope *LS, DbgVariable *Var);
483 /// \brief Find abstract variable associated with Var.
484 DbgVariable *findAbstractVariable(DIVariable &Var, DebugLoc Loc);
486 /// \brief Find DIE for the given subprogram and attach appropriate
487 /// DW_AT_low_pc and DW_AT_high_pc attributes. If there are global
488 /// variables in this scope then create and insert DIEs for these
490 DIE *updateSubprogramScopeDIE(CompileUnit *SPCU, DISubprogram SP);
492 /// \brief Construct new DW_TAG_lexical_block for this scope and
493 /// attach DW_AT_low_pc/DW_AT_high_pc labels.
494 DIE *constructLexicalScopeDIE(CompileUnit *TheCU, LexicalScope *Scope);
495 /// A helper function to check whether the DIE for a given Scope is going
497 bool isLexicalScopeDIENull(LexicalScope *Scope);
499 /// \brief This scope represents inlined body of a function. Construct
500 /// DIE to represent this concrete inlined copy of the function.
501 DIE *constructInlinedScopeDIE(CompileUnit *TheCU, LexicalScope *Scope);
503 /// \brief Construct a DIE for this scope.
504 DIE *constructScopeDIE(CompileUnit *TheCU, LexicalScope *Scope);
505 /// A helper function to create children of a Scope DIE.
506 DIE *createScopeChildrenDIE(CompileUnit *TheCU, LexicalScope *Scope,
507 SmallVectorImpl<DIE*> &Children);
509 /// \brief Emit initial Dwarf sections with a label at the start of each one.
510 void emitSectionLabels();
512 /// \brief Compute the size and offset of a DIE given an incoming Offset.
513 unsigned computeSizeAndOffset(DIE *Die, unsigned Offset);
515 /// \brief Compute the size and offset of all the DIEs.
516 void computeSizeAndOffsets();
518 /// \brief Attach DW_AT_inline attribute with inlined subprogram DIEs.
519 void computeInlinedDIEs();
521 /// \brief Collect info for variables that were optimized out.
522 void collectDeadVariables();
524 /// \brief Finish off debug information after all functions have been
526 void finalizeModuleInfo();
528 /// \brief Emit labels to close any remaining sections that have been left
532 /// \brief Emit a set of abbreviations to the specific section.
533 void emitAbbrevs(const MCSection *, std::vector<DIEAbbrev*> *);
535 /// \brief Emit the debug info section.
536 void emitDebugInfo();
538 /// \brief Emit the abbreviation section.
539 void emitAbbreviations();
541 /// \brief Emit the last address of the section and the end of
543 void emitEndOfLineMatrix(unsigned SectionEnd);
545 /// \brief Emit visible names into a hashed accelerator table section.
546 void emitAccelNames();
548 /// \brief Emit objective C classes and categories into a hashed
549 /// accelerator table section.
550 void emitAccelObjC();
552 /// \brief Emit namespace dies into a hashed accelerator table.
553 void emitAccelNamespaces();
555 /// \brief Emit type dies into a hashed accelerator table.
556 void emitAccelTypes();
558 /// \brief Emit visible names into a debug pubnames section.
559 /// \param GnuStyle determines whether or not we want to emit
560 /// additional information into the table ala newer gcc for gdb
562 void emitDebugPubNames(bool GnuStyle = false);
564 /// \brief Emit visible types into a debug pubtypes section.
565 /// \param GnuStyle determines whether or not we want to emit
566 /// additional information into the table ala newer gcc for gdb
568 void emitDebugPubTypes(bool GnuStyle = false);
570 /// \brief Emit visible names into a debug str section.
573 /// \brief Emit visible names into a debug loc section.
576 /// \brief Emit visible names into a debug aranges section.
577 void emitDebugARanges();
579 /// \brief Emit visible names into a debug ranges section.
580 void emitDebugRanges();
582 /// \brief Emit visible names into a debug macinfo section.
583 void emitDebugMacInfo();
585 /// \brief Emit inline info using custom format.
586 void emitDebugInlineInfo();
588 /// DWARF 5 Experimental Split Dwarf Emitters
590 /// \brief Construct the split debug info compile unit for the debug info
592 CompileUnit *constructSkeletonCU(const CompileUnit *CU);
594 /// \brief Emit the local split abbreviations.
595 void emitSkeletonAbbrevs(const MCSection *);
597 /// \brief Emit the debug info dwo section.
598 void emitDebugInfoDWO();
600 /// \brief Emit the debug abbrev dwo section.
601 void emitDebugAbbrevDWO();
603 /// \brief Emit the debug str dwo section.
604 void emitDebugStrDWO();
606 /// \brief Create new CompileUnit for the given metadata node with tag
607 /// DW_TAG_compile_unit.
608 CompileUnit *constructCompileUnit(DICompileUnit DIUnit);
610 /// \brief Construct subprogram DIE.
611 void constructSubprogramDIE(CompileUnit *TheCU, const MDNode *N);
613 /// \brief Construct imported_module or imported_declaration DIE.
614 void constructImportedEntityDIE(CompileUnit *TheCU, const MDNode *N);
616 /// \brief Construct import_module DIE.
617 void constructImportedEntityDIE(CompileUnit *TheCU, const MDNode *N,
620 /// \brief Construct import_module DIE.
621 void constructImportedEntityDIE(CompileUnit *TheCU,
622 const DIImportedEntity &Module,
625 /// \brief Register a source line with debug info. Returns the unique
626 /// label that was emitted and which provides correspondence to the
627 /// source line list.
628 void recordSourceLine(unsigned Line, unsigned Col, const MDNode *Scope,
631 /// \brief Indentify instructions that are marking the beginning of or
632 /// ending of a scope.
633 void identifyScopeMarkers();
635 /// \brief If Var is an current function argument that add it in
636 /// CurrentFnArguments list.
637 bool addCurrentFnArgument(const MachineFunction *MF,
638 DbgVariable *Var, LexicalScope *Scope);
640 /// \brief Populate LexicalScope entries with variables' info.
641 void collectVariableInfo(const MachineFunction *,
642 SmallPtrSet<const MDNode *, 16> &ProcessedVars);
644 /// \brief Collect variable information from the side table maintained
646 void collectVariableInfoFromMMITable(const MachineFunction * MF,
647 SmallPtrSet<const MDNode *, 16> &P);
649 /// \brief Ensure that a label will be emitted before MI.
650 void requestLabelBeforeInsn(const MachineInstr *MI) {
651 LabelsBeforeInsn.insert(std::make_pair(MI, (MCSymbol*)0));
654 /// \brief Return Label preceding the instruction.
655 MCSymbol *getLabelBeforeInsn(const MachineInstr *MI);
657 /// \brief Ensure that a label will be emitted after MI.
658 void requestLabelAfterInsn(const MachineInstr *MI) {
659 LabelsAfterInsn.insert(std::make_pair(MI, (MCSymbol*)0));
662 /// \brief Return Label immediately following the instruction.
663 MCSymbol *getLabelAfterInsn(const MachineInstr *MI);
666 //===--------------------------------------------------------------------===//
667 // Main entry points.
669 DwarfDebug(AsmPrinter *A, Module *M);
671 void insertDIE(const MDNode *TypeMD, DIE *Die) {
672 MDTypeNodeToDieMap.insert(std::make_pair(TypeMD, Die));
674 DIE *getDIE(const MDNode *TypeMD) {
675 return MDTypeNodeToDieMap.lookup(TypeMD);
678 /// \brief Emit all Dwarf sections that should come prior to the
682 /// \brief Emit all Dwarf sections that should come after the content.
685 /// \brief Gather pre-function debug information.
686 void beginFunction(const MachineFunction *MF);
688 /// \brief Gather and emit post-function debug information.
689 void endFunction(const MachineFunction *MF);
691 /// \brief Process beginning of an instruction.
692 void beginInstruction(const MachineInstr *MI);
694 /// \brief Process end of an instruction.
695 void endInstruction(const MachineInstr *MI);
697 /// \brief Add a DIE to the set of types that we're going to pull into
699 void addTypeUnitType(DIE *Die, DICompositeType CTy);
701 /// \brief Add a label so that arange data can be generated for it.
702 void addArangeLabel(SymbolCU SCU) { ArangeLabels.push_back(SCU); }
704 /// \brief For symbols that have a size designated (e.g. common symbols),
705 /// this tracks that size.
706 void setSymbolSize(const MCSymbol *Sym, uint64_t Size) { SymSize[Sym] = Size;}
708 /// \brief Look up the source id with the given directory and source file
709 /// names. If none currently exists, create a new id and insert it in the
711 unsigned getOrCreateSourceID(StringRef DirName, StringRef FullName,
714 /// \brief Recursively Emits a debug information entry.
715 void emitDIE(DIE *Die, ArrayRef<DIEAbbrev *> Abbrevs);
717 // Experimental DWARF5 features.
719 /// \brief Returns whether or not to emit tables that dwarf consumers can
720 /// use to accelerate lookup.
721 bool useDwarfAccelTables() { return HasDwarfAccelTables; }
723 /// \brief Returns whether or not to change the current debug info for the
724 /// split dwarf proposal support.
725 bool useSplitDwarf() { return HasSplitDwarf; }
727 /// Returns the Dwarf Version.
728 unsigned getDwarfVersion() const { return DwarfVersion; }
730 /// Find the MDNode for the given reference.
731 template <typename T> T resolve(DIRef<T> Ref) const {
732 return Ref.resolve(TypeIdentifierMap);
735 /// isSubprogramContext - Return true if Context is either a subprogram
736 /// or another context nested inside a subprogram.
737 bool isSubprogramContext(const MDNode *Context);
740 } // End of namespace llvm