LLVM 20.0.0git
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::DwarfUnit Class Referenceabstract

This dwarf writer support class manages information associated with a source file. More...

#include "CodeGen/AsmPrinter/DwarfUnit.h"

Inheritance diagram for llvm::DwarfUnit:
Inheritance graph
[legend]

Public Member Functions

unsigned getUniqueID () const
 Gets Unique ID for this unit.
 
AsmPrintergetAsmPrinter () const
 
MCSymbolgetLabelBegin () const
 Get the the symbol for start of the section for this unit.
 
MCSymbolgetEndLabel () const
 
uint16_t getLanguage () const
 
const DICompileUnitgetCUNode () const
 
DwarfDebuggetDwarfDebug () const
 
bool hasContent () const
 Return true if this compile unit has something to write out.
 
std::string getParentContextString (const DIScope *Context) const
 Get string containing language specific context for a global name.
 
virtual void addGlobalName (StringRef Name, const DIE &Die, const DIScope *Context)=0
 Add a new global name to the compile unit.
 
virtual void addGlobalTypeImpl (const DIType *Ty, const DIE &Die, const DIScope *Context)=0
 Add a new global type to the compile unit.
 
void addGlobalType (const DIType *Ty, const DIE &Die, const DIScope *Context)
 
DIEgetDIE (const DINode *D) const
 Returns the DIE map slot for the specified debug variable.
 
DIELocgetDIELoc ()
 Returns a fresh newly allocated DIELoc.
 
void insertDIE (const DINode *Desc, DIE *D)
 Insert DIE into the map.
 
void insertDIE (DIE *D)
 
void addFlag (DIE &Die, dwarf::Attribute Attribute)
 Add a flag that is true to the DIE.
 
void addUInt (DIEValueList &Die, dwarf::Attribute Attribute, std::optional< dwarf::Form > Form, uint64_t Integer)
 Add an unsigned integer attribute data and value.
 
void addUInt (DIEValueList &Block, dwarf::Form Form, uint64_t Integer)
 
void addSInt (DIEValueList &Die, dwarf::Attribute Attribute, std::optional< dwarf::Form > Form, int64_t Integer)
 Add an signed integer attribute data and value.
 
void addSInt (DIELoc &Die, std::optional< dwarf::Form > Form, int64_t Integer)
 
void addString (DIE &Die, dwarf::Attribute Attribute, StringRef Str)
 Add a string attribute data and value.
 
void addLabel (DIEValueList &Die, dwarf::Attribute Attribute, dwarf::Form Form, const MCSymbol *Label)
 Add a Dwarf label attribute data and value.
 
void addLabel (DIELoc &Die, dwarf::Form Form, const MCSymbol *Label)
 
void addSectionOffset (DIE &Die, dwarf::Attribute Attribute, uint64_t Integer)
 Add an offset into a section attribute data and value.
 
void addOpAddress (DIELoc &Die, const MCSymbol *Sym)
 Add a dwarf op address data and value using the form given and an op of either DW_FORM_addr or DW_FORM_GNU_addr_index.
 
void addPoolOpAddress (DIEValueList &Die, const MCSymbol *Label)
 
void addLabelDelta (DIEValueList &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)
 Add a label delta attribute data and value.
 
void addDIEEntry (DIE &Die, dwarf::Attribute Attribute, DIE &Entry)
 Add a DIE attribute data and value.
 
void addDIEEntry (DIE &Die, dwarf::Attribute Attribute, DIEEntry Entry)
 Add a DIE attribute data and value.
 
void addDIETypeSignature (DIE &Die, uint64_t Signature)
 Add a type's DW_AT_signature and set the declaration flag.
 
void addBlock (DIE &Die, dwarf::Attribute Attribute, DIELoc *Loc)
 Add block data.
 
void addBlock (DIE &Die, dwarf::Attribute Attribute, DIEBlock *Block)
 Add block data.
 
void addBlock (DIE &Die, dwarf::Attribute Attribute, dwarf::Form Form, DIEBlock *Block)
 
void addSourceLine (DIE &Die, unsigned Line, const DIFile *File)
 Add location information to specified debug information entry.
 
void addSourceLine (DIE &Die, const DILocalVariable *V)
 
void addSourceLine (DIE &Die, const DIGlobalVariable *G)
 
void addSourceLine (DIE &Die, const DISubprogram *SP)
 
void addSourceLine (DIE &Die, const DILabel *L)
 
void addSourceLine (DIE &Die, const DIType *Ty)
 
void addSourceLine (DIE &Die, const DIObjCProperty *Ty)
 
void addConstantValue (DIE &Die, const ConstantInt *CI, const DIType *Ty)
 Add constant value entry in variable DIE.
 
