14 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFUNIT_H
15 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFUNIT_H
31 class MachineLocation;
36 class DwarfCompileUnit;
59 : RangeSym(Sym), Ranges(std::move(Ranges)) {}
270 unsigned SizeInBits = 0,
unsigned OffsetInBits = 0);
298 bool Minimal =
false);
322 return sizeof(int16_t) +
356 void constructTemplateTypeParameterDIE(
DIE &Buffer,
358 void constructTemplateValueParameterDIE(
DIE &Buffer,
364 int64_t getDefaultLowerBound()
const;
367 DIE *getIndexTyDie();
374 void updateAcceleratorTables(
const DIScope *Context,
const DIType *Ty,
377 virtual bool isDwoUnit()
const = 0;
381 uint64_t TypeSignature;
387 bool isDwoUnit()
const override;
const MCSymbol * getStart() const
Instances of this class represent a uniqued identifier for a section in the current translation unit...
void addFlag(DIE &Die, dwarf::Attribute Attribute)
Add a flag that is true to the DIE.
unsigned getUniqueID() const
MCSection * Section
The section this unit will be emitted in.
void addLabelDelta(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)
Add a label delta attribute data and value.
const DICompileUnit * getCUNode() const
std::vector< DIELoc * > DIELocs
A list of all the DIELocs in use.
DIELoc - Represents an expression location.
DIE * getOrCreateStaticMemberDIE(const DIDerivedType *DT)
Create new static data member DIE.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
virtual void addGlobalType(const DIType *Ty, const DIE &Die, const DIScope *Context)
Add a new global type to the compile unit.
void insertDIE(const DINode *Desc, DIE *D)
Insert DIE into the map.
Collects and handles dwarf debug information.
void initSection(MCSection *Section)
void addIndexedString(DIE &Die, dwarf::Attribute Attribute, StringRef Str)
void addType(DIE &Entity, const DIType *Ty, dwarf::Attribute Attribute=dwarf::DW_AT_type)
Add a new type attribute to the specified entity.
virtual DwarfCompileUnit & getCU()=0
AsmPrinter * Asm
Target of Dwarf emission.
Tagged DWARF-like metadata node.
DIE * getOrCreateTypeDIE(const MDNode *N)
Find existing DIE or create new DIE for the given type.
void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy)
virtual void addGlobalName(StringRef Name, DIE &Die, const DIScope *Context)
Add a new global name to the compile unit.
void addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Block)
Add block data.
virtual void emitHeader(bool UseOffsets)
Emit the header for this unit, not including the initial length field.
void addSInt(DIE &Die, dwarf::Attribute Attribute, Optional< dwarf::Form > Form, int64_t Integer)
Add an signed integer attribute data and value.
virtual unsigned getOrCreateSourceID(StringRef File, StringRef Directory)=0
Look up the source ID with the given directory and source file names.
T * resolve(TypedDINodeRef< T > Ref) const
Look in the DwarfDebug map for the MDNode that corresponds to the reference.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void addConstantFPValue(DIE &Die, const MachineOperand &MO)
Add constant value entry in variable DIE.
Reg
All possible values of the reg field in the ModR/M byte.
bool addRegisterOffset(DIELoc &TheDie, unsigned Reg, int64_t Offset)
Add register offset.
void constructContainingTypeDIEs()
Construct DIEs for types that contain vtables.
Pointer union between a subclass of DINode and MDString.
DenseMap< DIE *, const DINode * > ContainingTypeMap
This map is used to keep track of subprogram DIEs that need DW_AT_containing_type attribute...
void addString(DIE &Die, dwarf::Attribute Attribute, StringRef Str)
Add a string attribute data and value.
MCSection * getSection() const
This class is used to track local variable information.
DwarfCompileUnit & getCU() override
virtual unsigned getHeaderSize() const
Compute the size of a header for this unit, not including the initial length field.
DIE * getOrCreateNameSpace(const DINamespace *NS)
bool addRegisterOpPiece(DIELoc &TheDie, unsigned Reg, unsigned SizeInBits=0, unsigned OffsetInBits=0)
Add register operand.
void addConstantValue(DIE &Die, const MachineOperand &MO, const DIType *Ty)
Add constant value entry in variable DIE.
This dwarf writer support class manages information associated with a source file.
bool applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie)
The instances of the Type class are immutable: once they are created, they are never changed...
void addLocalString(DIE &Die, dwarf::Attribute Attribute, StringRef Str)
Add a string attribute data and value.
Allocate memory in an ever growing pool, as if by bump-pointer.
void addSourceLine(DIE &Die, unsigned Line, StringRef File, StringRef Directory)
Add location information to specified debug information entry.
DIE - A structured debug information entry.
DIELoc * getDIELoc()
Returns a fresh newly allocated DIELoc.
ConstantFP - Floating Point Values [float, double].
unsigned getSourceLanguage() const
This class is intended to be used as a driving class for all asm writers.
void setEnd(const MCSymbol *E)
DenseMap< const MDNode *, DIE * > MDNodeToDieMap
Tracks the mapping of unit level debug information variables to debug information entries...
T * resolve(TypedDINodeRef< T > Ref) const
Find the MDNode for the given reference.
DIE * getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal=false)
DIE * IndexTyDie
An anonymous type for index type. Owned by UnitDie.
DIE * getDIE(const DINode *D) const
Returns the DIE map slot for the specified debug variable.
Base class for scope-like contexts.
unsigned getHeaderSize() const override
Compute the size of a header for this unit, not including the initial length field.
void addAccelNamespace(StringRef Name, const DIE &Die)
Add a new name to the namespace accelerator table.
This is the shared class of boolean and integer constants.
uint16_t getLanguage() const
unsigned getDebugInfoOffset() const
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
void addLinkageName(DIE &Die, StringRef LinkageName)
Add a linkage name, if it isn't empty.
void setDebugInfoOffset(unsigned DbgInfoOff)
void setTypeSignature(uint64_t Signature)
void addTemplateParams(DIE &Buffer, DINodeArray TParams)
Add template parameters in buffer.
Class for arbitrary precision integers.
A (clang) module that has been imported by the compile unit.
void setType(const DIE *Ty)
const SmallVectorImpl< RangeSpan > & getRanges() const
std::string getParentContextString(const DIScope *Context) const
Get string containing language specific context for a global name.
void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry)
Add a DIE attribute data and value.
DIE::value_iterator addLabel(DIE &Die, dwarf::Attribute Attribute, dwarf::Form Form, const MCSymbol *Label)
Add a Dwarf label attribute data and value.
unsigned UniqueID
A numeric ID unique among all CUs in the module.
DIE * getOrCreateContextDIE(const DIScope *Context)
Get context owner's DIE.
Type array for a subprogram.
DwarfTypeUnit(unsigned UID, DwarfCompileUnit &CU, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, MCDwarfDwoLineTable *SplitLineTable=nullptr)
DIE & createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N=nullptr)
Create a DIE with the given Tag, add the DIE to its parent, and call insertDIE if MD is not null...
RangeSpan(MCSymbol *S, MCSymbol *E)
unsigned DebugInfoOffset
Offset of the UnitDie from beginning of debug info section.
DwarfUnit(unsigned UID, dwarf::Tag, const DICompileUnit *CU, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU)
void emitHeader(bool UseOffsets) override
Emit the header for this unit, not including the initial length field.
DIE * getOrCreateModule(const DIModule *M)
void addBlockByrefAddress(const DbgVariable &DV, DIE &Die, dwarf::Attribute Attribute, const MachineLocation &Location)
Start with the address based on the location provided, and generate the DWARF information necessary t...
void addRange(RangeSpan Range)
DIE * createTypeDIE(const DICompositeType *Ty)
Get context owner's DIE.
const DICompileUnit * CUNode
MDNode for the compile unit.
AsmPrinter * getAsmPrinter() const
void addSectionOffset(DIE &Die, dwarf::Attribute Attribute, uint64_t Integer)
Add an offset into a section attribute data and value.
bool hasContent() const
Return true if this compile unit has something to write out.
BumpPtrAllocator DIEValueAllocator
void addDIETypeSignature(DIE &Die, const DwarfTypeUnit &Type)
DIE & UnitDie
Unit debug information entry.
RangeSpanList(MCSymbol *Sym, SmallVector< RangeSpan, 2 > Ranges)
std::vector< DIEBlock * > DIEBlocks
A list of all the DIEBlocks in use.
void addOpAddress(DIELoc &Die, const MCSymbol *Label)
Add a dwarf op address data and value using the form given and an op of either DW_FORM_addr or DW_FOR...
StringRef - Represent a constant reference to a string, i.e.
uint64_t getTypeSignature() const
DIEBlock - Represents a block of values.
void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, bool Minimal=false)
void constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args)
Construct function argument DIEs.
void addUInt(DIE &Die, dwarf::Attribute Attribute, Optional< dwarf::Form > Form, uint64_t Integer)
Add an unsigned integer attribute data and value.
MCSymbol * getSym() const
const MCSymbol * getEnd() const
Basic type, like 'int' or 'float'.