LLVM  5.0.0
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:
[legend]
Collaboration diagram for llvm::DwarfUnit:
[legend]

Public Member Functions

AsmPrinter * getAsmPrinter () const
 
uint16_t getLanguage () const
 
const DICompileUnit * getCUNode () const
 
bool hasContent () const
 Return true if this compile unit has something to write out. More...
 
std::string getParentContextString (const DIScope *Context) const
 Get string containing language specific context for a global name. More...
 
virtual void addGlobalName (StringRef Name, const DIE &Die, const DIScope *Context)=0
 Add a new global name to the compile unit. More...
 
virtual void addGlobalType (const DIType *Ty, const DIE &Die, const DIScope *Context)=0
 Add a new global type to the compile unit. More...
 
DIE * getDIE (const DINode *D) const
 Returns the DIE map slot for the specified debug variable. More...
 
DIELoc * getDIELoc ()
 Returns a fresh newly allocated DIELoc. More...
 
void insertDIE (const DINode *Desc, DIE *D)
 Insert DIE into the map. More...
 
void addFlag (DIE &Die, dwarf::Attribute Attribute)
 Add a flag that is true to the DIE. More...
 
void addUInt (DIEValueList &Die, dwarf::Attribute Attribute, Optional< dwarf::Form > Form, uint64_t Integer)
 Add an unsigned integer attribute data and value. More...
 
void addUInt (DIEValueList &Block, dwarf::Form Form, uint64_t Integer)
 
void addSInt (DIEValueList &Die, dwarf::Attribute Attribute, Optional< dwarf::Form > Form, int64_t Integer)
 Add an signed integer attribute data and value. More...
 
void addSInt (DIELoc &Die, Optional< dwarf::Form > Form, int64_t Integer)
 
void addString (DIE &Die, dwarf::Attribute Attribute, StringRef Str)
 Add a string attribute data and value. More...
 
DIEValueList::value_iterator addLabel (DIEValueList &Die, dwarf::Attribute Attribute, dwarf::Form Form, const MCSymbol *Label)
 Add a Dwarf label attribute data and value. More...
 
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. More...
 
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_FORM_GNU_addr_index. More...
 
void addLabelDelta (DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)
 Add a label delta attribute data and value. More...
 
void addDIEEntry (DIE &Die, dwarf::Attribute Attribute, DIE &Entry)
 Add a DIE attribute data and value. More...
 
void addDIEEntry (DIE &Die, dwarf::Attribute Attribute, DIEEntry Entry)
 Add a DIE attribute data and value. More...
 
void addDIETypeSignature (DIE &Die, uint64_t Signature)
 Add a type's DW_AT_signature and set the declaration flag. More...
 
void addBlock (DIE &Die, dwarf::Attribute Attribute, DIELoc *Block)
 Add block data. More...
 
void addBlock (DIE &Die, dwarf::Attribute Attribute, DIEBlock *Block)
 Add block data. More...
 
void addSourceLine (DIE &Die, unsigned Line, StringRef File, StringRef Directory)
 Add location information to specified debug information entry. More...
 
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 DIType *Ty)
 
void addSourceLine (DIE &Die, const DIObjCProperty *Ty)
 
void addConstantValue (DIE &Die, const MachineOperand &MO, const DIType *Ty)
 Add constant value entry in variable DIE. More...
 
void addConstantValue (DIE &Die, const ConstantInt *CI, const DIType *Ty)
 
void addConstantValue (DIE &Die, const APInt &Val, const DIType *Ty)
 
void addConstantValue (DIE &Die, const APInt &Val, bool Unsigned)
 
void addConstantValue (DIE &Die, bool Unsigned, uint64_t Val)
 
void addConstantFPValue (DIE &Die, const MachineOperand &MO)
 Add constant value entry in variable DIE. More...
 
void addConstantFPValue (DIE &Die, const ConstantFP *CFP)
 
void addLinkageName (DIE &Die, StringRef LinkageName)
 Add a linkage name, if it isn't empty. More...
 
void addTemplateParams (DIE &Buffer, DINodeArray TParams)
 Add template parameters in buffer. More...
 
void addThrownTypes (DIE &Die, DINodeArray ThrownTypes)
 Add thrown types. More...
 
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 to find the actual Block variable (navigating the Block struct) based on the starting location. More...
 
void addType (DIE &Entity, const DIType *Ty, dwarf::Attribute Attribute=dwarf::DW_AT_type)
 Add a new type attribute to the specified entity. More...
 