void addConstantValue (DIE &Die, const APInt &Val, const DIType *Ty)
 
void addConstantValue (DIE &Die, const APInt &Val, bool Unsigned)
 
void addConstantValue (DIE &Die, uint64_t Val, const DIType *Ty)
 
void addConstantValue (DIE &Die, bool Unsigned, uint64_t Val)
 
void addConstantFPValue (DIE &Die, const ConstantFP *CFP)
 Add constant value entry in variable DIE.
 
void addLinkageName (DIE &Die, StringRef LinkageName)
 Add a linkage name, if it isn't empty.
 
void addTemplateParams (DIE &Buffer, DINodeArray TParams)
 Add template parameters in buffer.
 
void addThrownTypes (DIE &Die, DINodeArray ThrownTypes)
 Add thrown types.
 
void addAccess (DIE &Die, DINode::DIFlags Flags)
 Add the accessibility attribute.
 
void addType (DIE &Entity, const DIType *Ty, dwarf::Attribute Attribute=dwarf::DW_AT_type)
 Add a new type attribute to the specified entity.
 
DIEgetOrCreateNameSpace (const DINamespace *NS)
 
DIEgetOrCreateModule (const DIModule *M)
 
DIEgetOrCreateSubprogramDIE (const DISubprogram *SP, bool Minimal=false)
 
void applySubprogramAttributes (const DISubprogram *SP, DIE &SPDie, bool SkipSPAttributes=false)
 
DIEcreateTypeDIE (const DIScope *Context, DIE &ContextDIE, const DIType *Ty)
 Creates type DIE with specific context.
 
virtual DIEgetOrCreateTypeDIE (const MDNode *TyNode)
 Find existing DIE or create new DIE for the given type.
 
virtual DIEgetOrCreateContextDIE (const DIScope *Context)
 Get context owner's DIE.
 
void constructContainingTypeDIEs ()
 Construct DIEs for types that contain vtables.
 
void constructSubprogramArguments (DIE &Buffer, DITypeRefArray Args)
 Construct function argument DIEs.
 
