LCOV - code coverage report
Current view: top level - lib/CodeGen/AsmPrinter - DwarfDebug.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 35 35 100.0 %
Date: 2018-07-13 00:08:38 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- llvm/CodeGen/DwarfDebug.h - Dwarf Debug Framework --------*- C++ -*-===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : //
      10             : // This file contains support for writing dwarf debug info into asm files.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H
      15             : #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H
      16             : 
      17             : #include "AddressPool.h"
      18             : #include "DbgValueHistoryCalculator.h"
      19             : #include "DebugHandlerBase.h"
      20             : #include "DebugLocStream.h"
      21             : #include "DwarfFile.h"
      22             : #include "llvm/ADT/ArrayRef.h"
      23             : #include "llvm/ADT/DenseMap.h"
      24             : #include "llvm/ADT/DenseSet.h"
      25             : #include "llvm/ADT/MapVector.h"
      26             : #include "llvm/ADT/STLExtras.h"
      27             : #include "llvm/ADT/SetVector.h"
      28             : #include "llvm/ADT/SmallPtrSet.h"
      29             : #include "llvm/ADT/SmallVector.h"
      30             : #include "llvm/ADT/StringMap.h"
      31             : #include "llvm/ADT/StringRef.h"
      32             : #include "llvm/BinaryFormat/Dwarf.h"
      33             : #include "llvm/CodeGen/AccelTable.h"
      34             : #include "llvm/CodeGen/MachineInstr.h"
      35             : #include "llvm/IR/DebugInfoMetadata.h"
      36             : #include "llvm/IR/DebugLoc.h"
      37             : #include "llvm/IR/Metadata.h"
      38             : #include "llvm/MC/MCDwarf.h"
      39             : #include "llvm/Support/Allocator.h"
      40             : #include "llvm/Target/TargetOptions.h"
      41             : #include <cassert>
      42             : #include <cstdint>
      43             : #include <limits>
      44             : #include <memory>
      45             : #include <utility>
      46             : #include <vector>
      47             : 
      48             : namespace llvm {
      49             : 
      50             : class AsmPrinter;
      51             : class ByteStreamer;
      52             : class DebugLocEntry;
      53             : class DIE;
      54             : class DwarfCompileUnit;
      55             : class DwarfTypeUnit;
      56             : class DwarfUnit;
      57             : class LexicalScope;
      58             : class MachineFunction;
      59             : class MCSection;
      60             : class MCSymbol;
      61             : class MDNode;
      62             : class Module;
      63             : 
      64             : //===----------------------------------------------------------------------===//
      65             : /// This class is used to track local variable information.
      66             : ///
      67             : /// Variables can be created from allocas, in which case they're generated from
      68             : /// the MMI table.  Such variables can have multiple expressions and frame
      69             : /// indices.
      70             : ///
      71             : /// Variables can be created from \c DBG_VALUE instructions.  Those whose
      72             : /// location changes over time use \a DebugLocListIndex, while those with a
      73             : /// single instruction use \a MInsn and (optionally) a single entry of \a Expr.
      74             : ///
      75             : /// Variables that have been optimized out use none of these fields.
      76       81563 : class DbgVariable {
      77             :   const DILocalVariable *Var;                /// Variable Descriptor.
      78             :   const DILocation *IA;                      /// Inlined at location.
      79             :   DIE *TheDIE = nullptr;                     /// Variable DIE.
      80             :   unsigned DebugLocListIndex = ~0u;          /// Offset in DebugLocs.
      81             :   const MachineInstr *MInsn = nullptr;       /// DBG_VALUE instruction.
      82             : 
      83             :   struct FrameIndexExpr {
      84             :     int FI;
      85             :     const DIExpression *Expr;
      86             :   };
      87             :   mutable SmallVector<FrameIndexExpr, 1>
      88             :       FrameIndexExprs; /// Frame index + expression.
      89             : 
      90             : public:
      91             :   /// Construct a DbgVariable.
      92             :   ///
      93             :   /// Creates a variable without any DW_AT_location.  Call \a initializeMMI()
      94             :   /// for MMI entries, or \a initializeDbgValue() for DBG_VALUE instructions.
      95             :   DbgVariable(const DILocalVariable *V, const DILocation *IA)
      96       81563 :       : Var(V), IA(IA) {}
      97             : 
      98             :   /// Initialize from the MMI table.
      99             :   void initializeMMI(const DIExpression *E, int FI) {
     100             :     assert(FrameIndexExprs.empty() && "Already initialized?");
     101             :     assert(!MInsn && "Already initialized?");
     102             : 
     103             :     assert((!E || E->isValid()) && "Expected valid expression");
     104             :     assert(FI != std::numeric_limits<int>::max() && "Expected valid index");
     105             : 
     106       53874 :     FrameIndexExprs.push_back({FI, E});
     107             :   }
     108             : 
     109             :   /// Initialize from a DBG_VALUE instruction.
     110       19129 :   void initializeDbgValue(const MachineInstr *DbgValue) {
     111             :     assert(FrameIndexExprs.empty() && "Already initialized?");
     112             :     assert(!MInsn && "Already initialized?");
     113             : 
     114             :     assert(Var == DbgValue->getDebugVariable() && "Wrong variable");
     115             :     assert(IA == DbgValue->getDebugLoc()->getInlinedAt() && "Wrong inlined-at");
     116             : 
     117       19129 :     MInsn = DbgValue;
     118       19129 :     if (auto *E = DbgValue->getDebugExpression())
     119       19129 :       if (E->getNumElements())
     120        2520 :         FrameIndexExprs.push_back({0, E});
     121       19129 :   }
     122             : 
     123             :   // Accessors.
     124             :   const DILocalVariable *getVariable() const { return Var; }
     125             :   const DILocation *getInlinedAt() const { return IA; }
     126             : 
     127             :   const DIExpression *getSingleExpression() const {
     128             :     assert(MInsn && FrameIndexExprs.size() <= 1);
     129        1127 :     return FrameIndexExprs.size() ? FrameIndexExprs[0].Expr : nullptr;
     130             :   }
     131             : 
     132       81558 :   void setDIE(DIE &D) { TheDIE = &D; }
     133             :   DIE *getDIE() const { return TheDIE; }
     134       15340 :   void setDebugLocListIndex(unsigned O) { DebugLocListIndex = O; }
     135             :   unsigned getDebugLocListIndex() const { return DebugLocListIndex; }
     136             :   StringRef getName() const { return Var->getName(); }
     137             :   const MachineInstr *getMInsn() const { return MInsn; }
     138             :   /// Get the FI entries, sorted by fragment offset.
     139             :   ArrayRef<FrameIndexExpr> getFrameIndexExprs() const;
     140       55302 :   bool hasFrameIndexExprs() const { return !FrameIndexExprs.empty(); }
     141             :   void addMMIEntry(const DbgVariable &V);
     142             : 
     143             :   // Translate tag to proper Dwarf tag.
     144             :   dwarf::Tag getTag() const {
     145             :     // FIXME: Why don't we just infer this tag and store it all along?
     146       81558 :     if (Var->isParameter())
     147             :       return dwarf::DW_TAG_formal_parameter;
     148             : 
     149             :     return dwarf::DW_TAG_variable;
     150             :   }
     151             : 
     152             :   /// Return true if DbgVariable is artificial.
     153       62359 :   bool isArtificial() const {
     154      124718 :     if (Var->isArtificial())
     155             :       return true;
     156       89856 :     if (getType()->isArtificial())
     157             :       return true;
     158       44920 :     return false;
     159             :   }
     160             : 
     161       81558 :   bool isObjectPointer() const {
     162      163116 :     if (Var->isObjectPointer())
     163             :       return true;
     164      117404 :     if (getType()->isObjectPointer())
     165             :       return true;
     166       58698 :     return false;
     167             :   }
     168             : 
     169             :   bool hasComplexAddress() const {
     170             :     assert(MInsn && "Expected DBG_VALUE, not MMI variable");
     171             :     assert((FrameIndexExprs.empty() ||
     172             :             (FrameIndexExprs.size() == 1 &&
     173             :              FrameIndexExprs[0].Expr->getNumElements())) &&
     174             :            "Invalid Expr for DBG_VALUE");
     175        2943 :     return !FrameIndexExprs.empty();
     176             :   }
     177             : 
     178             :   bool isBlockByrefVariable() const;
     179             :   const DIType *getType() const;
     180             : 
     181             : private:
     182             :   template <typename T> T *resolve(TypedDINodeRef<T> Ref) const {
     183             :     return Ref.resolve();
     184             :   }
     185             : };
     186             : 
     187             : /// Helper used to pair up a symbol and its DWARF compile unit.
     188             : struct SymbolCU {
     189          10 :   SymbolCU(DwarfCompileUnit *CU, const MCSymbol *Sym) : Sym(Sym), CU(CU) {}
     190             : 
     191             :   const MCSymbol *Sym;
     192             :   DwarfCompileUnit *CU;
     193             : };
     194             : 
     195             : /// The kind of accelerator tables we should emit.
     196             : enum class AccelTableKind {
     197             :   Default, ///< Platform default.
     198             :   None,    ///< None.
     199             :   Apple,   ///< .apple_names, .apple_namespaces, .apple_types, .apple_objc.
     200             :   Dwarf,   ///< DWARF v5 .debug_names.
     201             : };
     202             : 
     203             : /// Collects and handles dwarf debug information.
     204      108425 : class DwarfDebug : public DebugHandlerBase {
     205             :   /// All DIEValues are allocated through this allocator.
     206             :   BumpPtrAllocator DIEValueAllocator;
     207             : 
     208             :   /// Maps MDNode with its corresponding DwarfCompileUnit.
     209             :   MapVector<const MDNode *, DwarfCompileUnit *> CUMap;
     210             : 
     211             :   /// Maps a CU DIE with its corresponding DwarfCompileUnit.
     212             :   DenseMap<const DIE *, DwarfCompileUnit *> CUDieMap;
     213             : 
     214             :   /// List of all labels used in aranges generation.
     215             :   std::vector<SymbolCU> ArangeLabels;
     216             : 
     217             :   /// Size of each symbol emitted (for those symbols that have a specific size).
     218             :   DenseMap<const MCSymbol *, uint64_t> SymSize;
     219             : 
     220             :   /// Collection of abstract variables.
     221             :   SmallVector<std::unique_ptr<DbgVariable>, 64> ConcreteVariables;
     222             : 
     223             :   /// Collection of DebugLocEntry. Stored in a linked list so that DIELocLists
     224             :   /// can refer to them in spite of insertions into this list.
     225             :   DebugLocStream DebugLocs;
     226             : 
     227             :   /// This is a collection of subprogram MDNodes that are processed to
     228             :   /// create DIEs.
     229             :   SetVector<const DISubprogram *, SmallVector<const DISubprogram *, 16>,
     230             :             SmallPtrSet<const DISubprogram *, 16>>
     231             :       ProcessedSPNodes;
     232             : 
     233             :   /// If nonnull, stores the current machine function we're processing.
     234             :   const MachineFunction *CurFn = nullptr;
     235             : 
     236             :   /// If nonnull, stores the CU in which the previous subprogram was contained.
     237             :   const DwarfCompileUnit *PrevCU;
     238             : 
     239             :   /// As an optimization, there is no need to emit an entry in the directory
     240             :   /// table for the same directory as DW_AT_comp_dir.
     241             :   StringRef CompilationDir;
     242             : 
     243             :   /// Holder for the file specific debug information.
     244             :   DwarfFile InfoHolder;
     245             : 
     246             :   /// Holders for the various debug information flags that we might need to
     247             :   /// have exposed. See accessor functions below for description.
     248             : 
     249             :   /// Map from MDNodes for user-defined types to their type signatures. Also
     250             :   /// used to keep track of which types we have emitted type units for.
     251             :   DenseMap<const MDNode *, uint64_t> TypeSignatures;
     252             : 
     253             :   SmallVector<
     254             :       std::pair<std::unique_ptr<DwarfTypeUnit>, const DICompositeType *>, 1>
     255             :       TypeUnitsUnderConstruction;
     256             : 
     257             :   /// Whether to use the GNU TLS opcode (instead of the standard opcode).
     258             :   bool UseGNUTLSOpcode;
     259             : 
     260             :   /// Whether to use DWARF 2 bitfields (instead of the DWARF 4 format).
     261             :   bool UseDWARF2Bitfields;
     262             : 
     263             :   /// Whether to emit all linkage names, or just abstract subprograms.
     264             :   bool UseAllLinkageNames;
     265             : 
     266             :   /// Use inlined strings.
     267             :   bool UseInlineStrings = false;
     268             : 
     269             :   /// Whether to emit DWARF pub sections or not.
     270             :   bool UsePubSections = true;
     271             : 
     272             :   /// Allow emission of .debug_ranges section.
     273             :   bool UseRangesSection = true;
     274             : 
     275             :   /// True if the sections itself must be used as references and don't create
     276             :   /// temp symbols inside DWARF sections.
     277             :   bool UseSectionsAsReferences = false;
     278             : 
     279             :   ///Allow emission of the .debug_loc section.
     280             :   bool UseLocSection = true;
     281             : 
     282             :   /// DWARF5 Experimental Options
     283             :   /// @{
     284             :   AccelTableKind TheAccelTableKind;
     285             :   bool HasAppleExtensionAttributes;
     286             :   bool HasSplitDwarf;
     287             : 
     288             :   /// Whether to generate the DWARF v5 string offsets table.
     289             :   /// It consists of a series of contributions, each preceded by a header.
     290             :   /// The pre-DWARF v5 string offsets table for split dwarf is, in contrast,
     291             :   /// a monolithic sequence of string offsets.
     292             :   bool UseSegmentedStringOffsetsTable;
     293             : 
     294             :   /// Separated Dwarf Variables
     295             :   /// In general these will all be for bits that are left in the
     296             :   /// original object file, rather than things that are meant
     297             :   /// to be in the .dwo sections.
     298             : 
     299             :   /// Holder for the skeleton information.
     300             :   DwarfFile SkeletonHolder;
     301             : 
     302             :   /// Store file names for type units under fission in a line table
     303             :   /// header that will be emitted into debug_line.dwo.
     304             :   // FIXME: replace this with a map from comp_dir to table so that we
     305             :   // can emit multiple tables during LTO each of which uses directory
     306             :   // 0, referencing the comp_dir of all the type units that use it.
     307             :   MCDwarfDwoLineTable SplitTypeUnitFileTable;
     308             :   /// @}
     309             : 
     310             :   /// True iff there are multiple CUs in this module.
     311             :   bool SingleCU;
     312             :   bool IsDarwin;
     313             : 
     314             :   AddressPool AddrPool;
     315             : 
     316             :   /// Accelerator tables.
     317             :   AccelTable<DWARF5AccelTableData> AccelDebugNames;
     318             :   AccelTable<AppleAccelTableOffsetData> AccelNames;
     319             :   AccelTable<AppleAccelTableOffsetData> AccelObjC;
     320             :   AccelTable<AppleAccelTableOffsetData> AccelNamespace;
     321             :   AccelTable<AppleAccelTableTypeData> AccelTypes;
     322             : 
     323             :   // Identify a debugger for "tuning" the debug info.
     324             :   DebuggerKind DebuggerTuning = DebuggerKind::Default;
     325             : 
     326             :   MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &);
     327             : 
     328             :   const SmallVectorImpl<std::unique_ptr<DwarfCompileUnit>> &getUnits() {
     329             :     return InfoHolder.getUnits();
     330             :   }
     331             : 
     332             :   using InlinedVariable = DbgValueHistoryMap::InlinedVariable;
     333             : 
     334             :   void ensureAbstractVariableIsCreated(DwarfCompileUnit &CU, InlinedVariable Var,
     335             :                                        const MDNode *Scope);
     336             :   void ensureAbstractVariableIsCreatedIfScoped(DwarfCompileUnit &CU, InlinedVariable Var,
     337             :                                                const MDNode *Scope);
     338             : 
     339             :   DbgVariable *createConcreteVariable(DwarfCompileUnit &TheCU,
     340             :                                       LexicalScope &Scope, InlinedVariable IV);
     341             : 
     342             :   /// Construct a DIE for this abstract scope.
     343             :   void constructAbstractSubprogramScopeDIE(DwarfCompileUnit &SrcCU, LexicalScope *Scope);
     344             : 
     345             :   /// Helper function to add a name to the .debug_names table, using the
     346             :   /// appropriate string pool.
     347             :   void addAccelDebugName(StringRef Name, const DIE &Die);
     348             : 
     349             :   void finishVariableDefinitions();
     350             : 
     351             :   void finishSubprogramDefinitions();
     352             : 
     353             :   /// Finish off debug information after all functions have been
     354             :   /// processed.
     355             :   void finalizeModuleInfo();
     356             : 
     357             :   /// Emit the debug info section.
     358             :   void emitDebugInfo();
     359             : 
     360             :   /// Emit the abbreviation section.
     361             :   void emitAbbreviations();
     362             : 
     363             :   /// Emit the string offsets table header.
     364             :   void emitStringOffsetsTableHeader();
     365             : 
     366             :   /// Emit a specified accelerator table.
     367             :   template <typename AccelTableT>
     368             :   void emitAccel(AccelTableT &Accel, MCSection *Section, StringRef TableName);
     369             : 
     370             :   /// Emit DWARF v5 accelerator table.
     371             :   void emitAccelDebugNames();
     372             : 
     373             :   /// Emit visible names into a hashed accelerator table section.
     374             :   void emitAccelNames();
     375             : 
     376             :   /// Emit objective C classes and categories into a hashed
     377             :   /// accelerator table section.
     378             :   void emitAccelObjC();
     379             : 
     380             :   /// Emit namespace dies into a hashed accelerator table.
     381             :   void emitAccelNamespaces();
     382             : 
     383             :   /// Emit type dies into a hashed accelerator table.
     384             :   void emitAccelTypes();
     385             : 
     386             :   /// Emit visible names and types into debug pubnames and pubtypes sections.
     387             :   void emitDebugPubSections();
     388             : 
     389             :   void emitDebugPubSection(bool GnuStyle, StringRef Name,
     390             :                            DwarfCompileUnit *TheU,
     391             :                            const StringMap<const DIE *> &Globals);
     392             : 
     393             :   /// Emit null-terminated strings into a debug str section.
     394             :   void emitDebugStr();
     395             : 
     396             :   /// Emit variable locations into a debug loc section.
     397             :   void emitDebugLoc();
     398             : 
     399             :   /// Emit variable locations into a debug loc dwo section.
     400             :   void emitDebugLocDWO();
     401             : 
     402             :   /// Emit address ranges into a debug aranges section.
     403             :   void emitDebugARanges();
     404             : 
     405             :   /// Emit address ranges into a debug ranges section.
     406             :   void emitDebugRanges();
     407             : 
     408             :   /// Emit macros into a debug macinfo section.
     409             :   void emitDebugMacinfo();
     410             :   void emitMacro(DIMacro &M);
     411             :   void emitMacroFile(DIMacroFile &F, DwarfCompileUnit &U);
     412             :   void handleMacroNodes(DIMacroNodeArray Nodes, DwarfCompileUnit &U);
     413             : 
     414             :   /// DWARF 5 Experimental Split Dwarf Emitters
     415             : 
     416             :   /// Initialize common features of skeleton units.
     417             :   void initSkeletonUnit(const DwarfUnit &U, DIE &Die,
     418             :                         std::unique_ptr<DwarfCompileUnit> NewU);
     419             : 
     420             :   /// Construct the split debug info compile unit for the debug info
     421             :   /// section.
     422             :   DwarfCompileUnit &constructSkeletonCU(const DwarfCompileUnit &CU);
     423             : 
     424             :   /// Emit the debug info dwo section.
     425             :   void emitDebugInfoDWO();
     426             : 
     427             :   /// Emit the debug abbrev dwo section.
     428             :   void emitDebugAbbrevDWO();
     429             : 
     430             :   /// Emit the debug line dwo section.
     431             :   void emitDebugLineDWO();
     432             : 
     433             :   /// Emit the dwo stringoffsets table header.
     434             :   void emitStringOffsetsTableHeaderDWO();
     435             : 
     436             :   /// Emit the debug str dwo section.
     437             :   void emitDebugStrDWO();
     438             : 
     439             :   /// Flags to let the linker know we have emitted new style pubnames. Only
     440             :   /// emit it here if we don't have a skeleton CU for split dwarf.
     441             :   void addGnuPubAttributes(DwarfCompileUnit &U, DIE &D) const;
     442             : 
     443             :   /// Create new DwarfCompileUnit for the given metadata node with tag
     444             :   /// DW_TAG_compile_unit.
     445             :   DwarfCompileUnit &getOrCreateDwarfCompileUnit(const DICompileUnit *DIUnit);
     446             : 
     447             :   /// Construct imported_module or imported_declaration DIE.
     448             :   void constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
     449             :                                         const DIImportedEntity *N);
     450             : 
     451             :   /// Register a source line with debug info. Returns the unique
     452             :   /// label that was emitted and which provides correspondence to the
     453             :   /// source line list.
     454             :   void recordSourceLine(unsigned Line, unsigned Col, const MDNode *Scope,
     455             :                         unsigned Flags);
     456             : 
     457             :   /// Populate LexicalScope entries with variables' info.
     458             :   void collectVariableInfo(DwarfCompileUnit &TheCU, const DISubprogram *SP,
     459             :                            DenseSet<InlinedVariable> &ProcessedVars);
     460             : 
     461             :   /// Build the location list for all DBG_VALUEs in the
     462             :   /// function that describe the same variable.
     463             :   void buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
     464             :                          const DbgValueHistoryMap::InstrRanges &Ranges);
     465             : 
     466             :   /// Collect variable information from the side table maintained by MF.
     467             :   void collectVariableInfoFromMFTable(DwarfCompileUnit &TheCU,
     468             :                                       DenseSet<InlinedVariable> &P);
     469             : 
     470             :   /// Emit the reference to the section.
     471             :   void emitSectionReference(const DwarfCompileUnit &CU);
     472             : 
     473             : protected:
     474             :   /// Gather pre-function debug information.
     475             :   void beginFunctionImpl(const MachineFunction *MF) override;
     476             : 
     477             :   /// Gather and emit post-function debug information.
     478             :   void endFunctionImpl(const MachineFunction *MF) override;
     479             : 
     480             :   void skippedNonDebugFunction() override;
     481             : 
     482             : public:
     483             :   //===--------------------------------------------------------------------===//
     484             :   // Main entry points.
     485             :   //
     486             :   DwarfDebug(AsmPrinter *A, Module *M);
     487             : 
     488             :   ~DwarfDebug() override;
     489             : 
     490             :   /// Emit all Dwarf sections that should come prior to the
     491             :   /// content.
     492             :   void beginModule();
     493             : 
     494             :   /// Emit all Dwarf sections that should come after the content.
     495             :   void endModule() override;
     496             : 
     497             :   /// Process beginning of an instruction.
     498             :   void beginInstruction(const MachineInstr *MI) override;
     499             : 
     500             :   /// Perform an MD5 checksum of \p Identifier and return the lower 64 bits.
     501             :   static uint64_t makeTypeSignature(StringRef Identifier);
     502             : 
     503             :   /// Add a DIE to the set of types that we're going to pull into
     504             :   /// type units.
     505             :   void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier,
     506             :                             DIE &Die, const DICompositeType *CTy);
     507             : 
     508             :   /// Add a label so that arange data can be generated for it.
     509       85239 :   void addArangeLabel(SymbolCU SCU) { ArangeLabels.push_back(SCU); }
     510             : 
     511             :   /// For symbols that have a size designated (e.g. common symbols),
     512             :   /// this tracks that size.
     513       84624 :   void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override {
     514      169248 :     SymSize[Sym] = Size;
     515       84624 :   }
     516             : 
     517             :   /// Returns whether we should emit all DW_AT_[MIPS_]linkage_name.
     518             :   /// If not, we still might emit certain cases.
     519             :   bool useAllLinkageNames() const { return UseAllLinkageNames; }
     520             : 
     521             :   /// Returns whether to use DW_OP_GNU_push_tls_address, instead of the
     522             :   /// standard DW_OP_form_tls_address opcode
     523             :   bool useGNUTLSOpcode() const { return UseGNUTLSOpcode; }
     524             : 
     525             :   /// Returns whether to use the DWARF2 format for bitfields instyead of the
     526             :   /// DWARF4 format.
     527             :   bool useDWARF2Bitfields() const { return UseDWARF2Bitfields; }
     528             : 
     529             :   /// Returns whether to use inline strings.
     530             :   bool useInlineStrings() const { return UseInlineStrings; }
     531             : 
     532             :   /// Returns whether GNU pub sections should be emitted.
     533             :   bool usePubSections() const { return UsePubSections; }
     534             : 
     535             :   /// Returns whether ranges section should be emitted.
     536             :   bool useRangesSection() const { return UseRangesSection; }
     537             : 
     538             :   /// Returns whether to use sections as labels rather than temp symbols.
     539             :   bool useSectionsAsReferences() const {
     540             :     return UseSectionsAsReferences;
     541             :   }
     542             : 
     543             :   /// Returns whether .debug_loc section should be emitted.
     544             :   bool useLocSection() const { return UseLocSection; }
     545             : 
     546             :   // Experimental DWARF5 features.
     547             : 
     548             :   /// Returns what kind (if any) of accelerator tables to emit.
     549             :   AccelTableKind getAccelTableKind() const { return TheAccelTableKind; }
     550             : 
     551             :   bool useAppleExtensionAttributes() const {
     552             :     return HasAppleExtensionAttributes;
     553             :   }
     554             : 
     555             :   /// Returns whether or not to change the current debug info for the
     556             :   /// split dwarf proposal support.
     557             :   bool useSplitDwarf() const { return HasSplitDwarf; }
     558             : 
     559             :   /// Returns whether to generate a string offsets table with (possibly shared)
     560             :   /// contributions from each CU and type unit. This implies the use of
     561             :   /// DW_FORM_strx* indirect references with DWARF v5 and beyond. Note that
     562             :   /// DW_FORM_GNU_str_index is also an indirect reference, but it is used with
     563             :   /// a pre-DWARF v5 implementation of split DWARF sections, which uses a
     564             :   /// monolithic string offsets table.
     565             :   bool useSegmentedStringOffsetsTable() const {
     566             :     return UseSegmentedStringOffsetsTable;
     567             :   }
     568             : 
     569             :   bool shareAcrossDWOCUs() const;
     570             : 
     571             :   /// Returns the Dwarf Version.
     572             :   uint16_t getDwarfVersion() const;
     573             : 
     574             :   /// Returns the previous CU that was being updated
     575             :   const DwarfCompileUnit *getPrevCU() const { return PrevCU; }
     576       36012 :   void setPrevCU(const DwarfCompileUnit *PrevCU) { this->PrevCU = PrevCU; }
     577             : 
     578             :   /// Returns the entries for the .debug_loc section.
     579          41 :   const DebugLocStream &getDebugLocs() const { return DebugLocs; }
     580             : 
     581             :   /// Emit an entry for the debug loc section. This can be used to
     582             :   /// handle an entry that's going to be emitted into the debug loc section.
     583             :   void emitDebugLocEntry(ByteStreamer &Streamer,
     584             :                          const DebugLocStream::Entry &Entry);
     585             : 
     586             :   /// Emit the location for a debug loc entry, including the size header.
     587             :   void emitDebugLocEntryLocation(const DebugLocStream::Entry &Entry);
     588             : 
     589             :   /// Find the MDNode for the given reference.
     590             :   template <typename T> T *resolve(TypedDINodeRef<T> Ref) const {
     591             :     return Ref.resolve();
     592             :   }
     593             : 
     594             :   void addSubprogramNames(const DISubprogram *SP, DIE &Die);
     595             : 
     596        8960 :   AddressPool &getAddressPool() { return AddrPool; }
     597             : 
     598             :   void addAccelName(StringRef Name, const DIE &Die);
     599             : 
     600             :   void addAccelObjC(StringRef Name, const DIE &Die);
     601             : 
     602             :   void addAccelNamespace(StringRef Name, const DIE &Die);
     603             : 
     604             :   void addAccelType(StringRef Name, const DIE &Die, char Flags);
     605             : 
     606             :   const MachineFunction *getCurrentFunction() const { return CurFn; }
     607             : 
     608             :   /// A helper function to check whether the DIE for a given Scope is
     609             :   /// going to be null.
     610             :   bool isLexicalScopeDIENull(LexicalScope *Scope);
     611             : 
     612             :   /// Find the matching DwarfCompileUnit for the given CU DIE.
     613         707 :   DwarfCompileUnit *lookupCU(const DIE *Die) { return CUDieMap.lookup(Die); }
     614             :   const DwarfCompileUnit *lookupCU(const DIE *Die) const {
     615         259 :     return CUDieMap.lookup(Die);
     616             :   }
     617             : 
     618             :   /// \defgroup DebuggerTuning Predicates to tune DWARF for a given debugger.
     619             :   ///
     620             :   /// Returns whether we are "tuning" for a given debugger.
     621             :   /// @{
     622             :   bool tuneForGDB() const { return DebuggerTuning == DebuggerKind::GDB; }
     623       21789 :   bool tuneForLLDB() const { return DebuggerTuning == DebuggerKind::LLDB; }
     624             :   bool tuneForSCE() const { return DebuggerTuning == DebuggerKind::SCE; }
     625             :   /// @}
     626             : };
     627             : 
     628             : } // end namespace llvm
     629             : 
     630             : #endif // LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H

Generated by: LCOV version 1.13