DIE * getOrCreateNameSpace (const DINamespace *NS)
 
DIE * getOrCreateModule (const DIModule *M)
 
DIE * getOrCreateSubprogramDIE (const DISubprogram *SP, bool Minimal=false)
 
void applySubprogramAttributes (const DISubprogram *SP, DIE &SPDie, bool SkipSPAttributes=false)
 
DIE * getOrCreateTypeDIE (const MDNode *N)
 Find existing DIE or create new DIE for the given type. More...
 
DIE * getOrCreateContextDIE (const DIScope *Context)
 Get context owner's DIE. More...
 
void constructContainingTypeDIEs ()
 Construct DIEs for types that contain vtables. More...
 
void constructSubprogramArguments (DIE &Buffer, DITypeRefArray Args)
 Construct function argument DIEs. More...
 
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. More...
 
virtual unsigned getHeaderSize () const
 Compute the size of a header for this unit, not including the initial length field. More...
 
virtual void emitHeader (bool UseOffsets)=0
 Emit the header for this unit, not including the initial length field. More...
 
virtual DwarfCompileUnit & getCU ()=0
 
void constructTypeDIE (DIE &Buffer, const DICompositeType *CTy)
 
DIE::value_iterator addSectionDelta (DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)
 addSectionDelta - Add a label delta attribute data and value. More...
 
DIE::value_iterator addSectionLabel (DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label, const MCSymbol *Sec)
 Add a Dwarf section label attribute data and value. More...
 
- Public Member Functions inherited from llvm::DIEUnit
 DIEUnit (uint16_t Version, uint8_t AddrSize, 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. More...
 
MCSection * getSection () const
 Return the section that this DIEUnit will be emitted into. More...
 
void setDebugSectionOffset (unsigned O)
 
unsigned getDebugSectionOffset () const
 
void setLength (uint64_t L)
 
uint64_t getLength () const
 
uint16_t getDwarfVersion () const
 
uint16_t getAddressSize () const
 
DIE & getUnitDie ()
 
const DIE & getUnitDie () const
 

Protected Member Functions

 DwarfUnit (dwarf::Tag, const DICompileUnit *CU, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU)
 
bool applySubprogramDefinitionAttributes (const DISubprogram *SP, DIE &SPDie)
 
bool shareAcrossDWOCUs () const
 
bool isShareableAcrossCUs (const DINode *D) const
 Check whether the DIE for this MDNode can be shared across CUs. More...
 
 ~DwarfUnit ()
 
DIE * getOrCreateStaticMemberDIE (const DIDerivedType *DT)
 Create new static data member DIE. More...
 
virtual unsigned getOrCreateSourceID (StringRef File, StringRef Directory)=0
 Look up the source ID with the given directory and source file names. More...
 
template<typename T >
T * resolve (TypedDINodeRef< T > Ref) const
 Look in the DwarfDebug map for the MDNode that corresponds to the reference. More...
 
void updateAcceleratorTables (const DIScope *Context, const DIType *Ty, const DIE &TyDIE)
 If this is a named finished type then include it in the list of types for the accelerator tables. More...
 
void emitCommonHeader (bool UseOffsets, dwarf::UnitType UT)
 Emit the common part of the header for this unit. More...
 
- Protected Member Functions inherited from llvm::DIEUnit
 ~DIEUnit ()=default
 The size in bytes of an address for this unit. More...
 

Protected Attributes

const DICompileUnit * CUNode
 MDNode for the compile unit. More...
 
BumpPtrAllocator DIEValueAllocator
 
AsmPrinter * Asm
 Target of Dwarf emission. More...
 
DwarfDebug * DD
 
DwarfFile * DU
 
DIE * IndexTyDie
 An anonymous type for index type. Owned by DIEUnit. More...
 
DenseMap< const MDNode *, DIE * > MDNodeToDieMap
 Tracks the mapping of unit level debug information variables to debug information entries. More...
 
std::vector< DIEBlock * > DIEBlocks
 A list of all the DIEBlocks in use. More...
 
std::vector< DIELoc * > DIELocs
 A list of all the DIELocs in use. More...
 
DenseMap< DIE *, const DINode * > ContainingTypeMap
 This map is used to keep track of subprogram DIEs that need DW_AT_containing_type attribute. More...
 

Detailed Description

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

Definition at line 68 of file DwarfUnit.h.

Constructor & Destructor Documentation

DwarfUnit::DwarfUnit ( dwarf::Tag  UnitTag,
const DICompileUnit *  CU,
AsmPrinter *  A,
DwarfDebug *  DW,
DwarfFile *  DWU 
)
protected

Definition at line 75 of file DwarfUnit.cpp.

DwarfUnit::~DwarfUnit ( )
protected

Definition at line 90 of file DwarfUnit.cpp.

References DIEBlocks, and DIELocs.

Member Function Documentation

void DwarfUnit::addBlock ( DIE &  Die,
dwarf::Attribute  Attribute,
DIELoc *  Block 
)
void DwarfUnit::addBlock ( DIE &  Die,
dwarf::Attribute  Attribute,
DIEBlock *  Block 
)
void DwarfUnit::addBlockByrefAddress ( const DbgVariable &  DV,
DIE &  Die,
dwarf::Attribute  Attribute,
const MachineLocation &  Location 
)
void DwarfUnit::addConstantFPValue ( DIE &  Die,
const MachineOperand &  MO 
)
void DwarfUnit::addConstantFPValue ( DIE &  Die,
const ConstantFP *  CFP 
)
void DwarfUnit::addConstantValue ( DIE &  Die,
const MachineOperand &  MO,
const DIType *  Ty 
)
void DwarfUnit::addConstantValue ( DIE &  Die,
const ConstantInt *  CI,
const DIType *  Ty 
)

Definition at line 593 of file DwarfUnit.cpp.

References addConstantValue(), and llvm::ConstantInt::getValue().

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

Definition at line 612 of file DwarfUnit.cpp.

References addConstantValue(), DD, and isUnsignedDIType().

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

Definition at line 605 of file DwarfUnit.cpp.

References addUInt().

void DwarfUnit::addDIEEntry ( DIE &  Die,
dwarf::Attribute  Attribute,
DIE &  Entry 
)
void DwarfUnit::addDIEEntry ( DIE &  Die,
dwarf::Attribute  Attribute,
DIEEntry  Entry 
)
void DwarfUnit::addDIETypeSignature ( DIE &  Die,
uint64_t  Signature 
)

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

Definition at line 292 of file DwarfUnit.cpp.

References addFlag(), llvm::DIEValueList::addValue(), and DIEValueAllocator.

Referenced by llvm::DwarfDebug::addDwarfTypeUnitType().

void DwarfUnit::addFlag ( DIE &  Die,
dwarf::Attribute  Attribute 
)
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::DwarfTypeUnit, and llvm::DwarfCompileUnit.

Referenced by getOrCreateModule(), and getOrCreateNameSpace().

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

Add a new global type to the compile unit.

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

Referenced by updateAcceleratorTables().

DIEValueList::value_iterator DwarfUnit::addLabel ( DIEValueList &  Die,
dwarf::Attribute  Attribute,
dwarf::Form  Form,
const MCSymbol *  Label 
)

Add a Dwarf label attribute data and value.

Definition at line 247 of file DwarfUnit.cpp.

References llvm::DIEValueList::addValue(), and DIEValueAllocator.

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

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

Definition at line 254 of file DwarfUnit.cpp.

References addLabel().

void DwarfUnit::addLabelDelta ( DIE &  Die,
dwarf::Attribute  Attribute,
const MCSymbol *  Hi,
const MCSymbol *  Lo 
)

Add a label delta attribute data and value.

Definition at line 282 of file DwarfUnit.cpp.

References llvm::DIEValueList::addValue(), and DIEValueAllocator.

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

void DwarfUnit::addLinkageName ( DIE &  Die,
StringRef  LinkageName 
)
void DwarfUnit::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_FORM_GNU_addr_index.

Definition at line 271 of file DwarfUnit.cpp.

References addLabel(), addUInt(), DD, llvm::DwarfDebug::getAddressPool(), llvm::AddressPool::getIndex(), and llvm::DwarfDebug::useSplitDwarf().

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

DIE::value_iterator 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 1591 of file DwarfUnit.cpp.

References llvm::DIEValueList::addValue(), DD, DIEValueAllocator, and llvm::DwarfDebug::getDwarfVersion().

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

DIE::value_iterator DwarfUnit::addSectionLabel ( DIE &  Die,
dwarf::Attribute  Attribute,
const MCSymbol *  Label,
const MCSymbol *  Sec 
)
void DwarfUnit::addSectionOffset ( DIE &  Die,
dwarf::Attribute  Attribute,
uint64_t  Integer 
)

Add an offset into a section attribute data and value.

Definition at line 258 of file DwarfUnit.cpp.

References addUInt(), DD, and llvm::DwarfDebug::getDwarfVersion().

Referenced by llvm::DwarfTypeUnit::DwarfTypeUnit().

void DwarfUnit::addSInt ( DIEValueList &  Die,
dwarf::Attribute  Attribute,
Optional< dwarf::Form >  Form,
int64_t  Integer 
)

Add an signed integer attribute data and value.

Definition at line 228 of file DwarfUnit.cpp.

References llvm::DIEValueList::addValue(), llvm::DIEInteger::BestForm(), and DIEValueAllocator.

Referenced by addSInt().

void DwarfUnit::addSInt ( DIELoc &  Die,
Optional< dwarf::Form >  Form,
int64_t  Integer 
)

Definition at line 235 of file DwarfUnit.cpp.

References addSInt().

void DwarfUnit::addSourceLine ( DIE &  Die,
unsigned  Line,
StringRef  File,
StringRef  Directory 
)
void DwarfUnit::addSourceLine ( DIE &  Die,
const DILocalVariable *  V 
)
void DwarfUnit::addSourceLine ( DIE &  Die,
const DIGlobalVariable *  G 
)
void DwarfUnit::addSourceLine ( DIE &  Die,
const DISubprogram *  SP 
)
void DwarfUnit::addSourceLine ( DIE &  Die,
const DIType *  Ty 
)
void DwarfUnit::addSourceLine ( DIE &  Die,
const DIObjCProperty *  Ty 
)
void DwarfUnit::addString ( DIE &  Die,
dwarf::Attribute  Attribute,
StringRef  Str 
)

Add a string attribute data and value.

We always emit a reference to the string pool instead of immediate strings so that DIEs have more predictable sizes. In the case of split dwarf we emit an index into another table which gets us the static offset into the string table.

Definition at line 240 of file DwarfUnit.cpp.

References llvm::DIEValueList::addValue(), Asm, DIEValueAllocator, DU, llvm::DwarfStringPool::getEntry(), and llvm::DwarfFile::getStringPool().

Referenced by addLinkageName(), applySubprogramAttributes(), llvm::DwarfCompileUnit::applyVariableAttributes(), llvm::DwarfCompileUnit::constructImportedEntityDIE(), constructTypeDIE(), llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE(), getOrCreateModule(), getOrCreateNameSpace(), and getOrCreateStaticMemberDIE().

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

Add template parameters in buffer.

Definition at line 653 of file DwarfUnit.cpp.

Referenced by applySubprogramDefinitionAttributes(), and constructTypeDIE().

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

Add thrown types.

Definition at line 664 of file DwarfUnit.cpp.

References addType(), and createAndAddDIE().

Referenced by applySubprogramAttributes().

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 766 of file DwarfUnit.cpp.

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

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

void DwarfUnit::addUInt ( DIEValueList &  Die,
dwarf::Attribute  Attribute,
Optional< dwarf::Form >  Form,
uint64_t  Integer 
)
void DwarfUnit::addUInt ( DIEValueList &  Block,
dwarf::Form  Form,
uint64_t  Integer 
)

Definition at line 223 of file DwarfUnit.cpp.

References addUInt().

void DwarfUnit::applySubprogramAttributes ( const DISubprogram *  SP,
DIE &  SPDie,
bool  SkipSPAttributes = false 
)
bool DwarfUnit::applySubprogramDefinitionAttributes ( const DISubprogram *  SP,
DIE &  SPDie 
)
protected
void DwarfUnit::constructContainingTypeDIEs ( )

Construct DIEs for types that contain vtables.

Definition at line 1377 of file DwarfUnit.cpp.

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

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

Construct function argument DIEs.

Definition at line 862 of file DwarfUnit.cpp.

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

Referenced by applySubprogramAttributes().

void DwarfUnit::constructTypeDIE ( DIE &  Buffer,
const DICompositeType *  CTy 
)
DIE & DwarfUnit::createAndAddDIE ( unsigned  Tag,
DIE &  Parent,
const DINode *  N = nullptr 
)
void DwarfUnit::emitCommonHeader ( bool  UseOffsets,
dwarf::UnitType  UT 
)
protected
virtual void llvm::DwarfUnit::emitHeader ( bool  UseOffsets)
pure virtual

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

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

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

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

Definition at line 111 of file DwarfUnit.h.

References Asm.

virtual DwarfCompileUnit& llvm::DwarfUnit::getCU ( )
pure virtual
const DICompileUnit* llvm::DwarfUnit::getCUNode ( ) const
inline

Definition at line 113 of file DwarfUnit.h.

References CUNode.

Referenced by forBothCUs(), and llvm::DwarfCompileUnit::includeMinimalInlineScopes().

DIE * DwarfUnit::getDIE ( const DINode *  D) const
DIELoc* llvm::DwarfUnit::getDIELoc ( )
inline

Returns a fresh newly allocated DIELoc.

Definition at line 143 of file DwarfUnit.h.

References DIEValueAllocator.

Referenced by applySubprogramAttributes().

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::DwarfTypeUnit.

Definition at line 279 of file DwarfUnit.h.

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

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

uint16_t llvm::DwarfUnit::getLanguage ( ) const
inline
DIE * DwarfUnit::getOrCreateContextDIE ( const DIScope *  Context)
DIE * DwarfUnit::getOrCreateModule ( const DIModule *  M)
DIE * DwarfUnit::getOrCreateNameSpace ( const DINamespace *  NS)
virtual unsigned llvm::DwarfUnit::getOrCreateSourceID ( StringRef  File,
StringRef  Directory 
)
protectedpure virtual

Look up the source ID with the given directory and source file names.

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

Implemented in llvm::DwarfCompileUnit.

Referenced by addSourceLine(), and applySubprogramDefinitionAttributes().

DIE * DwarfUnit::getOrCreateStaticMemberDIE ( const DIDerivedType *  DT)
protected
DIE * DwarfUnit::getOrCreateSubprogramDIE ( const DISubprogram *  SP,
bool  Minimal = false 
)
DIE * DwarfUnit::getOrCreateTypeDIE ( const MDNode *  N)
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 772 of file DwarfUnit.cpp.

References llvm::StringRef::empty(), getLanguage(), llvm::DIScope::getScope(), llvm::make_range(), Name, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorTemplateCommon< T >::rbegin(), llvm::SmallVectorTemplateCommon< T >::rend(), and resolve().

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

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

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

Definition at line 116 of file DwarfUnit.h.

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

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 197 of file DwarfUnit.cpp.

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

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

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

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

Definition at line 176 of file DwarfUnit.cpp.

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

Referenced by getDIE(), and insertDIE().

template<typename T >
T* llvm::DwarfUnit::resolve ( TypedDINodeRef< T >  Ref) const
inlineprotected
bool llvm::DwarfUnit::shareAcrossDWOCUs ( ) const
protected
void DwarfUnit::updateAcceleratorTables ( const DIScope *  Context,
const DIType *  Ty,
const DIE &  TyDIE 
)
protected

If this is a named finished type then include it in the list of types for the accelerator tables.

Definition at line 748 of file DwarfUnit.cpp.

References llvm::DwarfDebug::addAccelType(), addGlobalType(), Context, DD, llvm::dwarf::DW_FLAG_type_implementation, llvm::StringRef::empty(), Flags, llvm::DIType::getName(), and llvm::DIType::isForwardDecl().

Referenced by llvm::DwarfTypeUnit::createTypeDIE(), and getOrCreateTypeDIE().

Member Data Documentation

AsmPrinter* llvm::DwarfUnit::Asm
protected
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 99 of file DwarfUnit.h.

Referenced by applySubprogramAttributes(), and constructContainingTypeDIEs().

const DICompileUnit* llvm::DwarfUnit::CUNode
protected

MDNode for the compile unit.

Definition at line 71 of file DwarfUnit.h.

Referenced by applySubprogramAttributes(), getCUNode(), and getLanguage().

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

A list of all the DIEBlocks in use.

Definition at line 91 of file DwarfUnit.h.

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

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

A list of all the DIELocs in use.

Definition at line 94 of file DwarfUnit.h.

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

BumpPtrAllocator llvm::DwarfUnit::DIEValueAllocator
protected
DwarfFile* llvm::DwarfUnit::DU
protected
DIE* llvm::DwarfUnit::IndexTyDie
protected

An anonymous type for index type. Owned by DIEUnit.

Definition at line 84 of file DwarfUnit.h.

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

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

Definition at line 88 of file DwarfUnit.h.

Referenced by getDIE(), and insertDIE().


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