DIEcreateAndAddDIE (dwarf::Tag 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.
 
bool useSegmentedStringOffsetsTable () const
 
virtual unsigned getHeaderSize () const
 Compute the size of a header for this unit, not including the initial length field.
 
virtual void emitHeader (bool UseOffsets)=0
 Emit the header for this unit, not including the initial length field.
 
void addStringOffsetsStart ()
 Add the DW_AT_str_offsets_base attribute to the unit DIE.
 
void addRnglistsBase ()
 Add the DW_AT_rnglists_base attribute to the unit DIE.
 
virtual DwarfCompileUnitgetCU ()=0
 
void constructTypeDIE (DIE &Buffer, const DICompositeType *CTy)
 
void addSectionDelta (DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)
 addSectionDelta - Add a label delta attribute data and value.
 
void addSectionLabel (DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label, const MCSymbol *Sec)
 Add a Dwarf section label attribute data and value.
 
void addAnnotation (DIE &Buffer, DINodeArray Annotations)
 Add DW_TAG_LLVM_annotation.
 
DIEcreateTypeDIE (const DICompositeType *Ty)
 Get context owner's DIE.
 
- Public Member Functions inherited from llvm::DIEUnit
 DIEUnit (dwarf::Tag UnitTag)
 
 DIEUnit (const DIEUnit &RHS)=delete
 
 DIEUnit (DIEUnit &&RHS)=delete
 
void operator= (const DIEUnit &RHS)=delete
 
void operator= (const DIEUnit &&RHS)=delete
 
void setSection (MCSection *Section)
 Set the section that this DIEUnit will be emitted into.
 
virtual const MCSymbolgetCrossSectionRelativeBaseAddress () const
 
MCSectiongetSection () const
 Return the section that this DIEUnit will be emitted into.
 
void setDebugSectionOffset (uint64_t O)
 
uint64_t getDebugSectionOffset () const
 
DIEgetUnitDie ()
 
const DIEgetUnitDie () const
 

Protected Member Functions

 DwarfUnit (dwarf::Tag, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, unsigned UniqueID=0)
 
bool applySubprogramDefinitionAttributes (const DISubprogram *SP, DIE &SPDie, bool Minimal)
 
bool isShareableAcrossCUs (const DINode *D) const
 Check whether the DIE for this MDNode can be shared across CUs.
 
template<typename T >
void addAttribute (DIEValueList &Die, dwarf::Attribute Attribute, dwarf::Form Form, T &&Value)
 
 ~DwarfUnit ()
 
DIEgetOrCreateStaticMemberDIE (const DIDerivedType *DT)
 Create new static data member DIE.
 
virtual unsigned getOrCreateSourceID (const DIFile *File)=0
 Look up the source ID for the given file.
 
void emitCommonHeader (bool UseOffsets, dwarf::UnitType UT)
 Emit the common part of the header for this unit.
 
- Protected Member Functions inherited from llvm::DIEUnit
virtual ~DIEUnit ()=default
 .debug_info or .debug_types absolute section offset.
 

Protected Attributes

unsigned UniqueID
 A numeric ID unique among all CUs in the module.
 
const DICompileUnitCUNode
 MDNode for the compile unit.
 
BumpPtrAllocator DIEValueAllocator
 
AsmPrinterAsm
 Target of Dwarf emission.
 
MCSymbolLabelBegin = nullptr
 The start of the unit within its section.
 
MCSymbolEndLabel = nullptr
 Emitted at the end of the CU and used to compute the CU Length field.
 
DwarfDebugDD
 
DwarfFileDU
 
DIEIndexTyDie = nullptr
 An anonymous type for index type. Owned by DIEUnit.
 
DenseMap< const MDNode *, DIE * > MDNodeToDieMap
 Tracks the mapping of unit level debug information variables to debug information entries.
 
std::vector< DIEBlock * > DIEBlocks
 A list of all the DIEBlocks in use.
 
std::vector< DIELoc * > DIELocs
 A list of all the DIELocs in use.
 
DenseMap< DIE *, const DINode * > ContainingTypeMap
 This map is used to keep track of subprogram DIEs that need DW_AT_containing_type attribute.
 

Detailed Description

This dwarf writer support class manages information associated with a source file.

Definition at line 35 of file DwarfUnit.h.

Constructor & Destructor Documentation

◆ DwarfUnit()

DwarfUnit::DwarfUnit ( dwarf::Tag  UnitTag,
const DICompileUnit Node,
AsmPrinter A,
DwarfDebug DW,
DwarfFile DWU,
unsigned  UniqueID = 0 
)
protected

Definition at line 83 of file DwarfUnit.cpp.

◆ ~DwarfUnit()

DwarfUnit::~DwarfUnit ( )
protected

Definition at line 95 of file DwarfUnit.cpp.

References B, DIEBlocks, and DIELocs.

Member Function Documentation

◆ addAccess()

void DwarfUnit::addAccess ( DIE Die,
DINode::DIFlags  Flags 
)

◆ addAnnotation()

void DwarfUnit::addAnnotation ( DIE Buffer,
DINodeArray  Annotations 
)

◆ addAttribute()

template<typename T >
void llvm::DwarfUnit::addAttribute ( DIEValueList Die,
dwarf::Attribute  Attribute,
dwarf::Form  Form,
T &&  Value 
)
inlineprotected

◆ addBlock() [1/3]

void DwarfUnit::addBlock ( DIE Die,
dwarf::Attribute  Attribute,
DIEBlock Block 
)

Add block data.

Definition at line 404 of file DwarfUnit.cpp.

References addBlock(), and llvm::Block.

◆ addBlock() [2/3]

void DwarfUnit::addBlock ( DIE Die,
dwarf::Attribute  Attribute,
DIELoc Loc 
)

◆ addBlock() [3/3]

void DwarfUnit::addBlock ( DIE Die,
dwarf::Attribute  Attribute,
dwarf::Form  Form,
DIEBlock Block 
)

◆ addConstantFPValue()

void DwarfUnit::addConstantFPValue ( DIE Die,
const ConstantFP CFP 
)

Add constant value entry in variable DIE.

Definition at line 454 of file DwarfUnit.cpp.

References addConstantValue(), llvm::APFloat::bitcastToAPInt(), and llvm::ConstantFP::getValueAPF().

Referenced by getOrCreateStaticMemberDIE().

◆ addConstantValue() [1/5]

void DwarfUnit::addConstantValue ( DIE Die,
bool  Unsigned,
uint64_t  Val 
)

Definition at line 468 of file DwarfUnit.cpp.

References addUInt(), and Unsigned.

◆ addConstantValue() [2/5]

void DwarfUnit::addConstantValue ( DIE Die,
const APInt Val,
bool  Unsigned 
)

◆ addConstantValue() [3/5]

void DwarfUnit::addConstantValue ( DIE Die,
const APInt Val,
const DIType Ty 
)

Definition at line 475 of file DwarfUnit.cpp.

References addConstantValue(), DD, and llvm::DebugHandlerBase::isUnsignedDIType().

◆ addConstantValue() [4/5]

void DwarfUnit::addConstantValue ( DIE Die,
const ConstantInt CI,
const DIType Ty 
)

◆ addConstantValue() [5/5]

void DwarfUnit::addConstantValue ( DIE Die,
uint64_t  Val,
const DIType Ty 
)

Definition at line 464 of file DwarfUnit.cpp.

References addConstantValue(), DD, and llvm::DebugHandlerBase::isUnsignedDIType().

◆ addDIEEntry() [1/2]

void DwarfUnit::addDIEEntry ( DIE Die,
dwarf::Attribute  Attribute,
DIE Entry 
)

◆ addDIEEntry() [2/2]

void DwarfUnit::addDIEEntry ( DIE Die,
dwarf::Attribute  Attribute,
DIEEntry  Entry 
)

◆ addDIETypeSignature()

void DwarfUnit::addDIETypeSignature ( DIE Die,
uint64_t  Signature 
)

Add a type's DW_AT_signature and set the declaration flag.

Definition at line 357 of file DwarfUnit.cpp.

References addAttribute(), and addFlag().

◆ addFlag()

void DwarfUnit::addFlag ( DIE Die,
dwarf::Attribute  Attribute 
)

◆ addGlobalName()

virtual void llvm::DwarfUnit::addGlobalName ( StringRef  Name,
const DIE Die,
const DIScope Context 
)
pure virtual

Add a new global name to the compile unit.

Implemented in llvm::DwarfCompileUnit, and llvm::DwarfTypeUnit.

Referenced by getOrCreateModule(), and getOrCreateNameSpace().

◆ addGlobalType()

void DwarfUnit::addGlobalType ( const DIType Ty,
const DIE Die,
const DIScope Context 
)

Definition at line 668 of file DwarfUnit.cpp.

References addGlobalTypeImpl().

Referenced by createTypeDIE().

◆ addGlobalTypeImpl()

virtual void llvm::DwarfUnit::addGlobalTypeImpl ( const DIType Ty,
const DIE Die,
const DIScope Context 
)
pure virtual

Add a new global type to the compile unit.

Implemented in llvm::DwarfCompileUnit, and llvm::DwarfTypeUnit.

Referenced by addGlobalType().

◆ addLabel() [1/2]

void DwarfUnit::addLabel ( DIELoc Die,
dwarf::Form  Form,
const MCSymbol Label 
)

Definition at line 285 of file DwarfUnit.cpp.

References addLabel().

◆ addLabel() [2/2]

void DwarfUnit::addLabel ( DIEValueList Die,
dwarf::Attribute  Attribute,
dwarf::Form  Form,
const MCSymbol Label 
)

Add a Dwarf label attribute data and value.

Definition at line 280 of file DwarfUnit.cpp.

References addAttribute().

Referenced by addLabel(), addOpAddress(), and addSectionLabel().

◆ addLabelDelta()

void DwarfUnit::addLabelDelta ( DIEValueList Die,
dwarf::Attribute  Attribute,
const MCSymbol Hi,
const MCSymbol Lo 
)

Add a label delta attribute data and value.

Definition at line 347 of file DwarfUnit.cpp.

References addAttribute(), DIEValueAllocator, llvm::Hi, and llvm::Lo.

Referenced by addPoolOpAddress(), and llvm::DwarfCompileUnit::attachLowHighPC().

◆ addLinkageName()

void DwarfUnit::addLinkageName ( DIE Die,
StringRef  LinkageName 
)

◆ addOpAddress()

void DwarfUnit::addOpAddress ( DIELoc Die,
const MCSymbol Sym 
)

Add a dwarf op address data and value using the form given and an op of either DW_FORM_addr or DW_FORM_GNU_addr_index.

Definition at line 332 of file DwarfUnit.cpp.

References addLabel(), addPoolOpAddress(), addUInt(), DD, llvm::DwarfDebug::getDwarfVersion(), Sym, and llvm::DwarfDebug::useSplitDwarf().

Referenced by llvm::DwarfCompileUnit::addLocationAttribute().

◆ addPoolOpAddress()

void DwarfUnit::addPoolOpAddress ( DIEValueList Die,
const MCSymbol Label 
)

◆ addRnglistsBase()

void DwarfUnit::addRnglistsBase ( )

◆ addSectionDelta()

void DwarfUnit::addSectionDelta ( DIE Die,
dwarf::Attribute  Attribute,
const MCSymbol Hi,
const MCSymbol Lo 
)

addSectionDelta - Add a label delta attribute data and value.

Definition at line 1865 of file DwarfUnit.cpp.

References addAttribute(), DD, DIEValueAllocator, llvm::DwarfDebug::getDwarfSectionOffsetForm(), llvm::Hi, and llvm::Lo.

Referenced by llvm::DwarfCompileUnit::addScopeRangeList(), and addSectionLabel().

◆ addSectionLabel()

void DwarfUnit::addSectionLabel ( DIE Die,
dwarf::Attribute  Attribute,
const MCSymbol Label,
const MCSymbol Sec 
)

◆ addSectionOffset()

void DwarfUnit::addSectionOffset ( DIE Die,
dwarf::Attribute  Attribute,
uint64_t  Integer 
)

Add an offset into a section attribute data and value.

Definition at line 289 of file DwarfUnit.cpp.

References addUInt(), DD, llvm::DwarfDebug::getDwarfSectionOffsetForm(), and llvm::Integer.

◆ addSInt() [1/2]

void DwarfUnit::addSInt ( DIELoc Die,
std::optional< dwarf::Form Form,
int64_t  Integer 
)

Definition at line 242 of file DwarfUnit.cpp.

References addSInt(), and llvm::Integer.

◆ addSInt() [2/2]

void DwarfUnit::addSInt ( DIEValueList Die,
dwarf::Attribute  Attribute,
std::optional< dwarf::Form Form,
int64_t  Integer 
)

◆ addSourceLine() [1/7]

void DwarfUnit::addSourceLine ( DIE Die,
const DIGlobalVariable G 
)

Definition at line 424 of file DwarfUnit.cpp.

References addSourceLine(), assert(), and G.

◆ addSourceLine() [2/7]

void DwarfUnit::addSourceLine ( DIE Die,
const DILabel L 
)

Definition at line 436 of file DwarfUnit.cpp.

References addSourceLine(), and assert().

◆ addSourceLine() [3/7]

void DwarfUnit::addSourceLine ( DIE Die,
const DILocalVariable V 
)

Definition at line 418 of file DwarfUnit.cpp.

References addSourceLine(), and assert().

◆ addSourceLine() [4/7]

void DwarfUnit::addSourceLine ( DIE Die,
const DIObjCProperty Ty 
)

◆ addSourceLine() [5/7]

void DwarfUnit::addSourceLine ( DIE Die,
const DISubprogram SP 
)

Definition at line 430 of file DwarfUnit.cpp.

References addSourceLine(), assert(), and llvm::DIScope::getFile().

◆ addSourceLine() [6/7]

void DwarfUnit::addSourceLine ( DIE Die,
const DIType Ty 
)

◆ addSourceLine() [7/7]

void DwarfUnit::addSourceLine ( DIE Die,
unsigned  Line,
const DIFile File 
)

◆ addString()

void DwarfUnit::addString ( DIE Die,
dwarf::Attribute  Attribute,
StringRef  Str 
)

◆ addStringOffsetsStart()

void DwarfUnit::addStringOffsetsStart ( )

◆ addTemplateParams()

void DwarfUnit::addTemplateParams ( DIE Buffer,
DINodeArray  TParams 
)

Add template parameters in buffer.

Definition at line 516 of file DwarfUnit.cpp.

Referenced by applySubprogramDefinitionAttributes(), constructTypeDIE(), and llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE().

◆ addThrownTypes()

void DwarfUnit::addThrownTypes ( DIE Die,
DINodeArray  ThrownTypes 
)

Add thrown types.

Definition at line 527 of file DwarfUnit.cpp.

References addType(), and createAndAddDIE().

Referenced by applySubprogramAttributes().

◆ addType()

void DwarfUnit::addType ( DIE Entity,
const DIType Ty,
dwarf::Attribute  Attribute = dwarf::DW_AT_type 
)

Add a new type attribute to the specified entity.

This takes and attribute parameter because DW_AT_friend attributes are also type references.

Definition at line 675 of file DwarfUnit.cpp.

References addDIEEntry(), assert(), and getOrCreateTypeDIE().

Referenced by addThrownTypes(), llvm::DwarfCompileUnit::applyCommonDbgVariableAttributes(), applySubprogramAttributes(), applySubprogramDefinitionAttributes(), constructSubprogramArguments(), constructTypeDIE(), llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE(), and getOrCreateStaticMemberDIE().

◆ addUInt() [1/2]

void DwarfUnit::addUInt ( DIEValueList Block,
dwarf::Form  Form,
uint64_t  Integer 
)

Definition at line 230 of file DwarfUnit.cpp.

References addUInt(), llvm::Block, and llvm::Integer.

◆ addUInt() [2/2]

void DwarfUnit::addUInt ( DIEValueList Die,
dwarf::Attribute  Attribute,
std::optional< dwarf::Form Form,
uint64_t  Integer 
)

◆ applySubprogramAttributes()

void DwarfUnit::applySubprogramAttributes ( const DISubprogram SP,
DIE SPDie,
bool  SkipSPAttributes = false 
)

◆ applySubprogramDefinitionAttributes()

bool DwarfUnit::applySubprogramDefinitionAttributes ( const DISubprogram SP,
DIE SPDie,
bool  Minimal 
)
protected

◆ constructContainingTypeDIEs()

void DwarfUnit::constructContainingTypeDIEs ( )

Construct DIEs for types that contain vtables.

Definition at line 1637 of file DwarfUnit.cpp.

References addDIEEntry(), ContainingTypeMap, D, getDIE(), and P.

◆ constructSubprogramArguments()

void DwarfUnit::constructSubprogramArguments ( DIE Buffer,
DITypeRefArray  Args 
)

Construct function argument DIEs.

Definition at line 852 of file DwarfUnit.cpp.

References addFlag(), addType(), assert(), createAndAddDIE(), llvm::DIType::isArtificial(), and N.

Referenced by applySubprogramAttributes().

◆ constructTypeDIE()

void DwarfUnit::constructTypeDIE ( DIE Buffer,
const DICompositeType CTy 
)

◆ createAndAddDIE()

DIE & DwarfUnit::createAndAddDIE ( dwarf::Tag  Tag,
DIE Parent,
const DINode N = nullptr 
)

◆ createTypeDIE() [1/2]

DIE * DwarfUnit::createTypeDIE ( const DICompositeType Ty)

◆ createTypeDIE() [2/2]

DIE * DwarfUnit::createTypeDIE ( const DIScope Context,
DIE ContextDIE,
const DIType Ty 
)

◆ emitCommonHeader()

void DwarfUnit::emitCommonHeader ( bool  UseOffsets,
dwarf::UnitType  UT 
)
protected

◆ emitHeader()

virtual void llvm::DwarfUnit::emitHeader ( bool  UseOffsets)
pure virtual

Emit the header for this unit, not including the initial length field.

Implemented in llvm::DwarfCompileUnit, and llvm::DwarfTypeUnit.

Referenced by llvm::DwarfFile::emitUnit().

◆ getAsmPrinter()

AsmPrinter * llvm::DwarfUnit::getAsmPrinter ( ) const
inline

Definition at line 103 of file DwarfUnit.h.

References Asm.

◆ getCU()

virtual DwarfCompileUnit & llvm::DwarfUnit::getCU ( )
pure virtual

Implemented in llvm::DwarfCompileUnit, and llvm::DwarfTypeUnit.

Referenced by createTypeDIE().

◆ getCUNode()

const DICompileUnit * llvm::DwarfUnit::getCUNode ( ) const
inline

◆ getDIE()

DIE * DwarfUnit::getDIE ( const DINode D) const

◆ getDIELoc()

DIELoc * llvm::DwarfUnit::getDIELoc ( )
inline

Returns a fresh newly allocated DIELoc.

Definition at line 144 of file DwarfUnit.h.

References DIEValueAllocator.

Referenced by applySubprogramAttributes().

◆ getDwarfDebug()

DwarfDebug & llvm::DwarfUnit::getDwarfDebug ( ) const
inline

Definition at line 112 of file DwarfUnit.h.

References DD.

Referenced by llvm::DwarfCompileUnit::finishEntityDefinition().

◆ getEndLabel()

MCSymbol * llvm::DwarfUnit::getEndLabel ( ) const
inline

Definition at line 109 of file DwarfUnit.h.

References EndLabel.

Referenced by llvm::DwarfFile::emitUnit().

◆ getHeaderSize()

virtual unsigned llvm::DwarfUnit::getHeaderSize ( ) const
inlinevirtual

Compute the size of a header for this unit, not including the initial length field.

Reimplemented in llvm::DwarfCompileUnit, and llvm::DwarfTypeUnit.

Definition at line 283 of file DwarfUnit.h.

References Asm, DD, llvm::AsmPrinter::getDwarfOffsetByteSize(), and llvm::DwarfDebug::getDwarfVersion().

Referenced by llvm::DwarfFile::computeSizeAndOffsetsForUnit(), emitCommonHeader(), llvm::DwarfCompileUnit::getHeaderSize(), and llvm::DwarfTypeUnit::getHeaderSize().

◆ getLabelBegin()

MCSymbol * llvm::DwarfUnit::getLabelBegin ( ) const
inline

Get the the symbol for start of the section for this unit.

Definition at line 105 of file DwarfUnit.h.

References assert(), and LabelBegin.

Referenced by llvm::emitDWARF5AccelTable().

◆ getLanguage()

uint16_t llvm::DwarfUnit::getLanguage ( ) const
inline

◆ getOrCreateContextDIE()

DIE * DwarfUnit::getOrCreateContextDIE ( const DIScope Context)
virtual

◆ getOrCreateModule()

DIE * DwarfUnit::getOrCreateModule ( const DIModule M)

◆ getOrCreateNameSpace()

DIE * DwarfUnit::getOrCreateNameSpace ( const DINamespace NS)

◆ getOrCreateSourceID()

virtual unsigned llvm::DwarfUnit::getOrCreateSourceID ( const DIFile File)
protectedpure virtual

Look up the source ID for the given file.

If none currently exists, create a new ID and insert it in the line table.

Implemented in llvm::DwarfCompileUnit.

Referenced by addSourceLine(), applySubprogramDefinitionAttributes(), and getOrCreateModule().

◆ getOrCreateStaticMemberDIE()

DIE * DwarfUnit::getOrCreateStaticMemberDIE ( const DIDerivedType DT)
protected

◆ getOrCreateSubprogramDIE()

DIE * DwarfUnit::getOrCreateSubprogramDIE ( const DISubprogram SP,
bool  Minimal = false 
)

◆ getOrCreateTypeDIE()

DIE * DwarfUnit::getOrCreateTypeDIE ( const MDNode TyNode)
virtual

◆ getParentContextString()

std::string DwarfUnit::getParentContextString ( const DIScope Context) const

Get string containing language specific context for a global name.

Walks the metadata parent chain in a language specific manner (using the compile unit language) and returns it as a string. This is done at the metadata level because DIEs may not currently have been added to the parent context and walking the DIEs looking for names is more expensive than walking the metadata.

Definition at line 681 of file DwarfUnit.cpp.

References getLanguage(), llvm::DIScope::getScope(), llvm::dwarf::isCPlusPlus(), Name, and llvm::reverse().

Referenced by llvm::DwarfCompileUnit::addGlobalName(), llvm::DwarfCompileUnit::addGlobalNameForTypeUnit(), llvm::DwarfCompileUnit::addGlobalTypeImpl(), and llvm::DwarfCompileUnit::addGlobalTypeUnitType().

◆ getUniqueID()

unsigned llvm::DwarfUnit::getUniqueID ( ) const
inline

Gets Unique ID for this unit.

Definition at line 101 of file DwarfUnit.h.

References UniqueID.

Referenced by llvm::DwarfCompileUnit::getOrCreateSourceID(), and llvm::DwarfCompileUnit::initStmtList().

◆ hasContent()

bool llvm::DwarfUnit::hasContent ( ) const
inline

Return true if this compile unit has something to write out.

Definition at line 115 of file DwarfUnit.h.

References llvm::DIEUnit::getUnitDie(), and llvm::DIE::hasChildren().

◆ insertDIE() [1/2]

void DwarfUnit::insertDIE ( const DINode Desc,
DIE D 
)

Insert DIE into the map.

We delegate the request to DwarfDebug when the MDNode can be part of the type system, since DIEs for the type system can be shared across CUs and the mappings are kept in DwarfDebug.

Definition at line 202 of file DwarfUnit.cpp.

References D, DU, llvm::DwarfFile::insertDIE(), isShareableAcrossCUs(), and MDNodeToDieMap.

Referenced by llvm::DwarfCompileUnit::constructCallSiteParmEntryDIEs(), llvm::DwarfCompileUnit::constructImportedEntityDIE(), llvm::DwarfCompileUnit::constructLabelDIE(), llvm::DwarfCompileUnit::constructVariableDIE(), createAndAddDIE(), and llvm::DwarfCompileUnit::DwarfCompileUnit().

◆ insertDIE() [2/2]

void DwarfUnit::insertDIE ( DIE D)

Definition at line 210 of file DwarfUnit.cpp.

References D, and MDNodeToDieMap.

◆ isShareableAcrossCUs()

bool DwarfUnit::isShareableAcrossCUs ( const DINode D) const
protected

Check whether the DIE for this MDNode can be shared across CUs.

Definition at line 181 of file DwarfUnit.cpp.

References D, DD, llvm::DwarfDebug::generateTypeUnits(), and llvm::DwarfDebug::shareAcrossDWOCUs().

Referenced by getDIE(), and insertDIE().

◆ useSegmentedStringOffsetsTable()

bool llvm::DwarfUnit::useSegmentedStringOffsetsTable ( ) const
inline

Definition at line 277 of file DwarfUnit.h.

References DD, and llvm::DwarfDebug::useSegmentedStringOffsetsTable().

Referenced by addString().

Member Data Documentation

◆ Asm

AsmPrinter* llvm::DwarfUnit::Asm
protected

◆ ContainingTypeMap

DenseMap<DIE *, const DINode *> llvm::DwarfUnit::ContainingTypeMap
protected

This map is used to keep track of subprogram DIEs that need DW_AT_containing_type attribute.

This attribute points to a DIE that corresponds to the MDNode mapped with the subprogram DIE.

Definition at line 74 of file DwarfUnit.h.

Referenced by applySubprogramAttributes(), and constructContainingTypeDIEs().

◆ CUNode

const DICompileUnit* llvm::DwarfUnit::CUNode
protected

◆ DD

DwarfDebug* llvm::DwarfUnit::DD
protected

Definition at line 55 of file DwarfUnit.h.

Referenced by llvm::DwarfCompileUnit::addAddrTableBase(), addAttribute(), addBlock(), addConstantValue(), addDIEEntry(), addFlag(), llvm::DwarfCompileUnit::addLabelAddress(), addLinkageName(), llvm::DwarfCompileUnit::addLocationAttribute(), llvm::DwarfCompileUnit::addLocationList(), addOpAddress(), addPoolOpAddress(), llvm::DwarfCompileUnit::addRange(), addRnglistsBase(), llvm::DwarfCompileUnit::addScopeRangeList(), addSectionDelta(), addSectionLabel(), addSectionOffset(), addString(), applySubprogramAttributes(), applySubprogramDefinitionAttributes(), llvm::DwarfCompileUnit::attachLowHighPC(), llvm::DwarfCompileUnit::attachRangesOrLowHighPC(), llvm::DwarfCompileUnit::constructAbstractSubprogramScopeDIE(), llvm::DwarfCompileUnit::constructCallSiteEntryDIE(), llvm::DwarfCompileUnit::constructImportedEntityDIE(), llvm::DwarfCompileUnit::constructInlinedScopeDIE(), llvm::DwarfCompileUnit::constructLexicalScopeDIE(), llvm::DwarfCompileUnit::constructScopeDIE(), constructTypeDIE(), llvm::DwarfCompileUnit::createAndAddScopeChildren(), createTypeDIE(), emitCommonHeader(), llvm::DwarfCompileUnit::emitHeader(), llvm::DwarfTypeUnit::emitHeader(), getDwarfDebug(), getHeaderSize(), llvm::DwarfCompileUnit::getHeaderSize(), getOrCreateNameSpace(), llvm::DwarfCompileUnit::getOrCreateSourceID(), getOrCreateTypeDIE(), llvm::DwarfCompileUnit::hasDwarfPubSections(), llvm::DwarfCompileUnit::includeMinimalInlineScopes(), llvm::DwarfCompileUnit::initStmtList(), isShareableAcrossCUs(), llvm::DwarfCompileUnit::updateSubprogramScopeDIE(), llvm::DwarfCompileUnit::useGNUAnalogForDwarf5Feature(), and useSegmentedStringOffsetsTable().

◆ DIEBlocks

std::vector<DIEBlock *> llvm::DwarfUnit::DIEBlocks
protected

A list of all the DIEBlocks in use.

Definition at line 66 of file DwarfUnit.h.

Referenced by addBlock(), and ~DwarfUnit().

◆ DIELocs

std::vector<DIELoc *> llvm::DwarfUnit::DIELocs
protected

A list of all the DIELocs in use.

Definition at line 69 of file DwarfUnit.h.

Referenced by addBlock(), and ~DwarfUnit().

◆ DIEValueAllocator

BumpPtrAllocator llvm::DwarfUnit::DIEValueAllocator
protected

◆ DU

DwarfFile* llvm::DwarfUnit::DU
protected

◆ EndLabel

MCSymbol* llvm::DwarfUnit::EndLabel = nullptr
protected

Emitted at the end of the CU and used to compute the CU Length field.

Definition at line 52 of file DwarfUnit.h.

Referenced by llvm::DwarfCompileUnit::attachRangesOrLowHighPC(), emitCommonHeader(), and getEndLabel().

◆ IndexTyDie

DIE* llvm::DwarfUnit::IndexTyDie = nullptr
protected

An anonymous type for index type. Owned by DIEUnit.

Definition at line 59 of file DwarfUnit.h.

◆ LabelBegin

MCSymbol* llvm::DwarfUnit::LabelBegin = nullptr
protected

The start of the unit within its section.

Definition at line 49 of file DwarfUnit.h.

Referenced by llvm::DwarfCompileUnit::emitHeader(), llvm::DwarfTypeUnit::emitHeader(), and getLabelBegin().

◆ MDNodeToDieMap

DenseMap<const MDNode *, DIE *> llvm::DwarfUnit::MDNodeToDieMap
protected

Tracks the mapping of unit level debug information variables to debug information entries.

Definition at line 63 of file DwarfUnit.h.

Referenced by getDIE(), and insertDIE().

◆ UniqueID

unsigned llvm::DwarfUnit::UniqueID
protected

A numeric ID unique among all CUs in the module.

Definition at line 38 of file DwarfUnit.h.

Referenced by getUniqueID().


The documentation for this class was generated from the following files: