LLVM 20.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
llvm::DIE Class Reference

A structured debug information entry. More...

#include "llvm/CodeGen/DIE.h"

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

Public Types

using child_iterator = IntrusiveBackList< DIE >::iterator
 
using const_child_iterator = IntrusiveBackList< DIE >::const_iterator
 
using child_range = iterator_range< child_iterator >
 
using const_child_range = iterator_range< const_child_iterator >
 
- Public Types inherited from llvm::DIEValueList
using value_range = iterator_range< value_iterator >
 
using const_value_range = iterator_range< const_value_iterator >
 

Public Member Functions

 DIE ()=delete
 
 DIE (const DIE &RHS)=delete
 
 DIE (DIE &&RHS)=delete
 
DIEoperator= (const DIE &RHS)=delete
 
DIEoperator= (const DIE &&RHS)=delete
 
unsigned getAbbrevNumber () const
 
dwarf::Tag getTag () const
 
unsigned getOffset () const
 Get the compile/type unit relative offset of this DIE.
 
unsigned getSize () const
 
bool hasChildren () const
 
void setForceChildren (bool B)
 
child_range children ()
 
const_child_range children () const
 
DIEgetParent () const
 
DIEAbbrev generateAbbrev () const
 Generate the abbreviation for this DIE.
 
void setAbbrevNumber (unsigned I)
 Set the abbreviation number for this DIE.
 
uint64_t getDebugSectionOffset () const
 Get the absolute offset within the .debug_info or .debug_types section for this DIE.
 
unsigned computeOffsetsAndAbbrevs (const dwarf::FormParams &FormParams, DIEAbbrevSet &AbbrevSet, unsigned CUOffset)
 Compute the offset of this DIE and all its children.
 
const DIEgetUnitDie () const
 Climb up the parent chain to get the compile unit or type unit DIE that this DIE belongs to.
 
DIEUnitgetUnit () const
 Climb up the parent chain to get the compile unit or type unit that this DIE belongs to.
 
void setOffset (unsigned O)
 
void setSize (unsigned S)
 
DIEaddChild (DIE *Child)
 Add a child to the DIE.
 
DIEaddChildFront (DIE *Child)
 
DIEValue findAttribute (dwarf::Attribute Attribute) const
 Find a value in the DIE with the attribute given.
 
void print (raw_ostream &O, unsigned IndentCount=0) const
 
void dump () const
 
- Public Member Functions inherited from llvm::DIEValueList
value_iterator addValue (BumpPtrAllocator &Alloc, const DIEValue &V)
 
template<class T >
value_iterator addValue (BumpPtrAllocator &Alloc, dwarf::Attribute Attribute, dwarf::Form Form, T &&Value)
 
template<class T >
bool replaceValue (BumpPtrAllocator &Alloc, dwarf::Attribute Attribute, dwarf::Attribute NewAttribute, dwarf::Form Form, T &&NewValue)
 
template<class T >
bool replaceValue (BumpPtrAllocator &Alloc, dwarf::Attribute Attribute, dwarf::Form Form, T &&NewValue)
 
bool replaceValue (BumpPtrAllocator &Alloc, dwarf::Attribute Attribute, dwarf::Form Form, DIEValue &NewValue)
 
bool deleteValue (dwarf::Attribute Attribute)
 
void takeValues (DIEValueList &Other)
 Take ownership of the nodes in Other, and append them to the back of the list.
 
value_range values ()
 
const_value_range values () const
 

Static Public Member Functions

static DIEget (BumpPtrAllocator &Alloc, dwarf::Tag Tag)
 

Friends

class IntrusiveBackList< DIE >
 
class DIEUnit
 

Detailed Description

A structured debug information entry.

Has an abbreviation which describes its organization.

Definition at line 819 of file DIE.h.

Member Typedef Documentation

◆ child_iterator

Definition at line 870 of file DIE.h.

◆ child_range

Definition at line 872 of file DIE.h.

◆ const_child_iterator

Definition at line 871 of file DIE.h.

◆ const_child_range

Definition at line 873 of file DIE.h.

Constructor & Destructor Documentation

◆ DIE() [1/3]

llvm::DIE::DIE ( )
delete

Referenced by get().

◆ DIE() [2/3]

llvm::DIE::DIE ( const DIE RHS)
delete

◆ DIE() [3/3]

llvm::DIE::DIE ( DIE &&  RHS)
delete

Member Function Documentation

◆ addChild()

DIE & llvm::DIE::addChild ( DIE Child)
inline

◆ addChildFront()

DIE & llvm::DIE::addChildFront ( DIE Child)
inline

Definition at line 941 of file DIE.h.

References assert(), and getParent().

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

◆ children() [1/2]

child_range llvm::DIE::children ( )
inline

Definition at line 875 of file DIE.h.

References llvm::make_range().

Referenced by computeOffsetsAndAbbrevs(), llvm::AsmPrinter::emitDwarfDIE(), and print().

◆ children() [2/2]

const_child_range llvm::DIE::children ( ) const
inline

Definition at line 878 of file DIE.h.

References llvm::make_range().

◆ computeOffsetsAndAbbrevs()

unsigned DIE::computeOffsetsAndAbbrevs ( const dwarf::FormParams FormParams,
DIEAbbrevSet AbbrevSet,
unsigned  CUOffset 
)

Compute the offset of this DIE and all its children.

This function gets called just before we are going to generate the debug information and gives each DIE a chance to figure out its CU relative DIE offset, unique its abbreviation and fill in the abbreviation code, and return the unit offset that points to where the next DIE will be emitted within the debug unit section. After this function has been called for all DIE objects, the DWARF can be generated since all DIEs will be able to properly refer to other DIE objects since all DIEs have calculated their offsets.

