Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 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 CODEGEN_ASMPRINTER_DWARFDEBUG_H__ |
| 15 | #define CODEGEN_ASMPRINTER_DWARFDEBUG_H__ |
| 16 | |
David Blaikie | 85f80d7 | 2014-04-23 18:54:00 +0000 | [diff] [blame] | 17 | #include "DwarfFile.h" |
Timur Iskhodzhanov | 1cd1444 | 2013-12-03 15:10:23 +0000 | [diff] [blame] | 18 | #include "AsmPrinterHandler.h" |
Bill Wendling | e38859d | 2012-06-28 00:05:13 +0000 | [diff] [blame] | 19 | #include "DIE.h" |
David Blaikie | 1275e4f | 2014-04-01 21:49:04 +0000 | [diff] [blame] | 20 | #include "DebugLocEntry.h" |
David Blaikie | 0a456de | 2014-04-02 01:43:18 +0000 | [diff] [blame] | 21 | #include "DebugLocList.h" |
Devang Patel | 018b29b | 2010-01-19 06:19:05 +0000 | [diff] [blame] | 22 | #include "llvm/ADT/DenseMap.h" |
Eric Christopher | acbe42b | 2014-03-18 20:58:35 +0000 | [diff] [blame] | 23 | #include "llvm/ADT/MapVector.h" |
| 24 | #include "llvm/ADT/SmallPtrSet.h" |
| 25 | #include "llvm/ADT/StringMap.h" |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 26 | #include "llvm/ADT/FoldingSet.h" |
Chandler Carruth | 802d755 | 2012-12-04 07:12:27 +0000 | [diff] [blame] | 27 | #include "llvm/CodeGen/LexicalScopes.h" |
Chandler Carruth | 9a4c9e5 | 2014-03-06 00:46:21 +0000 | [diff] [blame] | 28 | #include "llvm/IR/DebugInfo.h" |
Eric Christopher | acbe42b | 2014-03-18 20:58:35 +0000 | [diff] [blame] | 29 | #include "llvm/IR/DebugLoc.h" |
Chandler Carruth | 802d755 | 2012-12-04 07:12:27 +0000 | [diff] [blame] | 30 | #include "llvm/MC/MachineLocation.h" |
David Blaikie | 4a2f95f | 2014-03-18 01:17:26 +0000 | [diff] [blame] | 31 | #include "llvm/MC/MCDwarf.h" |
Chris Lattner | 3f3fb97 | 2010-04-05 05:24:55 +0000 | [diff] [blame] | 32 | #include "llvm/Support/Allocator.h" |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 33 | |
David Blaikie | f9b6a55 | 2014-04-22 22:39:41 +0000 | [diff] [blame] | 34 | #include <memory> |
| 35 | |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 36 | namespace llvm { |
| 37 | |
Adrian Prantl | 702bf5a | 2014-03-18 02:34:52 +0000 | [diff] [blame] | 38 | class AsmPrinter; |
Eric Christopher | 29e874d | 2014-03-07 22:40:37 +0000 | [diff] [blame] | 39 | class ByteStreamer; |
Chris Lattner | 88fce10 | 2012-01-26 20:44:57 +0000 | [diff] [blame] | 40 | class ConstantInt; |
| 41 | class ConstantFP; |
Eric Christopher | ce4a944 | 2014-03-18 20:37:10 +0000 | [diff] [blame] | 42 | class DwarfCompileUnit; |
| 43 | class DwarfDebug; |
| 44 | class DwarfTypeUnit; |
| 45 | class DwarfUnit; |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 46 | class MachineModuleInfo; |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 47 | |
| 48 | //===----------------------------------------------------------------------===// |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 49 | /// \brief This class is used to record source line correspondence. |
Benjamin Kramer | 079b96e | 2013-09-11 18:05:11 +0000 | [diff] [blame] | 50 | class SrcLineInfo { |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 51 | unsigned Line; // Source line number. |
| 52 | unsigned Column; // Source column. |
| 53 | unsigned SourceID; // Source ID number. |
| 54 | MCSymbol *Label; // Label in code ID number. |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 55 | public: |
Chris Lattner | b4666f4 | 2010-03-14 08:15:55 +0000 | [diff] [blame] | 56 | SrcLineInfo(unsigned L, unsigned C, unsigned S, MCSymbol *label) |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 57 | : Line(L), Column(C), SourceID(S), Label(label) {} |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 58 | |
| 59 | // Accessors |
| 60 | unsigned getLine() const { return Line; } |
| 61 | unsigned getColumn() const { return Column; } |
| 62 | unsigned getSourceID() const { return SourceID; } |
Chris Lattner | b4666f4 | 2010-03-14 08:15:55 +0000 | [diff] [blame] | 63 | MCSymbol *getLabel() const { return Label; } |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 64 | }; |
| 65 | |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 66 | //===----------------------------------------------------------------------===// |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 67 | /// \brief This class is used to track local variable information. |
Benjamin Kramer | 079b96e | 2013-09-11 18:05:11 +0000 | [diff] [blame] | 68 | class DbgVariable { |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 69 | DIVariable Var; // Variable Descriptor. |
| 70 | DIE *TheDIE; // Variable DIE. |
| 71 | unsigned DotDebugLocOffset; // Offset in DotDebugLocEntries. |
| 72 | DbgVariable *AbsVar; // Corresponding Abstract variable, if any. |
| 73 | const MachineInstr *MInsn; // DBG_VALUE instruction of the variable. |
Devang Patel | 3e4a965 | 2011-08-15 21:24:36 +0000 | [diff] [blame] | 74 | int FrameIndex; |
Manman Ren | b338860 | 2013-10-05 01:43:03 +0000 | [diff] [blame] | 75 | DwarfDebug *DD; |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 76 | |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 77 | public: |
| 78 | // AbsVar may be NULL. |
Manman Ren | b338860 | 2013-10-05 01:43:03 +0000 | [diff] [blame] | 79 | DbgVariable(DIVariable V, DbgVariable *AV, DwarfDebug *DD) |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 80 | : Var(V), TheDIE(0), DotDebugLocOffset(~0U), AbsVar(AV), MInsn(0), |
| 81 | FrameIndex(~0), DD(DD) {} |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 82 | |
| 83 | // Accessors. |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 84 | DIVariable getVariable() const { return Var; } |
| 85 | void setDIE(DIE *D) { TheDIE = D; } |
| 86 | DIE *getDIE() const { return TheDIE; } |
| 87 | void setDotDebugLocOffset(unsigned O) { DotDebugLocOffset = O; } |
| 88 | unsigned getDotDebugLocOffset() const { return DotDebugLocOffset; } |
| 89 | StringRef getName() const { return Var.getName(); } |
Devang Patel | 99819b5 | 2011-08-15 19:01:20 +0000 | [diff] [blame] | 90 | DbgVariable *getAbstractVariable() const { return AbsVar; } |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 91 | const MachineInstr *getMInsn() const { return MInsn; } |
| 92 | void setMInsn(const MachineInstr *M) { MInsn = M; } |
| 93 | int getFrameIndex() const { return FrameIndex; } |
| 94 | void setFrameIndex(int FI) { FrameIndex = FI; } |
Eric Christopher | 27527b2 | 2012-11-21 00:03:28 +0000 | [diff] [blame] | 95 | // Translate tag to proper Dwarf tag. |
David Blaikie | efc403b | 2014-04-12 02:24:04 +0000 | [diff] [blame] | 96 | dwarf::Tag getTag() const { |
Devang Patel | 6e4d2c9 | 2011-08-15 18:35:42 +0000 | [diff] [blame] | 97 | if (Var.getTag() == dwarf::DW_TAG_arg_variable) |
| 98 | return dwarf::DW_TAG_formal_parameter; |
Eric Christopher | 27527b2 | 2012-11-21 00:03:28 +0000 | [diff] [blame] | 99 | |
Devang Patel | 6e4d2c9 | 2011-08-15 18:35:42 +0000 | [diff] [blame] | 100 | return dwarf::DW_TAG_variable; |
| 101 | } |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 102 | /// \brief Return true if DbgVariable is artificial. |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 103 | bool isArtificial() const { |
Devang Patel | d7d80aa | 2011-08-15 18:40:16 +0000 | [diff] [blame] | 104 | if (Var.isArtificial()) |
| 105 | return true; |
Eric Christopher | c1c8a1b | 2012-09-21 22:18:52 +0000 | [diff] [blame] | 106 | if (getType().isArtificial()) |
Devang Patel | d7d80aa | 2011-08-15 18:40:16 +0000 | [diff] [blame] | 107 | return true; |
| 108 | return false; |
| 109 | } |
Eric Christopher | e341776 | 2012-09-12 23:36:19 +0000 | [diff] [blame] | 110 | |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 111 | bool isObjectPointer() const { |
Eric Christopher | e341776 | 2012-09-12 23:36:19 +0000 | [diff] [blame] | 112 | if (Var.isObjectPointer()) |
| 113 | return true; |
Eric Christopher | c1c8a1b | 2012-09-21 22:18:52 +0000 | [diff] [blame] | 114 | if (getType().isObjectPointer()) |
Eric Christopher | e341776 | 2012-09-12 23:36:19 +0000 | [diff] [blame] | 115 | return true; |
| 116 | return false; |
| 117 | } |
Eric Christopher | 27527b2 | 2012-11-21 00:03:28 +0000 | [diff] [blame] | 118 | |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 119 | bool variableHasComplexAddress() const { |
Manman Ren | 7504ed4 | 2013-07-08 18:33:29 +0000 | [diff] [blame] | 120 | assert(Var.isVariable() && "Invalid complex DbgVariable!"); |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 121 | return Var.hasComplexAddress(); |
| 122 | } |
Adrian Prantl | 1a1647c | 2014-03-18 02:34:58 +0000 | [diff] [blame] | 123 | bool isBlockByrefVariable() const; |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 124 | unsigned getNumAddrElements() const { |
Manman Ren | 7504ed4 | 2013-07-08 18:33:29 +0000 | [diff] [blame] | 125 | assert(Var.isVariable() && "Invalid complex DbgVariable!"); |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 126 | return Var.getNumAddrElements(); |
| 127 | } |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 128 | uint64_t getAddrElement(unsigned i) const { return Var.getAddrElement(i); } |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 129 | DIType getType() const; |
Manman Ren | be5576f | 2013-10-08 19:07:44 +0000 | [diff] [blame] | 130 | |
| 131 | private: |
| 132 | /// resolve - Look in the DwarfDebug map for the MDNode that |
| 133 | /// corresponds to the reference. |
| 134 | template <typename T> T resolve(DIRef<T> Ref) const; |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 135 | }; |
| 136 | |
Eric Christopher | c8a310e | 2012-12-10 23:34:43 +0000 | [diff] [blame] | 137 | |
Eric Christopher | 670ee0e | 2013-10-24 21:20:23 +0000 | [diff] [blame] | 138 | /// \brief Helper used to pair up a symbol and its DWARF compile unit. |
Richard Mitton | 21101b3 | 2013-09-19 23:21:01 +0000 | [diff] [blame] | 139 | struct SymbolCU { |
Eric Christopher | 4287a49 | 2013-12-09 23:57:44 +0000 | [diff] [blame] | 140 | SymbolCU(DwarfCompileUnit *CU, const MCSymbol *Sym) : Sym(Sym), CU(CU) {} |
Richard Mitton | 21101b3 | 2013-09-19 23:21:01 +0000 | [diff] [blame] | 141 | const MCSymbol *Sym; |
Eric Christopher | 4287a49 | 2013-12-09 23:57:44 +0000 | [diff] [blame] | 142 | DwarfCompileUnit *CU; |
Richard Mitton | 21101b3 | 2013-09-19 23:21:01 +0000 | [diff] [blame] | 143 | }; |
| 144 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 145 | /// \brief Collects and handles dwarf debug information. |
Timur Iskhodzhanov | 1cd1444 | 2013-12-03 15:10:23 +0000 | [diff] [blame] | 146 | class DwarfDebug : public AsmPrinterHandler { |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 147 | // Target of Dwarf emission. |
Chris Lattner | 3a383cb | 2010-04-05 00:13:49 +0000 | [diff] [blame] | 148 | AsmPrinter *Asm; |
Chris Lattner | acda87b | 2010-04-05 05:31:04 +0000 | [diff] [blame] | 149 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 150 | // Collected machine module information. |
Chris Lattner | 3a383cb | 2010-04-05 00:13:49 +0000 | [diff] [blame] | 151 | MachineModuleInfo *MMI; |
| 152 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 153 | // All DIEValues are allocated through this allocator. |
Benjamin Kramer | 0748008 | 2012-06-09 10:34:15 +0000 | [diff] [blame] | 154 | BumpPtrAllocator DIEValueAllocator; |
| 155 | |
Eric Christopher | bfe7d29 | 2013-12-03 22:05:55 +0000 | [diff] [blame] | 156 | // Handle to the compile unit used for the inline extension handling, |
| 157 | // this is just so that the DIEValue allocator has a place to store |
| 158 | // the particular elements. |
| 159 | // FIXME: Store these off of DwarfDebug instead? |
Eric Christopher | 4287a49 | 2013-12-09 23:57:44 +0000 | [diff] [blame] | 160 | DwarfCompileUnit *FirstCU; |
Devang Patel | eb1bb4e | 2011-08-16 22:09:43 +0000 | [diff] [blame] | 161 | |
Eric Christopher | 4287a49 | 2013-12-09 23:57:44 +0000 | [diff] [blame] | 162 | // Maps MDNode with its corresponding DwarfCompileUnit. |
Eric Christopher | 179fba1 | 2014-01-29 22:06:23 +0000 | [diff] [blame] | 163 | MapVector<const MDNode *, DwarfCompileUnit *> CUMap; |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 164 | |
Eric Christopher | 4287a49 | 2013-12-09 23:57:44 +0000 | [diff] [blame] | 165 | // Maps subprogram MDNode with its corresponding DwarfCompileUnit. |
| 166 | DenseMap<const MDNode *, DwarfCompileUnit *> SPMap; |
Devang Patel | eb1bb4e | 2011-08-16 22:09:43 +0000 | [diff] [blame] | 167 | |
Eric Christopher | 4287a49 | 2013-12-09 23:57:44 +0000 | [diff] [blame] | 168 | // Maps a CU DIE with its corresponding DwarfCompileUnit. |
| 169 | DenseMap<const DIE *, DwarfCompileUnit *> CUDieMap; |
Manman Ren | ce20d46 | 2013-10-29 22:57:10 +0000 | [diff] [blame] | 170 | |
Eric Christopher | 47f2be8 | 2014-03-20 19:16:20 +0000 | [diff] [blame] | 171 | /// Maps MDNodes for type system with the corresponding DIEs. These DIEs can |
Manman Ren | 4dbdc90 | 2013-10-31 17:54:35 +0000 | [diff] [blame] | 172 | /// be shared across CUs, that is why we keep the map here instead |
Eric Christopher | 4287a49 | 2013-12-09 23:57:44 +0000 | [diff] [blame] | 173 | /// of in DwarfCompileUnit. |
Manman Ren | 4dbdc90 | 2013-10-31 17:54:35 +0000 | [diff] [blame] | 174 | DenseMap<const MDNode *, DIE *> MDTypeNodeToDieMap; |
| 175 | |
Alexey Samsonov | 4436bf0 | 2013-10-03 08:54:43 +0000 | [diff] [blame] | 176 | // List of all labels used in aranges generation. |
| 177 | std::vector<SymbolCU> ArangeLabels; |
Richard Mitton | 21101b3 | 2013-09-19 23:21:01 +0000 | [diff] [blame] | 178 | |
Richard Mitton | 089ed89 | 2013-09-23 17:56:20 +0000 | [diff] [blame] | 179 | // Size of each symbol emitted (for those symbols that have a specific size). |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 180 | DenseMap<const MCSymbol *, uint64_t> SymSize; |
Richard Mitton | 089ed89 | 2013-09-23 17:56:20 +0000 | [diff] [blame] | 181 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 182 | // Provides a unique id per text section. |
Richard Mitton | 21101b3 | 2013-09-19 23:21:01 +0000 | [diff] [blame] | 183 | typedef DenseMap<const MCSection *, SmallVector<SymbolCU, 8> > SectionMapType; |
| 184 | SectionMapType SectionMap; |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 185 | |
Eric Christopher | aba20dd | 2013-07-08 21:16:18 +0000 | [diff] [blame] | 186 | // List of arguments for current function. |
David Blaikie | afd2c6b | 2014-04-22 05:41:06 +0000 | [diff] [blame] | 187 | SmallVector<DbgVariable *, 8> CurrentFnArguments; |
Devang Patel | 6c622ef | 2011-03-01 22:58:55 +0000 | [diff] [blame] | 188 | |
Devang Patel | 7e62302 | 2011-08-10 20:55:27 +0000 | [diff] [blame] | 189 | LexicalScopes LScopes; |
Devang Patel | 95cd4b9 | 2010-03-25 15:09:44 +0000 | [diff] [blame] | 190 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 191 | // Collection of abstract subprogram DIEs. |
Devang Patel | a37a95e | 2010-07-07 22:20:57 +0000 | [diff] [blame] | 192 | DenseMap<const MDNode *, DIE *> AbstractSPDies; |
| 193 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 194 | // Collection of dbg variables of a scope. |
David Blaikie | afd2c6b | 2014-04-22 05:41:06 +0000 | [diff] [blame] | 195 | typedef DenseMap<LexicalScope *, SmallVector<DbgVariable *, 8> > |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 196 | ScopeVariablesMap; |
Craig Topper | 2b4a201 | 2013-07-03 04:40:27 +0000 | [diff] [blame] | 197 | ScopeVariablesMap ScopeVariables; |
Devang Patel | f6eeaeb | 2009-11-10 23:06:00 +0000 | [diff] [blame] | 198 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 199 | // Collection of abstract variables. |
Devang Patel | 32cc43c | 2010-05-07 20:54:48 +0000 | [diff] [blame] | 200 | DenseMap<const MDNode *, DbgVariable *> AbstractVariables; |
Devang Patel | f6eeaeb | 2009-11-10 23:06:00 +0000 | [diff] [blame] | 201 | |
David Blaikie | 0a456de | 2014-04-02 01:43:18 +0000 | [diff] [blame] | 202 | // Collection of DebugLocEntry. Stored in a linked list so that DIELocLists |
| 203 | // can refer to them in spite of insertions into this list. |
| 204 | SmallVector<DebugLocList, 4> DotDebugLocEntries; |
Devang Patel | 9fc1170 | 2010-05-25 23:40:22 +0000 | [diff] [blame] | 205 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 206 | // Collection of subprogram DIEs that are marked (at the end of the module) |
| 207 | // as DW_AT_inline. |
Devang Patel | f6eeaeb | 2009-11-10 23:06:00 +0000 | [diff] [blame] | 208 | SmallPtrSet<DIE *, 4> InlinedSubprogramDIEs; |
| 209 | |
Eric Christopher | 48fef59 | 2012-12-20 21:58:40 +0000 | [diff] [blame] | 210 | // This is a collection of subprogram MDNodes that are processed to |
| 211 | // create DIEs. |
Devang Patel | f3b2db6 | 2010-06-28 18:25:03 +0000 | [diff] [blame] | 212 | SmallPtrSet<const MDNode *, 16> ProcessedSPNodes; |
| 213 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 214 | // Maps instruction with label emitted before instruction. |
Devang Patel | 6c74a87 | 2010-04-27 19:46:33 +0000 | [diff] [blame] | 215 | DenseMap<const MachineInstr *, MCSymbol *> LabelsBeforeInsn; |
Devang Patel | 3ebd893 | 2010-04-08 16:50:29 +0000 | [diff] [blame] | 216 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 217 | // Maps instruction with label emitted after instruction. |
Devang Patel | 6c74a87 | 2010-04-27 19:46:33 +0000 | [diff] [blame] | 218 | DenseMap<const MachineInstr *, MCSymbol *> LabelsAfterInsn; |
Devang Patel | 3ebd893 | 2010-04-08 16:50:29 +0000 | [diff] [blame] | 219 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 220 | // Every user variable mentioned by a DBG_VALUE instruction in order of |
| 221 | // appearance. |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 222 | SmallVector<const MDNode *, 8> UserVariables; |
Devang Patel | 002d54d | 2010-05-26 19:37:24 +0000 | [diff] [blame] | 223 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 224 | // For each user variable, keep a list of DBG_VALUE instructions in order. |
| 225 | // The list can also contain normal instructions that clobber the previous |
| 226 | // DBG_VALUE. |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 227 | typedef DenseMap<const MDNode *, SmallVector<const MachineInstr *, 4> > |
| 228 | DbgValueHistoryMap; |
Jakob Stoklund Olesen | 9a624fa | 2011-03-26 02:19:36 +0000 | [diff] [blame] | 229 | DbgValueHistoryMap DbgValues; |
Jakob Stoklund Olesen | ec0ac3c | 2011-03-22 22:33:08 +0000 | [diff] [blame] | 230 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 231 | // Previous instruction's location information. This is used to determine |
| 232 | // label location to indicate scope boundries in dwarf debug info. |
Chris Lattner | 915c5f9 | 2010-04-02 19:42:39 +0000 | [diff] [blame] | 233 | DebugLoc PrevInstLoc; |
Devang Patel | 12563b3 | 2010-04-16 23:33:45 +0000 | [diff] [blame] | 234 | MCSymbol *PrevLabel; |
Devang Patel | bd477be | 2010-03-29 17:20:31 +0000 | [diff] [blame] | 235 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 236 | // This location indicates end of function prologue and beginning of function |
| 237 | // body. |
Devang Patel | 34a6620 | 2011-05-11 19:22:19 +0000 | [diff] [blame] | 238 | DebugLoc PrologEndLoc; |
| 239 | |
Timur Iskhodzhanov | 1cd1444 | 2013-12-03 15:10:23 +0000 | [diff] [blame] | 240 | // If nonnull, stores the current machine function we're processing. |
| 241 | const MachineFunction *CurFn; |
| 242 | |
| 243 | // If nonnull, stores the current machine instruction we're processing. |
| 244 | const MachineInstr *CurMI; |
| 245 | |
Eric Christopher | 384f3fe | 2014-03-20 19:16:16 +0000 | [diff] [blame] | 246 | // If nonnull, stores the section that the previous function was allocated to |
| 247 | // emitting. |
| 248 | const MCSection *PrevSection; |
| 249 | |
| 250 | // If nonnull, stores the CU in which the previous subprogram was contained. |
| 251 | const DwarfCompileUnit *PrevCU; |
| 252 | |
Chris Lattner | 6629ca9 | 2010-04-04 22:59:04 +0000 | [diff] [blame] | 253 | // Section Symbols: these are assembler temporary labels that are emitted at |
| 254 | // the beginning of each supported dwarf section. These are used to form |
| 255 | // section offsets and are created by EmitSectionLabels. |
Rafael Espindola | a716096 | 2011-05-06 14:56:22 +0000 | [diff] [blame] | 256 | MCSymbol *DwarfInfoSectionSym, *DwarfAbbrevSectionSym; |
Devang Patel | 12563b3 | 2010-04-16 23:33:45 +0000 | [diff] [blame] | 257 | MCSymbol *DwarfStrSectionSym, *TextSectionSym, *DwarfDebugRangeSectionSym; |
Eric Christopher | 55863be | 2013-04-07 03:43:09 +0000 | [diff] [blame] | 258 | MCSymbol *DwarfDebugLocSectionSym, *DwarfLineSectionSym, *DwarfAddrSectionSym; |
Devang Patel | 9fc1170 | 2010-05-25 23:40:22 +0000 | [diff] [blame] | 259 | MCSymbol *FunctionBeginSym, *FunctionEndSym; |
Eric Christopher | d866720 | 2013-12-30 17:22:27 +0000 | [diff] [blame] | 260 | MCSymbol *DwarfInfoDWOSectionSym, *DwarfAbbrevDWOSectionSym; |
David Blaikie | e12ab12 | 2014-04-01 16:09:49 +0000 | [diff] [blame] | 261 | MCSymbol *DwarfStrDWOSectionSym; |
Eric Christopher | 39eebfa | 2013-09-30 23:14:16 +0000 | [diff] [blame] | 262 | MCSymbol *DwarfGnuPubNamesSectionSym, *DwarfGnuPubTypesSectionSym; |
Devang Patel | 9c160e1 | 2010-07-08 20:10:35 +0000 | [diff] [blame] | 263 | |
Nick Lewycky | d1ee7f8 | 2011-11-02 20:55:33 +0000 | [diff] [blame] | 264 | // As an optimization, there is no need to emit an entry in the directory |
Eric Christopher | 808fd7b | 2013-07-03 01:57:23 +0000 | [diff] [blame] | 265 | // table for the same directory as DW_AT_comp_dir. |
Nick Lewycky | d1ee7f8 | 2011-11-02 20:55:33 +0000 | [diff] [blame] | 266 | StringRef CompilationDir; |
| 267 | |
Eric Christopher | 0f63d06 | 2013-12-03 00:45:45 +0000 | [diff] [blame] | 268 | // Counter for assigning globally unique IDs for ranges. |
| 269 | unsigned GlobalRangeCount; |
| 270 | |
Eric Christopher | c8a310e | 2012-12-10 23:34:43 +0000 | [diff] [blame] | 271 | // Holder for the file specific debug information. |
Eric Christopher | f819485 | 2013-12-05 18:06:10 +0000 | [diff] [blame] | 272 | DwarfFile InfoHolder; |
Eric Christopher | c8a310e | 2012-12-10 23:34:43 +0000 | [diff] [blame] | 273 | |
Eric Christopher | 0aa4a67 | 2012-12-10 22:25:41 +0000 | [diff] [blame] | 274 | // Holders for the various debug information flags that we might need to |
| 275 | // have exposed. See accessor functions below for description. |
| 276 | |
Eric Christopher | 070bf16 | 2013-07-03 01:57:26 +0000 | [diff] [blame] | 277 | // Holder for imported entities. |
| 278 | typedef SmallVector<std::pair<const MDNode *, const MDNode *>, 32> |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 279 | ImportedEntityMap; |
Eric Christopher | 070bf16 | 2013-07-03 01:57:26 +0000 | [diff] [blame] | 280 | ImportedEntityMap ScopesWithImportedEntities; |
| 281 | |
David Blaikie | 47f615e | 2013-12-17 23:32:35 +0000 | [diff] [blame] | 282 | // Map from MDNodes for user-defined types to the type units that describe |
| 283 | // them. |
| 284 | DenseMap<const MDNode *, const DwarfTypeUnit *> DwarfTypeUnits; |
Eric Christopher | 6764643 | 2013-07-26 17:02:41 +0000 | [diff] [blame] | 285 | |
Eric Christopher | 4d36ca0 | 2013-08-26 23:24:35 +0000 | [diff] [blame] | 286 | // Whether to emit the pubnames/pubtypes sections. |
| 287 | bool HasDwarfPubSections; |
| 288 | |
Eric Christopher | 1ad8457 | 2014-01-15 00:04:29 +0000 | [diff] [blame] | 289 | // Whether or not to use AT_ranges for compilation units. |
| 290 | bool HasCURanges; |
| 291 | |
Eric Christopher | 2037caf | 2014-01-28 00:49:26 +0000 | [diff] [blame] | 292 | // Whether we emitted a function into a section other than the default |
| 293 | // text. |
| 294 | bool UsedNonDefaultText; |
| 295 | |
Eric Christopher | 4d36ca0 | 2013-08-26 23:24:35 +0000 | [diff] [blame] | 296 | // Version of dwarf we're emitting. |
| 297 | unsigned DwarfVersion; |
| 298 | |
Eric Christopher | 0a13eb3 | 2013-11-21 22:56:11 +0000 | [diff] [blame] | 299 | // Maps from a type identifier to the actual MDNode. |
| 300 | DITypeIdentifierMap TypeIdentifierMap; |
| 301 | |
Eric Christopher | 42e3994 | 2012-11-29 22:56:13 +0000 | [diff] [blame] | 302 | // DWARF5 Experimental Options |
Eric Christopher | 7b30f2e4 | 2012-11-21 00:34:35 +0000 | [diff] [blame] | 303 | bool HasDwarfAccelTables; |
Eric Christopher | cdf218d | 2012-12-10 19:51:21 +0000 | [diff] [blame] | 304 | bool HasSplitDwarf; |
Manman Ren | ac8062b | 2013-07-02 23:40:10 +0000 | [diff] [blame] | 305 | |
Eric Christopher | d692c1d | 2012-12-11 19:42:09 +0000 | [diff] [blame] | 306 | // Separated Dwarf Variables |
Eric Christopher | d79f548 | 2012-12-10 19:51:13 +0000 | [diff] [blame] | 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. |
| 310 | |
Eric Christopher | 3bf29fd | 2012-12-27 02:14:01 +0000 | [diff] [blame] | 311 | // Holder for the skeleton information. |
Eric Christopher | f819485 | 2013-12-05 18:06:10 +0000 | [diff] [blame] | 312 | DwarfFile SkeletonHolder; |
Eric Christopher | d79f548 | 2012-12-10 19:51:13 +0000 | [diff] [blame] | 313 | |
David Blaikie | 47f4b82 | 2014-03-19 00:11:28 +0000 | [diff] [blame] | 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. |
David Blaikie | 8287aff | 2014-03-18 02:13:23 +0000 | [diff] [blame] | 319 | MCDwarfDwoLineTable SplitTypeUnitFileTable; |
David Blaikie | 4a2f95f | 2014-03-18 01:17:26 +0000 | [diff] [blame] | 320 | |
David Blaikie | 47f4b82 | 2014-03-19 00:11:28 +0000 | [diff] [blame] | 321 | // True iff there are multiple CUs in this module. |
| 322 | bool SingleCU; |
| 323 | |
David Blaikie | d75fb28 | 2014-04-23 21:20:10 +0000 | [diff] [blame^] | 324 | AddressPool AddrPool; |
| 325 | |
David Blaikie | 47f4b82 | 2014-03-19 00:11:28 +0000 | [diff] [blame] | 326 | MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &); |
| 327 | |
David Blaikie | afd2c6b | 2014-04-22 05:41:06 +0000 | [diff] [blame] | 328 | void addScopeVariable(LexicalScope *LS, DbgVariable *Var); |
Devang Patel | f6eeaeb | 2009-11-10 23:06:00 +0000 | [diff] [blame] | 329 | |
David Blaikie | c33b3cd | 2014-04-22 21:27:37 +0000 | [diff] [blame] | 330 | const SmallVectorImpl<std::unique_ptr<DwarfUnit>> &getUnits() { |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 331 | return InfoHolder.getUnits(); |
| 332 | } |
David Blaikie | fd1eff5 | 2013-11-26 19:14:34 +0000 | [diff] [blame] | 333 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 334 | /// \brief Find abstract variable associated with Var. |
Devang Patel | e1c53f2 | 2010-05-20 16:36:41 +0000 | [diff] [blame] | 335 | DbgVariable *findAbstractVariable(DIVariable &Var, DebugLoc Loc); |
Devang Patel | f6eeaeb | 2009-11-10 23:06:00 +0000 | [diff] [blame] | 336 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 337 | /// \brief Find DIE for the given subprogram and attach appropriate |
| 338 | /// DW_AT_low_pc and DW_AT_high_pc attributes. If there are global |
| 339 | /// variables in this scope then create and insert DIEs for these |
| 340 | /// variables. |
David Blaikie | f9b6a55 | 2014-04-22 22:39:41 +0000 | [diff] [blame] | 341 | DIE *updateSubprogramScopeDIE(DwarfCompileUnit &SPCU, DISubprogram SP); |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 342 | |
Eric Christopher | 44e66c1 | 2013-12-03 00:45:56 +0000 | [diff] [blame] | 343 | /// \brief A helper function to check whether the DIE for a given Scope is |
| 344 | /// going to be null. |
Manman Ren | 2312ed3 | 2013-09-10 18:40:41 +0000 | [diff] [blame] | 345 | bool isLexicalScopeDIENull(LexicalScope *Scope); |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 346 | |
Eric Christopher | be2513e | 2013-12-03 00:45:59 +0000 | [diff] [blame] | 347 | /// \brief A helper function to construct a RangeSpanList for a given |
| 348 | /// lexical scope. |
David Blaikie | f9b6a55 | 2014-04-22 22:39:41 +0000 | [diff] [blame] | 349 | void addScopeRangeList(DwarfCompileUnit &TheCU, DIE *ScopeDIE, |
Eric Christopher | be2513e | 2013-12-03 00:45:59 +0000 | [diff] [blame] | 350 | const SmallVectorImpl<InsnRange> &Range); |
| 351 | |
Eric Christopher | 77913e039 | 2013-12-03 00:45:54 +0000 | [diff] [blame] | 352 | /// \brief Construct new DW_TAG_lexical_block for this scope and |
| 353 | /// attach DW_AT_low_pc/DW_AT_high_pc labels. |
David Blaikie | f9b6a55 | 2014-04-22 22:39:41 +0000 | [diff] [blame] | 354 | DIE *constructLexicalScopeDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope); |
Eric Christopher | 77913e039 | 2013-12-03 00:45:54 +0000 | [diff] [blame] | 355 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 356 | /// \brief This scope represents inlined body of a function. Construct |
| 357 | /// DIE to represent this concrete inlined copy of the function. |
David Blaikie | f9b6a55 | 2014-04-22 22:39:41 +0000 | [diff] [blame] | 358 | DIE *constructInlinedScopeDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope); |
Devang Patel | 930143b | 2009-11-21 02:48:08 +0000 | [diff] [blame] | 359 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 360 | /// \brief Construct a DIE for this scope. |
David Blaikie | f9b6a55 | 2014-04-22 22:39:41 +0000 | [diff] [blame] | 361 | DIE *constructScopeDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope); |
Manman Ren | 2312ed3 | 2013-09-10 18:40:41 +0000 | [diff] [blame] | 362 | /// A helper function to create children of a Scope DIE. |
David Blaikie | f9b6a55 | 2014-04-22 22:39:41 +0000 | [diff] [blame] | 363 | DIE *createScopeChildrenDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope, |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 364 | SmallVectorImpl<DIE *> &Children); |
Devang Patel | 930143b | 2009-11-21 02:48:08 +0000 | [diff] [blame] | 365 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 366 | /// \brief Emit initial Dwarf sections with a label at the start of each one. |
Eric Christopher | 7b30f2e4 | 2012-11-21 00:34:35 +0000 | [diff] [blame] | 367 | void emitSectionLabels(); |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 368 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 369 | /// \brief Compute the size and offset of a DIE given an incoming Offset. |
Eric Christopher | 1f0cbb8 | 2012-11-20 22:14:13 +0000 | [diff] [blame] | 370 | unsigned computeSizeAndOffset(DIE *Die, unsigned Offset); |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 371 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 372 | /// \brief Compute the size and offset of all the DIEs. |
Devang Patel | 930143b | 2009-11-21 02:48:08 +0000 | [diff] [blame] | 373 | void computeSizeAndOffsets(); |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 374 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 375 | /// \brief Attach DW_AT_inline attribute with inlined subprogram DIEs. |
Eric Christopher | 960ac37 | 2012-11-22 00:59:49 +0000 | [diff] [blame] | 376 | void computeInlinedDIEs(); |
| 377 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 378 | /// \brief Collect info for variables that were optimized out. |
Eric Christopher | 960ac37 | 2012-11-22 00:59:49 +0000 | [diff] [blame] | 379 | void collectDeadVariables(); |
| 380 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 381 | /// \brief Finish off debug information after all functions have been |
| 382 | /// processed. |
Eric Christopher | 960ac37 | 2012-11-22 00:59:49 +0000 | [diff] [blame] | 383 | void finalizeModuleInfo(); |
| 384 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 385 | /// \brief Emit labels to close any remaining sections that have been left |
| 386 | /// open. |
Eric Christopher | 960ac37 | 2012-11-22 00:59:49 +0000 | [diff] [blame] | 387 | void endSections(); |
| 388 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 389 | /// \brief Emit the debug info section. |
Devang Patel | 930143b | 2009-11-21 02:48:08 +0000 | [diff] [blame] | 390 | void emitDebugInfo(); |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 391 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 392 | /// \brief Emit the abbreviation section. |
Eric Christopher | 3837195 | 2012-11-20 23:30:11 +0000 | [diff] [blame] | 393 | void emitAbbreviations(); |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 394 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 395 | /// \brief Emit the last address of the section and the end of |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 396 | /// the line matrix. |
Devang Patel | 930143b | 2009-11-21 02:48:08 +0000 | [diff] [blame] | 397 | void emitEndOfLineMatrix(unsigned SectionEnd); |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 398 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 399 | /// \brief Emit visible names into a hashed accelerator table section. |
Eric Christopher | 4996c70 | 2011-11-07 09:24:32 +0000 | [diff] [blame] | 400 | void emitAccelNames(); |
Eric Christopher | 27527b2 | 2012-11-21 00:03:28 +0000 | [diff] [blame] | 401 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 402 | /// \brief Emit objective C classes and categories into a hashed |
Eric Christopher | 4996c70 | 2011-11-07 09:24:32 +0000 | [diff] [blame] | 403 | /// accelerator table section. |
| 404 | void emitAccelObjC(); |
| 405 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 406 | /// \brief Emit namespace dies into a hashed accelerator table. |
Eric Christopher | 4996c70 | 2011-11-07 09:24:32 +0000 | [diff] [blame] | 407 | void emitAccelNamespaces(); |
| 408 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 409 | /// \brief Emit type dies into a hashed accelerator table. |
Eric Christopher | 4996c70 | 2011-11-07 09:24:32 +0000 | [diff] [blame] | 410 | void emitAccelTypes(); |
Eric Christopher | 27527b2 | 2012-11-21 00:03:28 +0000 | [diff] [blame] | 411 | |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 412 | /// \brief Emit visible names into a debug pubnames section. |
Eric Christopher | dd1a012 | 2013-09-13 00:35:05 +0000 | [diff] [blame] | 413 | /// \param GnuStyle determines whether or not we want to emit |
| 414 | /// additional information into the table ala newer gcc for gdb |
| 415 | /// index. |
| 416 | void emitDebugPubNames(bool GnuStyle = false); |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 417 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 418 | /// \brief Emit visible types into a debug pubtypes section. |
Eric Christopher | dd1a012 | 2013-09-13 00:35:05 +0000 | [diff] [blame] | 419 | /// \param GnuStyle determines whether or not we want to emit |
| 420 | /// additional information into the table ala newer gcc for gdb |
| 421 | /// index. |
| 422 | void emitDebugPubTypes(bool GnuStyle = false); |
Devang Patel | 04d2f2d | 2009-11-24 01:14:22 +0000 | [diff] [blame] | 423 | |
David Blaikie | 0f55e83 | 2014-03-11 23:18:15 +0000 | [diff] [blame] | 424 | void |
| 425 | emitDebugPubSection(bool GnuStyle, const MCSection *PSec, StringRef Name, |
| 426 | const StringMap<const DIE *> &(DwarfUnit::*Accessor)() |
| 427 | const); |
| 428 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 429 | /// \brief Emit visible names into a debug str section. |
Devang Patel | 930143b | 2009-11-21 02:48:08 +0000 | [diff] [blame] | 430 | void emitDebugStr(); |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 431 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 432 | /// \brief Emit visible names into a debug loc section. |
Devang Patel | 930143b | 2009-11-21 02:48:08 +0000 | [diff] [blame] | 433 | void emitDebugLoc(); |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 434 | |
David Blaikie | 94c1d7f | 2014-04-02 01:50:20 +0000 | [diff] [blame] | 435 | /// \brief Emit visible names into a debug loc dwo section. |
| 436 | void emitDebugLocDWO(); |
| 437 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 438 | /// \brief Emit visible names into a debug aranges section. |
Eric Christopher | 7b30f2e4 | 2012-11-21 00:34:35 +0000 | [diff] [blame] | 439 | void emitDebugARanges(); |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 440 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 441 | /// \brief Emit visible names into a debug ranges section. |
Devang Patel | 930143b | 2009-11-21 02:48:08 +0000 | [diff] [blame] | 442 | void emitDebugRanges(); |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 443 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 444 | /// \brief Emit inline info using custom format. |
Devang Patel | 930143b | 2009-11-21 02:48:08 +0000 | [diff] [blame] | 445 | void emitDebugInlineInfo(); |
Bill Wendling | 2b128d7 | 2009-05-20 23:19:06 +0000 | [diff] [blame] | 446 | |
Eric Christopher | cdf218d | 2012-12-10 19:51:21 +0000 | [diff] [blame] | 447 | /// DWARF 5 Experimental Split Dwarf Emitters |
Eric Christopher | 9c2ecd9 | 2012-11-30 23:59:06 +0000 | [diff] [blame] | 448 | |
David Blaikie | 38fe634 | 2014-01-09 04:28:46 +0000 | [diff] [blame] | 449 | /// \brief Initialize common features of skeleton units. |
David Blaikie | f9b6a55 | 2014-04-22 22:39:41 +0000 | [diff] [blame] | 450 | void initSkeletonUnit(const DwarfUnit &U, DIE *Die, |
| 451 | std::unique_ptr<DwarfUnit> NewU); |
David Blaikie | 38fe634 | 2014-01-09 04:28:46 +0000 | [diff] [blame] | 452 | |
Eric Christopher | cdf218d | 2012-12-10 19:51:21 +0000 | [diff] [blame] | 453 | /// \brief Construct the split debug info compile unit for the debug info |
| 454 | /// section. |
David Blaikie | f9b6a55 | 2014-04-22 22:39:41 +0000 | [diff] [blame] | 455 | DwarfCompileUnit &constructSkeletonCU(const DwarfCompileUnit &CU); |
Eric Christopher | 9c2ecd9 | 2012-11-30 23:59:06 +0000 | [diff] [blame] | 456 | |
David Blaikie | 15ed5eb | 2014-01-10 01:38:41 +0000 | [diff] [blame] | 457 | /// \brief Construct the split debug info compile unit for the debug info |
| 458 | /// section. |
David Blaikie | f9b6a55 | 2014-04-22 22:39:41 +0000 | [diff] [blame] | 459 | DwarfTypeUnit &constructSkeletonTU(DwarfTypeUnit &TU); |
David Blaikie | 15ed5eb | 2014-01-10 01:38:41 +0000 | [diff] [blame] | 460 | |
Eric Christopher | 9c2ecd9 | 2012-11-30 23:59:06 +0000 | [diff] [blame] | 461 | /// \brief Emit the debug info dwo section. |
| 462 | void emitDebugInfoDWO(); |
| 463 | |
Eric Christopher | 3c5a191 | 2012-12-19 22:02:53 +0000 | [diff] [blame] | 464 | /// \brief Emit the debug abbrev dwo section. |
| 465 | void emitDebugAbbrevDWO(); |
| 466 | |
David Blaikie | 4a2f95f | 2014-03-18 01:17:26 +0000 | [diff] [blame] | 467 | /// \brief Emit the debug line dwo section. |
| 468 | void emitDebugLineDWO(); |
| 469 | |
Eric Christopher | 3bf29fd | 2012-12-27 02:14:01 +0000 | [diff] [blame] | 470 | /// \brief Emit the debug str dwo section. |
| 471 | void emitDebugStrDWO(); |
| 472 | |
David Blaikie | 3c84262 | 2013-12-04 21:31:26 +0000 | [diff] [blame] | 473 | /// Flags to let the linker know we have emitted new style pubnames. Only |
| 474 | /// emit it here if we don't have a skeleton CU for split dwarf. |
David Blaikie | f9b6a55 | 2014-04-22 22:39:41 +0000 | [diff] [blame] | 475 | void addGnuPubAttributes(DwarfUnit &U, DIE *D) const; |
David Blaikie | 3c84262 | 2013-12-04 21:31:26 +0000 | [diff] [blame] | 476 | |
Eric Christopher | 4287a49 | 2013-12-09 23:57:44 +0000 | [diff] [blame] | 477 | /// \brief Create new DwarfCompileUnit for the given metadata node with tag |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 478 | /// DW_TAG_compile_unit. |
David Blaikie | f9b6a55 | 2014-04-22 22:39:41 +0000 | [diff] [blame] | 479 | DwarfCompileUnit &constructDwarfCompileUnit(DICompileUnit DIUnit); |
Devang Patel | 1a0df9a | 2010-05-10 22:49:55 +0000 | [diff] [blame] | 480 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 481 | /// \brief Construct subprogram DIE. |
David Blaikie | f9b6a55 | 2014-04-22 22:39:41 +0000 | [diff] [blame] | 482 | void constructSubprogramDIE(DwarfCompileUnit &TheCU, const MDNode *N); |
Bill Wendling | 2b128d7 | 2009-05-20 23:19:06 +0000 | [diff] [blame] | 483 | |
David Blaikie | 1fd4365 | 2013-05-07 21:35:53 +0000 | [diff] [blame] | 484 | /// \brief Construct imported_module or imported_declaration DIE. |
David Blaikie | f9b6a55 | 2014-04-22 22:39:41 +0000 | [diff] [blame] | 485 | void constructImportedEntityDIE(DwarfCompileUnit &TheCU, const MDNode *N); |
David Blaikie | f55abea | 2013-04-22 06:12:31 +0000 | [diff] [blame] | 486 | |
David Blaikie | 684fc53 | 2013-05-06 23:33:07 +0000 | [diff] [blame] | 487 | /// \brief Construct import_module DIE. |
David Blaikie | f9b6a55 | 2014-04-22 22:39:41 +0000 | [diff] [blame] | 488 | void constructImportedEntityDIE(DwarfCompileUnit &TheCU, const MDNode *N, |
David Blaikie | 684fc53 | 2013-05-06 23:33:07 +0000 | [diff] [blame] | 489 | DIE *Context); |
| 490 | |
| 491 | /// \brief Construct import_module DIE. |
David Blaikie | f9b6a55 | 2014-04-22 22:39:41 +0000 | [diff] [blame] | 492 | void constructImportedEntityDIE(DwarfCompileUnit &TheCU, |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 493 | const DIImportedEntity &Module, DIE *Context); |
David Blaikie | 684fc53 | 2013-05-06 23:33:07 +0000 | [diff] [blame] | 494 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 495 | /// \brief Register a source line with debug info. Returns the unique |
| 496 | /// label that was emitted and which provides correspondence to the |
| 497 | /// source line list. |
Devang Patel | 34a6620 | 2011-05-11 19:22:19 +0000 | [diff] [blame] | 498 | void recordSourceLine(unsigned Line, unsigned Col, const MDNode *Scope, |
| 499 | unsigned Flags); |
Eric Christopher | 27527b2 | 2012-11-21 00:03:28 +0000 | [diff] [blame] | 500 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 501 | /// \brief Indentify instructions that are marking the beginning of or |
| 502 | /// ending of a scope. |
Devang Patel | 359b013 | 2010-04-08 18:43:56 +0000 | [diff] [blame] | 503 | void identifyScopeMarkers(); |
Devang Patel | f1d5a1e | 2010-04-08 15:37:09 +0000 | [diff] [blame] | 504 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 505 | /// \brief If Var is an current function argument that add it in |
| 506 | /// CurrentFnArguments list. |
David Blaikie | afd2c6b | 2014-04-22 05:41:06 +0000 | [diff] [blame] | 507 | bool addCurrentFnArgument(DbgVariable *Var, LexicalScope *Scope); |
Devang Patel | 6c622ef | 2011-03-01 22:58:55 +0000 | [diff] [blame] | 508 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 509 | /// \brief Populate LexicalScope entries with variables' info. |
Timur Iskhodzhanov | 1cd1444 | 2013-12-03 15:10:23 +0000 | [diff] [blame] | 510 | void collectVariableInfo(SmallPtrSet<const MDNode *, 16> &ProcessedVars); |
Eric Christopher | 27527b2 | 2012-11-21 00:03:28 +0000 | [diff] [blame] | 511 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 512 | /// \brief Collect variable information from the side table maintained |
| 513 | /// by MMI. |
Timur Iskhodzhanov | 1cd1444 | 2013-12-03 15:10:23 +0000 | [diff] [blame] | 514 | void collectVariableInfoFromMMITable(SmallPtrSet<const MDNode *, 16> &P); |
Jakob Stoklund Olesen | 9a624fa | 2011-03-26 02:19:36 +0000 | [diff] [blame] | 515 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 516 | /// \brief Ensure that a label will be emitted before MI. |
Jakob Stoklund Olesen | 9a624fa | 2011-03-26 02:19:36 +0000 | [diff] [blame] | 517 | void requestLabelBeforeInsn(const MachineInstr *MI) { |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 518 | LabelsBeforeInsn.insert(std::make_pair(MI, (MCSymbol *)0)); |
Jakob Stoklund Olesen | 9a624fa | 2011-03-26 02:19:36 +0000 | [diff] [blame] | 519 | } |
| 520 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 521 | /// \brief Return Label preceding the instruction. |
Eric Christopher | 962c908 | 2013-01-15 23:56:56 +0000 | [diff] [blame] | 522 | MCSymbol *getLabelBeforeInsn(const MachineInstr *MI); |
Jakob Stoklund Olesen | 9a624fa | 2011-03-26 02:19:36 +0000 | [diff] [blame] | 523 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 524 | /// \brief Ensure that a label will be emitted after MI. |
Jakob Stoklund Olesen | 9a624fa | 2011-03-26 02:19:36 +0000 | [diff] [blame] | 525 | void requestLabelAfterInsn(const MachineInstr *MI) { |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 526 | LabelsAfterInsn.insert(std::make_pair(MI, (MCSymbol *)0)); |
Jakob Stoklund Olesen | 9a624fa | 2011-03-26 02:19:36 +0000 | [diff] [blame] | 527 | } |
| 528 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 529 | /// \brief Return Label immediately following the instruction. |
Eric Christopher | 962c908 | 2013-01-15 23:56:56 +0000 | [diff] [blame] | 530 | MCSymbol *getLabelAfterInsn(const MachineInstr *MI); |
Jakob Stoklund Olesen | 9a624fa | 2011-03-26 02:19:36 +0000 | [diff] [blame] | 531 | |
David Blaikie | f9b6a55 | 2014-04-22 22:39:41 +0000 | [diff] [blame] | 532 | void attachLowHighPC(DwarfCompileUnit &Unit, DIE *D, MCSymbol *Begin, |
David Blaikie | 4bd13b7 | 2014-03-07 18:49:45 +0000 | [diff] [blame] | 533 | MCSymbol *End); |
| 534 | |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 535 | public: |
| 536 | //===--------------------------------------------------------------------===// |
| 537 | // Main entry points. |
| 538 | // |
Chris Lattner | f0d6bd3 | 2010-04-05 05:11:15 +0000 | [diff] [blame] | 539 | DwarfDebug(AsmPrinter *A, Module *M); |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 540 | |
Manman Ren | 4dbdc90 | 2013-10-31 17:54:35 +0000 | [diff] [blame] | 541 | void insertDIE(const MDNode *TypeMD, DIE *Die) { |
| 542 | MDTypeNodeToDieMap.insert(std::make_pair(TypeMD, Die)); |
| 543 | } |
| 544 | DIE *getDIE(const MDNode *TypeMD) { |
| 545 | return MDTypeNodeToDieMap.lookup(TypeMD); |
| 546 | } |
| 547 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 548 | /// \brief Emit all Dwarf sections that should come prior to the |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 549 | /// content. |
Eric Christopher | 58f4195 | 2012-11-19 22:42:15 +0000 | [diff] [blame] | 550 | void beginModule(); |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 551 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 552 | /// \brief Emit all Dwarf sections that should come after the content. |
Craig Topper | 7b883b3 | 2014-03-08 06:31:39 +0000 | [diff] [blame] | 553 | void endModule() override; |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 554 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 555 | /// \brief Gather pre-function debug information. |
Craig Topper | 7b883b3 | 2014-03-08 06:31:39 +0000 | [diff] [blame] | 556 | void beginFunction(const MachineFunction *MF) override; |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 557 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 558 | /// \brief Gather and emit post-function debug information. |
Craig Topper | 7b883b3 | 2014-03-08 06:31:39 +0000 | [diff] [blame] | 559 | void endFunction(const MachineFunction *MF) override; |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 560 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 561 | /// \brief Process beginning of an instruction. |
Craig Topper | 7b883b3 | 2014-03-08 06:31:39 +0000 | [diff] [blame] | 562 | void beginInstruction(const MachineInstr *MI) override; |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 563 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 564 | /// \brief Process end of an instruction. |
Craig Topper | 7b883b3 | 2014-03-08 06:31:39 +0000 | [diff] [blame] | 565 | void endInstruction() override; |
Devang Patel | f20c4f7 | 2011-04-12 22:53:02 +0000 | [diff] [blame] | 566 | |
Eric Christopher | 6764643 | 2013-07-26 17:02:41 +0000 | [diff] [blame] | 567 | /// \brief Add a DIE to the set of types that we're going to pull into |
| 568 | /// type units. |
David Blaikie | 15632ae | 2014-02-12 00:31:30 +0000 | [diff] [blame] | 569 | void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier, |
David Blaikie | f645f96 | 2014-01-09 03:23:41 +0000 | [diff] [blame] | 570 | DIE *Die, DICompositeType CTy); |
Eric Christopher | 6764643 | 2013-07-26 17:02:41 +0000 | [diff] [blame] | 571 | |
Richard Mitton | 21101b3 | 2013-09-19 23:21:01 +0000 | [diff] [blame] | 572 | /// \brief Add a label so that arange data can be generated for it. |
Alexey Samsonov | 4436bf0 | 2013-10-03 08:54:43 +0000 | [diff] [blame] | 573 | void addArangeLabel(SymbolCU SCU) { ArangeLabels.push_back(SCU); } |
Richard Mitton | 21101b3 | 2013-09-19 23:21:01 +0000 | [diff] [blame] | 574 | |
Richard Mitton | 089ed89 | 2013-09-23 17:56:20 +0000 | [diff] [blame] | 575 | /// \brief For symbols that have a size designated (e.g. common symbols), |
| 576 | /// this tracks that size. |
Craig Topper | 7b883b3 | 2014-03-08 06:31:39 +0000 | [diff] [blame] | 577 | void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override { |
Eric Christopher | a5a7942 | 2013-12-09 23:32:48 +0000 | [diff] [blame] | 578 | SymSize[Sym] = Size; |
| 579 | } |
Richard Mitton | 089ed89 | 2013-09-23 17:56:20 +0000 | [diff] [blame] | 580 | |
Eric Christopher | a2de826 | 2012-12-15 00:04:07 +0000 | [diff] [blame] | 581 | /// \brief Recursively Emits a debug information entry. |
David Blaikie | b818418 | 2014-04-14 22:45:02 +0000 | [diff] [blame] | 582 | void emitDIE(DIE &Die); |
Eric Christopher | a2de826 | 2012-12-15 00:04:07 +0000 | [diff] [blame] | 583 | |
Eric Christopher | 55c5181 | 2012-11-21 00:03:31 +0000 | [diff] [blame] | 584 | // Experimental DWARF5 features. |
| 585 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 586 | /// \brief Returns whether or not to emit tables that dwarf consumers can |
| 587 | /// use to accelerate lookup. |
Eric Christopher | 411bd59 | 2014-03-06 00:00:53 +0000 | [diff] [blame] | 588 | bool useDwarfAccelTables() const { return HasDwarfAccelTables; } |
Eric Christopher | 55c5181 | 2012-11-21 00:03:31 +0000 | [diff] [blame] | 589 | |
Eric Christopher | acdcbdb | 2012-11-27 22:43:45 +0000 | [diff] [blame] | 590 | /// \brief Returns whether or not to change the current debug info for the |
Eric Christopher | cdf218d | 2012-12-10 19:51:21 +0000 | [diff] [blame] | 591 | /// split dwarf proposal support. |
Eric Christopher | 411bd59 | 2014-03-06 00:00:53 +0000 | [diff] [blame] | 592 | bool useSplitDwarf() const { return HasSplitDwarf; } |
Manman Ren | ac8062b | 2013-07-02 23:40:10 +0000 | [diff] [blame] | 593 | |
| 594 | /// Returns the Dwarf Version. |
| 595 | unsigned getDwarfVersion() const { return DwarfVersion; } |
Manman Ren | 6035203 | 2013-09-05 18:48:31 +0000 | [diff] [blame] | 596 | |
Eric Christopher | a27220f | 2014-03-05 22:41:20 +0000 | [diff] [blame] | 597 | /// Returns the section symbol for the .debug_loc section. |
| 598 | MCSymbol *getDebugLocSym() const { return DwarfDebugLocSectionSym; } |
| 599 | |
Eric Christopher | 384f3fe | 2014-03-20 19:16:16 +0000 | [diff] [blame] | 600 | /// Returns the previous section that was emitted into. |
| 601 | const MCSection *getPrevSection() const { return PrevSection; } |
| 602 | |
| 603 | /// Returns the previous CU that was being updated |
| 604 | const DwarfCompileUnit *getPrevCU() const { return PrevCU; } |
| 605 | |
Eric Christopher | 4f17ee0 | 2014-03-08 00:29:41 +0000 | [diff] [blame] | 606 | /// Returns the entries for the .debug_loc section. |
David Blaikie | 0a456de | 2014-04-02 01:43:18 +0000 | [diff] [blame] | 607 | const SmallVectorImpl<DebugLocList> & |
David Blaikie | 84d8e18 | 2014-03-24 22:38:38 +0000 | [diff] [blame] | 608 | getDebugLocEntries() const { |
Eric Christopher | 4f17ee0 | 2014-03-08 00:29:41 +0000 | [diff] [blame] | 609 | return DotDebugLocEntries; |
| 610 | } |
| 611 | |
| 612 | /// \brief Emit an entry for the debug loc section. This can be used to |
| 613 | /// handle an entry that's going to be emitted into the debug loc section. |
Eric Christopher | 05135fb | 2014-03-18 02:18:24 +0000 | [diff] [blame] | 614 | void emitDebugLocEntry(ByteStreamer &Streamer, const DebugLocEntry &Entry); |
Eric Christopher | 4f17ee0 | 2014-03-08 00:29:41 +0000 | [diff] [blame] | 615 | |
David Blaikie | 0e84adc | 2014-04-01 16:17:41 +0000 | [diff] [blame] | 616 | /// Emit the location for a debug loc entry, including the size header. |
| 617 | void emitDebugLocEntryLocation(const DebugLocEntry &Entry); |
| 618 | |
Eric Christopher | 87b9c49 | 2013-10-05 00:32:34 +0000 | [diff] [blame] | 619 | /// Find the MDNode for the given reference. |
| 620 | template <typename T> T resolve(DIRef<T> Ref) const { |
Manman Ren | 34b3dcc | 2013-09-10 18:30:07 +0000 | [diff] [blame] | 621 | return Ref.resolve(TypeIdentifierMap); |
| 622 | } |
Manman Ren | 6035203 | 2013-09-05 18:48:31 +0000 | [diff] [blame] | 623 | |
Adrian Prantl | 1a1647c | 2014-03-18 02:34:58 +0000 | [diff] [blame] | 624 | /// \brief Return the TypeIdentifierMap. |
Eric Christopher | c0bd5f8 | 2014-03-18 20:39:54 +0000 | [diff] [blame] | 625 | const DITypeIdentifierMap &getTypeIdentifierMap() const { |
Adrian Prantl | 1a1647c | 2014-03-18 02:34:58 +0000 | [diff] [blame] | 626 | return TypeIdentifierMap; |
| 627 | } |
| 628 | |
Eric Christopher | dd50838 | 2014-03-06 00:00:56 +0000 | [diff] [blame] | 629 | /// Find the DwarfCompileUnit for the given CU Die. |
| 630 | DwarfCompileUnit *lookupUnit(const DIE *CU) const { |
| 631 | return CUDieMap.lookup(CU); |
| 632 | } |
Manman Ren | 3eb9dff | 2013-09-09 19:05:21 +0000 | [diff] [blame] | 633 | /// isSubprogramContext - Return true if Context is either a subprogram |
| 634 | /// or another context nested inside a subprogram. |
| 635 | bool isSubprogramContext(const MDNode *Context); |
David Blaikie | d75fb28 | 2014-04-23 21:20:10 +0000 | [diff] [blame^] | 636 | |
| 637 | AddressPool &getAddressPool() { return AddrPool; } |
Devang Patel | f6eeaeb | 2009-11-10 23:06:00 +0000 | [diff] [blame] | 638 | }; |
Bill Wendling | 2f921f8 | 2009-05-15 09:23:25 +0000 | [diff] [blame] | 639 | } // End of namespace llvm |
| 640 | |
| 641 | #endif |