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 LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H
15 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H
17 #include "DwarfFile.h"
18 #include "AsmPrinterHandler.h"
20 #include "DbgValueHistoryCalculator.h"
21 #include "DebugLocEntry.h"
22 #include "DebugLocList.h"
23 #include "DwarfAccelTable.h"
24 #include "llvm/ADT/DenseMap.h"
25 #include "llvm/ADT/MapVector.h"
26 #include "llvm/ADT/SmallPtrSet.h"
27 #include "llvm/ADT/StringMap.h"
28 #include "llvm/ADT/FoldingSet.h"
29 #include "llvm/CodeGen/LexicalScopes.h"
30 #include "llvm/CodeGen/MachineInstr.h"
31 #include "llvm/IR/DebugInfo.h"
32 #include "llvm/IR/DebugLoc.h"
33 #include "llvm/MC/MachineLocation.h"
34 #include "llvm/MC/MCDwarf.h"
35 #include "llvm/Support/Allocator.h"
45 class DwarfCompileUnit;
49 class MachineModuleInfo;
51 //===----------------------------------------------------------------------===//
52 /// \brief This class is used to record source line correspondence.
54 unsigned Line; // Source line number.
55 unsigned Column; // Source column.
56 unsigned SourceID; // Source ID number.
57 MCSymbol *Label; // Label in code ID number.
59 SrcLineInfo(unsigned L, unsigned C, unsigned S, MCSymbol *label)
60 : Line(L), Column(C), SourceID(S), Label(label) {}
63 unsigned getLine() const { return Line; }
64 unsigned getColumn() const { return Column; }
65 unsigned getSourceID() const { return SourceID; }
66 MCSymbol *getLabel() const { return Label; }
69 //===----------------------------------------------------------------------===//
70 /// \brief This class is used to track local variable information.
72 DIVariable Var; // Variable Descriptor.
73 DIExpression Expr; // Complex address location expression.
74 DIE *TheDIE; // Variable DIE.
75 unsigned DotDebugLocOffset; // Offset in DotDebugLocEntries.
76 const MachineInstr *MInsn; // DBG_VALUE instruction of the variable.
81 /// Construct a DbgVariable from a DIVariable.
82 DbgVariable(DIVariable V, DIExpression E, DwarfDebug *DD)
83 : Var(V), Expr(E), TheDIE(nullptr), DotDebugLocOffset(~0U),
84 MInsn(nullptr), FrameIndex(~0), DD(DD) {
85 assert(Var.Verify() && Expr.Verify());
88 /// Construct a DbgVariable from a DEBUG_VALUE.
89 /// AbstractVar may be NULL.
90 DbgVariable(const MachineInstr *DbgValue, DwarfDebug *DD)
91 : Var(DbgValue->getDebugVariable()), Expr(DbgValue->getDebugExpression()),
92 TheDIE(nullptr), DotDebugLocOffset(~0U), MInsn(DbgValue),
93 FrameIndex(~0), DD(DD) {}
96 DIVariable getVariable() const { return Var; }
97 DIExpression getExpression() const { return Expr; }
98 void setDIE(DIE &D) { TheDIE = &D; }
99 DIE *getDIE() const { return TheDIE; }
100 void setDotDebugLocOffset(unsigned O) { DotDebugLocOffset = O; }
101 unsigned getDotDebugLocOffset() const { return DotDebugLocOffset; }
102 StringRef getName() const { return Var.getName(); }
103 const MachineInstr *getMInsn() const { return MInsn; }
104 int getFrameIndex() const { return FrameIndex; }
105 void setFrameIndex(int FI) { FrameIndex = FI; }
106 // Translate tag to proper Dwarf tag.
107 dwarf::Tag getTag() const {
108 if (Var.getTag() == dwarf::DW_TAG_arg_variable)
109 return dwarf::DW_TAG_formal_parameter;
111 return dwarf::DW_TAG_variable;
113 /// \brief Return true if DbgVariable is artificial.
114 bool isArtificial() const {
115 if (Var.isArtificial())
117 if (getType().isArtificial())
122 bool isObjectPointer() const {
123 if (Var.isObjectPointer())
125 if (getType().isObjectPointer())
130 bool variableHasComplexAddress() const {
131 assert(Var.isVariable() && "Invalid complex DbgVariable!");
132 return Expr.getNumElements() > 0;
134 bool isBlockByrefVariable() const;
135 unsigned getNumAddrElements() const {
136 assert(Var.isVariable() && "Invalid complex DbgVariable!");
137 return Expr.getNumElements();
139 uint64_t getAddrElement(unsigned i) const { return Expr.getElement(i); }
140 DIType getType() const;
143 /// resolve - Look in the DwarfDebug map for the MDNode that
144 /// corresponds to the reference.
145 template <typename T> T resolve(DIRef<T> Ref) const;
149 /// \brief Helper used to pair up a symbol and its DWARF compile unit.
151 SymbolCU(DwarfCompileUnit *CU, const MCSymbol *Sym) : Sym(Sym), CU(CU) {}
153 DwarfCompileUnit *CU;
156 /// \brief Collects and handles dwarf debug information.
157 class DwarfDebug : public AsmPrinterHandler {
158 // Target of Dwarf emission.
161 // Collected machine module information.
162 MachineModuleInfo *MMI;
164 // All DIEValues are allocated through this allocator.
165 BumpPtrAllocator DIEValueAllocator;
167 // Handle to the compile unit used for the inline extension handling,
168 // this is just so that the DIEValue allocator has a place to store
169 // the particular elements.
170 // FIXME: Store these off of DwarfDebug instead?
171 DwarfCompileUnit *FirstCU;
173 // Maps MDNode with its corresponding DwarfCompileUnit.
174 MapVector<const MDNode *, DwarfCompileUnit *> CUMap;
176 // Maps subprogram MDNode with its corresponding DwarfCompileUnit.
177 DenseMap<const MDNode *, DwarfCompileUnit *> SPMap;
179 // Maps a CU DIE with its corresponding DwarfCompileUnit.
180 DenseMap<const DIE *, DwarfCompileUnit *> CUDieMap;
182 /// Maps MDNodes for type system with the corresponding DIEs. These DIEs can
183 /// be shared across CUs, that is why we keep the map here instead
184 /// of in DwarfCompileUnit.
185 DenseMap<const MDNode *, DIE *> MDTypeNodeToDieMap;
187 // List of all labels used in aranges generation.
188 std::vector<SymbolCU> ArangeLabels;
190 // Size of each symbol emitted (for those symbols that have a specific size).
191 DenseMap<const MCSymbol *, uint64_t> SymSize;
193 // Provides a unique id per text section.
194 typedef DenseMap<const MCSection *, SmallVector<SymbolCU, 8> > SectionMapType;
195 SectionMapType SectionMap;
197 // List of arguments for current function.
198 SmallVector<DbgVariable *, 8> CurrentFnArguments;
200 LexicalScopes LScopes;
202 // Collection of abstract subprogram DIEs.
203 DenseMap<const MDNode *, DIE *> AbstractSPDies;
205 // Collection of dbg variables of a scope.
206 typedef DenseMap<LexicalScope *, SmallVector<DbgVariable *, 8> >
208 ScopeVariablesMap ScopeVariables;
210 // Collection of abstract variables.
211 DenseMap<const MDNode *, std::unique_ptr<DbgVariable>> AbstractVariables;
212 SmallVector<std::unique_ptr<DbgVariable>, 64> ConcreteVariables;
214 // Collection of DebugLocEntry. Stored in a linked list so that DIELocLists
215 // can refer to them in spite of insertions into this list.
216 SmallVector<DebugLocList, 4> DotDebugLocEntries;
218 // This is a collection of subprogram MDNodes that are processed to
220 SmallPtrSet<const MDNode *, 16> ProcessedSPNodes;
222 // Maps instruction with label emitted before instruction.
223 DenseMap<const MachineInstr *, MCSymbol *> LabelsBeforeInsn;
225 // Maps instruction with label emitted after instruction.
226 DenseMap<const MachineInstr *, MCSymbol *> LabelsAfterInsn;
228 // History of DBG_VALUE and clobber instructions for each user variable.
229 // Variables are listed in order of appearance.
230 DbgValueHistoryMap DbgValues;
232 // Previous instruction's location information. This is used to determine
233 // label location to indicate scope boundries in dwarf debug info.
234 DebugLoc PrevInstLoc;
237 // This location indicates end of function prologue and beginning of function
239 DebugLoc PrologEndLoc;
241 // If nonnull, stores the current machine function we're processing.
242 const MachineFunction *CurFn;
244 // If nonnull, stores the current machine instruction we're processing.
245 const MachineInstr *CurMI;
247 // If nonnull, stores the CU in which the previous subprogram was contained.
248 const DwarfCompileUnit *PrevCU;
250 // Section Symbols: these are assembler temporary labels that are emitted at
251 // the beginning of each supported dwarf section. These are used to form
252 // section offsets and are created by EmitSectionLabels.
253 MCSymbol *DwarfInfoSectionSym, *DwarfAbbrevSectionSym;
254 MCSymbol *DwarfStrSectionSym, *TextSectionSym, *DwarfDebugRangeSectionSym;
255 MCSymbol *DwarfDebugLocSectionSym, *DwarfLineSectionSym, *DwarfAddrSectionSym;
256 MCSymbol *FunctionBeginSym, *FunctionEndSym;
257 MCSymbol *DwarfInfoDWOSectionSym, *DwarfAbbrevDWOSectionSym;
258 MCSymbol *DwarfTypesDWOSectionSym;
259 MCSymbol *DwarfStrDWOSectionSym;
260 MCSymbol *DwarfGnuPubNamesSectionSym, *DwarfGnuPubTypesSectionSym;
262 // As an optimization, there is no need to emit an entry in the directory
263 // table for the same directory as DW_AT_comp_dir.
264 StringRef CompilationDir;
266 // Counter for assigning globally unique IDs for ranges.
267 unsigned GlobalRangeCount;
269 // Holder for the file specific debug information.
270 DwarfFile InfoHolder;
272 // Holders for the various debug information flags that we might need to
273 // have exposed. See accessor functions below for description.
275 // Holder for imported entities.
276 typedef SmallVector<std::pair<const MDNode *, const MDNode *>, 32>
278 ImportedEntityMap ScopesWithImportedEntities;
280 // Map from MDNodes for user-defined types to the type units that describe
282 DenseMap<const MDNode *, const DwarfTypeUnit *> DwarfTypeUnits;
284 SmallVector<std::pair<std::unique_ptr<DwarfTypeUnit>, DICompositeType>, 1> TypeUnitsUnderConstruction;
286 // Whether to emit the pubnames/pubtypes sections.
287 bool HasDwarfPubSections;
289 // Whether or not to use AT_ranges for compilation units.
292 // Whether we emitted a function into a section other than the default
294 bool UsedNonDefaultText;
296 // Version of dwarf we're emitting.
297 unsigned DwarfVersion;
299 // Maps from a type identifier to the actual MDNode.
300 DITypeIdentifierMap TypeIdentifierMap;
302 // DWARF5 Experimental Options
303 bool HasDwarfAccelTables;
306 // Separated Dwarf Variables
307 // In general these will all be for bits that are left in the
308 // original object file, rather than things that are meant
309 // to be in the .dwo sections.
311 // Holder for the skeleton information.
312 DwarfFile SkeletonHolder;
314 /// Store file names for type units under fission in a line table header that
315 /// will be emitted into debug_line.dwo.
316 // FIXME: replace this with a map from comp_dir to table so that we can emit
317 // multiple tables during LTO each of which uses directory 0, referencing the
318 // comp_dir of all the type units that use it.
319 MCDwarfDwoLineTable SplitTypeUnitFileTable;
321 // True iff there are multiple CUs in this module.
325 AddressPool AddrPool;
327 DwarfAccelTable AccelNames;
328 DwarfAccelTable AccelObjC;
329 DwarfAccelTable AccelNamespace;
330 DwarfAccelTable AccelTypes;
332 DenseMap<const Function *, DISubprogram> FunctionDIs;
334 MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &);
336 void addScopeVariable(LexicalScope *LS, DbgVariable *Var);
338 const SmallVectorImpl<std::unique_ptr<DwarfUnit>> &getUnits() {
339 return InfoHolder.getUnits();
342 /// \brief Find abstract variable associated with Var.
343 DbgVariable *getExistingAbstractVariable(const DIVariable &DV,
344 DIVariable &Cleansed);
345 DbgVariable *getExistingAbstractVariable(const DIVariable &DV);
346 void createAbstractVariable(const DIVariable &DV, LexicalScope *Scope);
347 void ensureAbstractVariableIsCreated(const DIVariable &Var,
348 const MDNode *Scope);
349 void ensureAbstractVariableIsCreatedIfScoped(const DIVariable &Var,
350 const MDNode *Scope);
352 /// \brief A helper function to construct a RangeSpanList for a given
354 void addScopeRangeList(DwarfCompileUnit &TheCU, DIE &ScopeDIE,
355 const SmallVectorImpl<InsnRange> &Range);
357 DIE *createAndAddScopeChildren(DwarfCompileUnit &TheCU, LexicalScope *Scope,
359 /// \brief Construct a DIE for this abstract scope.
360 void constructAbstractSubprogramScopeDIE(DwarfCompileUnit &TheCU,
361 LexicalScope *Scope);
362 /// \brief Construct a DIE for this subprogram scope.
363 void constructSubprogramScopeDIE(DwarfCompileUnit &TheCU,
364 LexicalScope *Scope);
366 /// \brief Emit initial Dwarf sections with a label at the start of each one.
367 void emitSectionLabels();
369 /// \brief Compute the size and offset of a DIE given an incoming Offset.
370 unsigned computeSizeAndOffset(DIE *Die, unsigned Offset);
372 /// \brief Compute the size and offset of all the DIEs.
373 void computeSizeAndOffsets();
375 /// \brief Collect info for variables that were optimized out.
376 void collectDeadVariables();
378 void finishVariableDefinitions();
380 void finishSubprogramDefinitions();
382 /// \brief Finish off debug information after all functions have been
384 void finalizeModuleInfo();
386 /// \brief Emit labels to close any remaining sections that have been left
390 /// \brief Emit the debug info section.
391 void emitDebugInfo();
393 /// \brief Emit the abbreviation section.
394 void emitAbbreviations();
396 /// \brief Emit the last address of the section and the end of
398 void emitEndOfLineMatrix(unsigned SectionEnd);
400 /// \brief Emit a specified accelerator table.
401 void emitAccel(DwarfAccelTable &Accel, const MCSection *Section,
402 StringRef TableName, StringRef SymName);
404 /// \brief Emit visible names into a hashed accelerator table section.
405 void emitAccelNames();
407 /// \brief Emit objective C classes and categories into a hashed
408 /// accelerator table section.
409 void emitAccelObjC();
411 /// \brief Emit namespace dies into a hashed accelerator table.
412 void emitAccelNamespaces();
414 /// \brief Emit type dies into a hashed accelerator table.
415 void emitAccelTypes();
417 /// \brief Emit visible names into a debug pubnames section.
418 /// \param GnuStyle determines whether or not we want to emit
419 /// additional information into the table ala newer gcc for gdb
421 void emitDebugPubNames(bool GnuStyle = false);
423 /// \brief Emit visible types into a debug pubtypes section.
424 /// \param GnuStyle determines whether or not we want to emit
425 /// additional information into the table ala newer gcc for gdb
427 void emitDebugPubTypes(bool GnuStyle = false);
430 emitDebugPubSection(bool GnuStyle, const MCSection *PSec, StringRef Name,
431 const StringMap<const DIE *> &(DwarfUnit::*Accessor)()
434 /// \brief Emit visible names into a debug str section.
437 /// \brief Emit visible names into a debug loc section.
440 /// \brief Emit visible names into a debug loc dwo section.
441 void emitDebugLocDWO();
443 /// \brief Emit visible names into a debug aranges section.
444 void emitDebugARanges();
446 /// \brief Emit visible names into a debug ranges section.
447 void emitDebugRanges();
449 /// \brief Emit inline info using custom format.
450 void emitDebugInlineInfo();
452 /// DWARF 5 Experimental Split Dwarf Emitters
454 /// \brief Initialize common features of skeleton units.
455 void initSkeletonUnit(const DwarfUnit &U, DIE &Die,
456 std::unique_ptr<DwarfUnit> NewU);
458 /// \brief Construct the split debug info compile unit for the debug info
460 DwarfCompileUnit &constructSkeletonCU(const DwarfCompileUnit &CU);
462 /// \brief Construct the split debug info compile unit for the debug info
464 DwarfTypeUnit &constructSkeletonTU(DwarfTypeUnit &TU);
466 /// \brief Emit the debug info dwo section.
467 void emitDebugInfoDWO();
469 /// \brief Emit the debug abbrev dwo section.
470 void emitDebugAbbrevDWO();
472 /// \brief Emit the debug line dwo section.
473 void emitDebugLineDWO();
475 /// \brief Emit the debug str dwo section.
476 void emitDebugStrDWO();
478 /// Flags to let the linker know we have emitted new style pubnames. Only
479 /// emit it here if we don't have a skeleton CU for split dwarf.
480 void addGnuPubAttributes(DwarfUnit &U, DIE &D) const;
482 /// \brief Create new DwarfCompileUnit for the given metadata node with tag
483 /// DW_TAG_compile_unit.
484 DwarfCompileUnit &constructDwarfCompileUnit(DICompileUnit DIUnit);
486 /// \brief Construct imported_module or imported_declaration DIE.
487 void constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
490 /// \brief Register a source line with debug info. Returns the unique
491 /// label that was emitted and which provides correspondence to the
492 /// source line list.
493 void recordSourceLine(unsigned Line, unsigned Col, const MDNode *Scope,
496 /// \brief Indentify instructions that are marking the beginning of or
497 /// ending of a scope.
498 void identifyScopeMarkers();
500 /// \brief If Var is an current function argument that add it in
501 /// CurrentFnArguments list.
502 bool addCurrentFnArgument(DbgVariable *Var, LexicalScope *Scope);
504 /// \brief Populate LexicalScope entries with variables' info.
505 void collectVariableInfo(SmallPtrSetImpl<const MDNode *> &ProcessedVars);
507 /// \brief Build the location list for all DBG_VALUEs in the
508 /// function that describe the same variable.
509 void buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
510 const DbgValueHistoryMap::InstrRanges &Ranges);
512 /// \brief Collect variable information from the side table maintained
514 void collectVariableInfoFromMMITable(SmallPtrSetImpl<const MDNode *> &P);
516 /// \brief Ensure that a label will be emitted before MI.
517 void requestLabelBeforeInsn(const MachineInstr *MI) {
518 LabelsBeforeInsn.insert(std::make_pair(MI, nullptr));
521 /// \brief Return Label preceding the instruction.
522 MCSymbol *getLabelBeforeInsn(const MachineInstr *MI);
524 /// \brief Ensure that a label will be emitted after MI.
525 void requestLabelAfterInsn(const MachineInstr *MI) {
526 LabelsAfterInsn.insert(std::make_pair(MI, nullptr));
529 /// \brief Return Label immediately following the instruction.
530 MCSymbol *getLabelAfterInsn(const MachineInstr *MI);
532 void attachRangesOrLowHighPC(DwarfCompileUnit &Unit, DIE &D,
533 const SmallVectorImpl<InsnRange> &Ranges);
536 //===--------------------------------------------------------------------===//
537 // Main entry points.
539 DwarfDebug(AsmPrinter *A, Module *M);
541 ~DwarfDebug() override;
543 void insertDIE(const MDNode *TypeMD, DIE *Die) {
544 MDTypeNodeToDieMap.insert(std::make_pair(TypeMD, Die));
546 DIE *getDIE(const MDNode *TypeMD) {
547 return MDTypeNodeToDieMap.lookup(TypeMD);
550 /// \brief Emit all Dwarf sections that should come prior to the
554 /// \brief Emit all Dwarf sections that should come after the content.
555 void endModule() override;
557 /// \brief Gather pre-function debug information.
558 void beginFunction(const MachineFunction *MF) override;
560 /// \brief Gather and emit post-function debug information.
561 void endFunction(const MachineFunction *MF) override;
563 /// \brief Process beginning of an instruction.
564 void beginInstruction(const MachineInstr *MI) override;
566 /// \brief Process end of an instruction.
567 void endInstruction() override;
569 /// \brief Add a DIE to the set of types that we're going to pull into
571 void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier,
572 DIE &Die, DICompositeType CTy);
574 /// \brief Add a label so that arange data can be generated for it.
575 void addArangeLabel(SymbolCU SCU) { ArangeLabels.push_back(SCU); }
577 /// \brief For symbols that have a size designated (e.g. common symbols),
578 /// this tracks that size.
579 void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override {
583 /// \brief Recursively Emits a debug information entry.
584 void emitDIE(DIE &Die);
586 // Experimental DWARF5 features.
588 /// \brief Returns whether or not to emit tables that dwarf consumers can
589 /// use to accelerate lookup.
590 bool useDwarfAccelTables() const { return HasDwarfAccelTables; }
592 /// \brief Returns whether or not to change the current debug info for the
593 /// split dwarf proposal support.
594 bool useSplitDwarf() const { return HasSplitDwarf; }
596 /// Returns the Dwarf Version.
597 unsigned getDwarfVersion() const { return DwarfVersion; }
599 /// Returns the section symbol for the .debug_loc section.
600 MCSymbol *getDebugLocSym() const { return DwarfDebugLocSectionSym; }
602 /// Returns the section symbol for the .debug_str section.
603 MCSymbol *getDebugStrSym() const { return DwarfStrSectionSym; }
605 /// Returns the previous CU that was being updated
606 const DwarfCompileUnit *getPrevCU() const { return PrevCU; }
607 void setPrevCU(const DwarfCompileUnit *PrevCU) { this->PrevCU = PrevCU; }
609 /// Returns the entries for the .debug_loc section.
610 const SmallVectorImpl<DebugLocList> &
611 getDebugLocEntries() const {
612 return DotDebugLocEntries;
615 /// \brief Emit an entry for the debug loc section. This can be used to
616 /// handle an entry that's going to be emitted into the debug loc section.
617 void emitDebugLocEntry(ByteStreamer &Streamer, const DebugLocEntry &Entry);
618 /// \brief emit a single value for the debug loc section.
619 void emitDebugLocValue(ByteStreamer &Streamer,
620 const DebugLocEntry::Value &Value);
621 /// Emits an optimal (=sorted) sequence of DW_OP_pieces.
622 void emitLocPieces(ByteStreamer &Streamer,
623 const DITypeIdentifierMap &Map,
624 ArrayRef<DebugLocEntry::Value> Values);
626 /// Emit the location for a debug loc entry, including the size header.
627 void emitDebugLocEntryLocation(const DebugLocEntry &Entry);
629 /// Find the MDNode for the given reference.
630 template <typename T> T resolve(DIRef<T> Ref) const {
631 return Ref.resolve(TypeIdentifierMap);
634 /// \brief Return the TypeIdentifierMap.
635 const DITypeIdentifierMap &getTypeIdentifierMap() const {
636 return TypeIdentifierMap;
639 /// Find the DwarfCompileUnit for the given CU Die.
640 DwarfCompileUnit *lookupUnit(const DIE *CU) const {
641 return CUDieMap.lookup(CU);
643 /// isSubprogramContext - Return true if Context is either a subprogram
644 /// or another context nested inside a subprogram.
645 bool isSubprogramContext(const MDNode *Context);
647 void addSubprogramNames(DISubprogram SP, DIE &Die);
649 AddressPool &getAddressPool() { return AddrPool; }
651 void addAccelName(StringRef Name, const DIE &Die);
653 void addAccelObjC(StringRef Name, const DIE &Die);
655 void addAccelNamespace(StringRef Name, const DIE &Die);
657 void addAccelType(StringRef Name, const DIE &Die, char Flags);
659 const MachineFunction *getCurrentFunction() const { return CurFn; }
660 const MCSymbol *getFunctionBeginSym() const { return FunctionBeginSym; }
661 const MCSymbol *getFunctionEndSym() const { return FunctionEndSym; }
663 iterator_range<ImportedEntityMap::const_iterator> findImportedEntitiesForScope(const MDNode *Scope) const {
664 return make_range(std::equal_range(
665 ScopesWithImportedEntities.begin(), ScopesWithImportedEntities.end(),
666 std::pair<const MDNode *, const MDNode *>(Scope, nullptr), less_first()));
669 /// \brief A helper function to check whether the DIE for a given Scope is
670 /// going to be null.
671 bool isLexicalScopeDIENull(LexicalScope *Scope);
673 // FIXME: Sink these functions down into DwarfFile/Dwarf*Unit.
675 /// \brief Construct new DW_TAG_lexical_block for this scope and
676 /// attach DW_AT_low_pc/DW_AT_high_pc labels.
677 std::unique_ptr<DIE> constructLexicalScopeDIE(DwarfCompileUnit &TheCU,
678 LexicalScope *Scope);
680 /// \brief This scope represents inlined body of a function. Construct
681 /// DIE to represent this concrete inlined copy of the function.
682 std::unique_ptr<DIE> constructInlinedScopeDIE(DwarfCompileUnit &TheCU,
683 LexicalScope *Scope);
685 /// A helper function to create children of a Scope DIE.
686 DIE *createScopeChildrenDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope,
687 SmallVectorImpl<std::unique_ptr<DIE>> &Children,
688 unsigned *ChildScopeCount = nullptr);
690 } // End of namespace llvm