14 #ifndef CODEGEN_ASMPRINTER_DWARFDEBUG_H__
15 #define CODEGEN_ASMPRINTER_DWARFDEBUG_H__
36 class MachineFrameInfo;
37 class MachineModuleInfo;
54 : Line(L), Column(C), SourceID(S), Label(label) {}
77 enum EntryType EntryKind;
100 : Begin(B), End(E), Loc(L), Variable(V), Merged(
false) {
102 EntryKind = E_Location;
105 : Begin(B), End(E), Variable(0), Merged(
false) {
107 EntryKind = E_Integer;
110 : Begin(B), End(E), Variable(0), Merged(
false) {
111 Constants.CFP = FPtr;
112 EntryKind = E_ConstantFP;
116 : Begin(B), End(E), Variable(0), Merged(
false) {
117 Constants.CIP = IPtr;
118 EntryKind = E_ConstantInt;
123 bool isEmpty() {
return Begin == 0 && End == 0; }
126 if (!(Begin && Loc == Next->Loc && End == Next->Begin))
132 bool isInt()
const {
return EntryKind == E_Integer; }
135 int64_t
getInt()
const {
return Constants.Int; }
149 unsigned DotDebugLocOffset;
157 : Var(V), TheDIE(0), DotDebugLocOffset(~0U), AbsVar(AV), MInsn(0),
158 FrameIndex(~0), DD(DD) {}
174 if (Var.
getTag() == dwarf::DW_TAG_arg_variable)
175 return dwarf::DW_TAG_formal_parameter;
177 return dwarf::DW_TAG_variable;
197 assert(Var.
isVariable() &&
"Invalid complex DbgVariable!");
201 assert(Var.
isVariable() &&
"Invalid complex DbgVariable!");
205 assert(Var.
isVariable() &&
"Invalid complex DbgVariable!");
216 template <
typename T>
T resolve(
DIRef<T> Ref)
const;
229 std::vector<DIEAbbrev *> &Abbreviations;
240 unsigned NextStringPoolNumber;
241 std::string StringPref;
248 unsigned NextAddrPoolNumber;
252 std::vector<DIEAbbrev *> &
A,
const char *Pref,
254 : Asm(AP), AbbreviationsSet(AS), Abbreviations(A),
StringPool(DA),
255 NextStringPoolNumber(0), StringPref(Pref), AddressPool(),
256 NextAddrPoolNumber(0) {}
344 std::vector<DIEAbbrev *> Abbreviations;
353 std::vector<SymbolCU> ArangeLabels;
420 MCSymbol *DwarfInfoSectionSym, *DwarfAbbrevSectionSym;
421 MCSymbol *DwarfStrSectionSym, *TextSectionSym, *DwarfDebugRangeSectionSym;
422 MCSymbol *DwarfDebugLocSectionSym, *DwarfLineSectionSym, *DwarfAddrSectionSym;
423 MCSymbol *FunctionBeginSym, *FunctionEndSym;
424 MCSymbol *DwarfAbbrevDWOSectionSym, *DwarfStrDWOSectionSym;
425 MCSymbol *DwarfGnuPubNamesSectionSym, *DwarfGnuPubTypesSectionSym;
432 unsigned GlobalCUIndexCount;
446 std::vector<DIE *> TypeUnits;
449 bool HasDwarfPubSections;
452 unsigned DwarfVersion;
455 bool HasDwarfAccelTables;
470 std::vector<DIEAbbrev *> SkeletonAbbrevs;
509 void emitSectionLabels();
512 unsigned computeSizeAndOffset(
DIE *Die,
unsigned Offset);
515 void computeSizeAndOffsets();
518 void computeInlinedDIEs();
521 void collectDeadVariables();
525 void finalizeModuleInfo();
532 void emitAbbrevs(
const MCSection *, std::vector<DIEAbbrev*> *);
535 void emitDebugInfo();
538 void emitAbbreviations();
542 void emitEndOfLineMatrix(
unsigned SectionEnd);
545 void emitAccelNames();
549 void emitAccelObjC();
552 void emitAccelNamespaces();
555 void emitAccelTypes();
561 void emitDebugPubNames(
bool GnuStyle =
false);
567 void emitDebugPubTypes(
bool GnuStyle =
false);
576 void emitDebugARanges();
579 void emitDebugRanges();
582 void emitDebugMacInfo();
585 void emitDebugInlineInfo();
594 void emitSkeletonAbbrevs(
const MCSection *);
597 void emitDebugInfoDWO();
600 void emitDebugAbbrevDWO();
603 void emitDebugStrDWO();
620 void constructImportedEntityDIE(
CompileUnit *TheCU,
627 void recordSourceLine(
unsigned Line,
unsigned Col,
const MDNode *Scope,
632 void identifyScopeMarkers();
650 LabelsBeforeInsn.insert(std::make_pair(MI, (
MCSymbol*)0));
658 LabelsAfterInsn.insert(std::make_pair(MI, (
MCSymbol*)0));
671 MDTypeNodeToDieMap.insert(std::make_pair(TypeMD, Die));
674 return MDTypeNodeToDieMap.lookup(TypeMD);
731 return Ref.
resolve(TypeIdentifierMap);
bool isBlockByrefVariable() const
DbgVariable * getAbstractVariable() const
AddrPool * getAddrPool()
Returns the address pool.
const MachineInstr * getMInsn() const
bool isArtificial() const
bool isVariable() const
isVariable - Return true if the specified tag is legal for DIVariable.
bool useDwarfAccelTables()
Returns whether or not to emit tables that dwarf consumers can use to accelerate lookup.
The main container class for the LLVM Intermediate Representation.
DbgVariable(DIVariable V, DbgVariable *AV, DwarfDebug *DD)
DwarfUnits(AsmPrinter *AP, FoldingSet< DIEAbbrev > *AS, std::vector< DIEAbbrev * > &A, const char *Pref, BumpPtrAllocator &DA)
void endFunction(const MachineFunction *MF)
Gather and emit post-function debug information.
SrcLineInfo(unsigned L, unsigned C, unsigned S, MCSymbol *label)
Collects and handles dwarf debug information.
void setFrameIndex(int FI)
Collects and handles information specific to a particular collection of units.
DIE * getDIE(const MDNode *TypeMD)
const MDNode * getVariable() const
MDNode - a tuple of other values.
StringRef getName() const
void endInstruction(const MachineInstr *MI)
Process end of an instruction.
bool isObjectPointer() const
MachineLocation getLoc() const
SymbolCU(CompileUnit *CU, const MCSymbol *Sym)
void emitAddresses(const MCSection *AddrSection)
Emit all of the addresses to the section given.
void addArangeLabel(SymbolCU SCU)
Add a label so that arange data can be generated for it.
uint64_t getAddrElement(unsigned Idx) const
unsigned getNumAddrElements() const
bool isArtificial() const
Return true if DbgVariable is artificial.
This class is used to record source line correspondence.
const ConstantInt * getConstantInt() const
StringRef getName() const
int getFrameIndex() const
DISubprogram - This is a wrapper for a subprogram (e.g. a function).
This class is used to track local variable information.
unsigned getOrCreateSourceID(StringRef DirName, StringRef FullName, unsigned CUID)
Look up the source id with the given directory and source file names. If none currently exists...
DIVariable getVariable() const
bool isArtificial() const
isArtificial - Return true if this variable is marked as "artificial".
bool hasComplexAddress() const
HasComplexAddr - Return true if the variable has a complex address.
DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, const ConstantFP *FPtr)
unsigned getDotDebugLocOffset() const
unsigned getSourceID() const
void Merge(DotDebugLocEntry *Next)
void addUnit(CompileUnit *CU)
Add a unit to the list of CUs.
This struct describes location entries emitted in the .debug_loc section.
void computeSizeAndOffsets()
Compute the size and offset of all the DIEs.
void assignAbbrevNumber(DIEAbbrev &Abbrev)
Define a unique number for the abbreviation.
MCSymbol * getLabel() const
unsigned getNumAddrElements() const
bool variableHasComplexAddress() const
const MCSymbol * getBeginSym() const
DwarfDebug(AsmPrinter *A, Module *M)
const MCSymbol * getEndSym() const
Helper used to pair up a symbol and its DWARF compile unit.
bool isObjectPointer() const
An imported module (C++ using directive or similar).
T resolve(const DITypeIdentifierMap &Map) const
bool isConstantFP() const
Class for constant integers.
unsigned getColumn() const
unsigned getStringPoolIndex(StringRef Str)
Returns the index into the string pool with the given string text.
void beginModule()
Emit all Dwarf sections that should come prior to the content.
bool isSubprogramContext(const MDNode *Context)
T resolve(DIRef< T > Ref) const
Find the MDNode for the given reference.
void emitStrings(const MCSection *StrSection, const MCSection *OffsetSection, const MCSymbol *StrSecSym)
Emit all of the strings to the section given.
StrPool * getStringPool()
Returns the string pool.
bool isConstantInt() const
uint64_t getAddrElement(unsigned i) const
MCSymbol * getStringPoolSym()
Returns the entry into the start of the pool.
void setDotDebugLocOffset(unsigned O)
unsigned getAddrPoolIndex(const MCExpr *Sym)
Returns the index into the address pool with the given label/symbol.
void insertDIE(const MDNode *TypeMD, DIE *Die)
MCSymbol * getStringPoolEntry(StringRef Str)
Returns an entry into the string pool with the given string text.
bool isEmpty()
Empty entries are also used as a trigger to emit temp label. Such labels are referenced is used to fi...
bool isBlockByrefVariable() const
bool useSplitDwarf()
Returns whether or not to change the current debug info for the split dwarf proposal support...
void setMInsn(const MachineInstr *M)
DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, MachineLocation &L, const MDNode *V)
bool isObjectPointer() const
unsigned computeSizeAndOffset(DIE *Die, unsigned Offset)
Compute the size and offset of a DIE given an incoming Offset.
void beginInstruction(const MachineInstr *MI)
Process beginning of an instruction.
void emitUnits(DwarfDebug *DD, const MCSection *USection, const MCSection *ASection, const MCSymbol *ASectionSym)
Emit all of the units to the section listed with the given abbreviation section.
DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, int64_t i)
DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, const ConstantInt *IPtr)
DICompileUnit - A wrapper for a compile unit.
const ConstantFP * getConstantFP() const
unsigned getDwarfVersion() const
Returns the Dwarf Version.
void addTypeUnitType(DIE *Die)
Add a DIE to the set of types that we're going to pull into type units.
void emitDIE(DIE *Die, ArrayRef< DIEAbbrev * > Abbrevs)
Recursively Emits a debug information entry.
void beginFunction(const MachineFunction *MF)
Gather pre-function debug information.
void setSymbolSize(const MCSymbol *Sym, uint64_t Size)
For symbols that have a size designated (e.g. common symbols), this tracks that size.
void endModule()
Emit all Dwarf sections that should come after the content.