Parameters
FormParamsUsed when calculating sizes.
AbbrevSetthe abbreviation used to unique DIE abbreviations.
CUOffsetthe compile/type unit relative offset in bytes.
Returns
the offset for the DIE that follows this DIE within the current compile/type unit.

Definition at line 266 of file DIE.cpp.

References assert(), children(), getAbbrevNumber(), getOffset(), llvm::getULEB128Size(), llvm::DIEAbbrev::hasChildren(), hasChildren(), setOffset(), setSize(), llvm::DIEAbbrevSet::uniqueAbbreviation(), and llvm::DIEValueList::values().

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

◆ dump()

LLVM_DUMP_METHOD void DIE::dump ( ) const

◆ findAttribute()

DIEValue DIE::findAttribute ( dwarf::Attribute  Attribute) const

Find a value in the DIE with the attribute given.

Returns a default-constructed DIEValue (where DIEValue::getType() gives DIEValue::isNone) if no such attribute exists.

Definition at line 210 of file DIE.cpp.

References llvm::DIEValueList::values().

Referenced by computeIndexValue(), llvm::DwarfCompileUnit::constructCallSiteEntryDIE(), and llvm::DWARF5AccelTableData::getDefiningParentDieOffset().

◆ generateAbbrev()

DIEAbbrev DIE::generateAbbrev ( ) const

Generate the abbreviation for this DIE.

Calculate the abbreviation for this, which should be uniqued and eventually used to call setAbbrevNumber().

Definition at line 174 of file DIE.cpp.

References llvm::DIEAbbrev::AddAttribute(), llvm::DIEAbbrev::AddImplicitConstAttribute(), hasChildren(), and llvm::DIEValueList::values().

Referenced by llvm::dwarf_linker::parallel::DIEGenerator::finalizeAbbreviations(), and llvm::DIEAbbrevSet::uniqueAbbreviation().

◆ get()

static DIE * llvm::DIE::get ( BumpPtrAllocator Alloc,
dwarf::Tag  Tag 
)
inlinestatic

◆ getAbbrevNumber()

unsigned llvm::DIE::getAbbrevNumber ( ) const
inline

◆ getDebugSectionOffset()

uint64_t DIE::getDebugSectionOffset ( ) const

Get the absolute offset within the .debug_info or .debug_types section for this DIE.

Definition at line 185 of file DIE.cpp.

References assert(), getOffset(), and getUnit().

Referenced by llvm::AppleAccelTableOffsetData::emit(), llvm::AppleAccelTableTypeData::emit(), and llvm::DIEEntry::emitValue().

◆ getOffset()

unsigned llvm::DIE::getOffset ( ) const
inline

◆ getParent()

DIE * DIE::getParent ( ) const

◆ getSize()

unsigned llvm::DIE::getSize ( ) const
inline

◆ getTag()

dwarf::Tag llvm::DIE::getTag ( ) const
inline

◆ getUnit()

DIEUnit * DIE::getUnit ( ) const

Climb up the parent chain to get the compile unit or type unit that this DIE belongs to.

Returns
the DIEUnit that represents the compile or type unit that owns this DIE, or NULL if this DIE hasn't been added to a unit DIE.

Definition at line 203 of file DIE.cpp.

References getUnitDie().

Referenced by llvm::DwarfUnit::addDIEEntry(), llvm::DIEEntry::emitValue(), getDebugSectionOffset(), llvm::DwarfUnit::getOrCreateSubprogramDIE(), and llvm::DwarfUnit::getOrCreateTypeDIE().

◆ getUnitDie()

const DIE * DIE::getUnitDie ( ) const

Climb up the parent chain to get the compile unit or type unit DIE that this DIE belongs to.

Returns
the compile or type unit DIE that owns this DIE, or NULL if this DIE hasn't been added to a unit DIE.

Definition at line 191 of file DIE.cpp.

Referenced by llvm::DwarfCompileUnit::constructAbstractSubprogramScopeDIE(), and getUnit().

◆ hasChildren()

bool llvm::DIE::hasChildren ( ) const
inline

◆ operator=() [1/2]

DIE & llvm::DIE::operator= ( const DIE &&  RHS)
delete

◆ operator=() [2/2]

DIE & llvm::DIE::operator= ( const DIE RHS)
delete

◆ print()

LLVM_DUMP_METHOD void DIE::print ( raw_ostream O,
unsigned  IndentCount = 0 
) const

◆ setAbbrevNumber()

void llvm::DIE::setAbbrevNumber ( unsigned  I)
inline

Set the abbreviation number for this DIE.

Definition at line 891 of file DIE.h.

References I.

Referenced by llvm::dwarf_linker::parallel::DIEGenerator::finalizeAbbreviations(), and llvm::DIEAbbrevSet::uniqueAbbreviation().

◆ setForceChildren()

void llvm::DIE::setForceChildren ( bool  B)
inline

Definition at line 868 of file DIE.h.

References B.

◆ setOffset()

void llvm::DIE::setOffset ( unsigned  O)
inline

◆ setSize()

void llvm::DIE::setSize ( unsigned  S)
inline

Definition at line 931 of file DIE.h.

References Size.

Referenced by computeOffsetsAndAbbrevs(), and llvm::dwarf_linker::parallel::TypeUnit::createDIETree().

Friends And Related Function Documentation

◆ DIEUnit

friend class DIEUnit
friend

Definition at line 821 of file DIE.h.

◆ IntrusiveBackList< DIE >

friend class IntrusiveBackList< DIE >
friend

Definition at line 734 of file DIE.h.


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