1 //===-- llvm/CodeGen/DwarfFile.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 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFFILE_H
11 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFFILE_H
13 #include "llvm/ADT/DenseMap.h"
14 #include "llvm/ADT/FoldingSet.h"
15 #include "llvm/ADT/SmallVector.h"
16 #include "llvm/ADT/StringMap.h"
17 #include "llvm/Support/Allocator.h"
18 #include "AddressPool.h"
19 #include "DwarfStringPool.h"
37 // Target of Dwarf emission, used for sizing of abbreviations.
42 // Used to uniquely define abbreviations.
43 FoldingSet<DIEAbbrev> AbbreviationsSet;
45 // A list of all the unique abbreviations in use.
46 std::vector<DIEAbbrev *> Abbreviations;
48 // A pointer to all units in the section.
49 SmallVector<std::unique_ptr<DwarfUnit>, 1> CUs;
51 DwarfStringPool StrPool;
54 DwarfFile(AsmPrinter *AP, DwarfDebug &DD, StringRef Pref,
55 BumpPtrAllocator &DA);
59 const SmallVectorImpl<std::unique_ptr<DwarfUnit>> &getUnits() { return CUs; }
61 /// \brief Compute the size and offset of a DIE given an incoming Offset.
62 unsigned computeSizeAndOffset(DIE &Die, unsigned Offset);
64 /// \brief Compute the size and offset of all the DIEs.
65 void computeSizeAndOffsets();
67 /// \brief Define a unique number for the abbreviation.
68 void assignAbbrevNumber(DIEAbbrev &Abbrev);
70 /// \brief Add a unit to the list of CUs.
71 void addUnit(std::unique_ptr<DwarfUnit> U);
73 /// \brief Emit all of the units to the section listed with the given
74 /// abbreviation section.
75 void emitUnits(const MCSymbol *ASectionSym);
77 /// \brief Emit a set of abbreviations to the specific section.
78 void emitAbbrevs(const MCSection *);
80 /// \brief Emit all of the strings to the section given.
81 void emitStrings(const MCSection *StrSection,
82 const MCSection *OffsetSection = nullptr);
84 /// \brief Returns the string pool.
85 DwarfStringPool &getStringPool() { return StrPool; }
87 bool addCurrentFnArgument(DbgVariable *Var, LexicalScope *Scope);
88 void addNonArgumentScopeVariable(LexicalScope *LS, DbgVariable *Var);