LLVM: llvm::DwarfCompileUnit Class Reference (original) (raw)
Public Member Functions
DwarfCompileUnit (unsigned UID, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, UnitKind Kind=UnitKind::Full)
getSkeleton () const
includeMinimalInlineScopes () const
emitFuncLineTableOffsets () const
void
initStmtList ()
void
applyStmtList (DIE &D)
Apply the DW_AT_stmt_list from this compile unit to the specified DIE.
MCSymbol *
Get line table start symbol for this unit.
DIE *
getOrCreateGlobalVariableDIE (const DIGlobalVariable *GV, ArrayRef< GlobalExpr > GlobalExprs)
Get or create global variable DIE.
DIE *
getOrCreateCommonBlock (const DICommonBlock *CB, ArrayRef< GlobalExpr > GlobalExprs)
void
addLocationAttribute (DIE *ToDIE, const DIGlobalVariable *GV, ArrayRef< GlobalExpr > GlobalExprs)
void
addLabelAddress (DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label)
addLabelAddress - Add a dwarf label attribute data and value using either DW_FORM_addr or DW_FORM_GNU_addr_index.
void
addLocalLabelAddress (DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label)
addLocalLabelAddress - Add a dwarf label attribute data and value using DW_FORM_addr only.
getCU () override
getOrCreateSourceID (const DIFile *File) override
Look up the source ID for the given file.
void
addRange - Add an address range to the list of ranges for this unit.
void
attachLowHighPC (DIE &D, const MCSymbol *Begin, const MCSymbol *End)
DIE &
updateSubprogramScopeDIE (const DISubprogram *SP, const Function &F, MCSymbol *LineTableSym)
Find DIE for the given subprogram and attach appropriate DW_AT_low_pc, DW_AT_high_pc and DW_AT_LLVM_stmt_sequence attributes.
void
constructScopeDIE (LexicalScope *Scope, DIE &ParentScopeDIE)
void
addScopeRangeList (DIE &ScopeDIE, SmallVector< RangeSpan, 2 > Range)
A helper function to construct a RangeSpanList for a given lexical scope.
void
attachRangesOrLowHighPC (DIE &D, SmallVector< RangeSpan, 2 > Ranges)
void
attachRangesOrLowHighPC (DIE &D, const SmallVectorImpl< InsnRange > &Ranges)
DIE *
constructInlinedScopeDIE (LexicalScope *Scope, DIE &ParentScopeDIE)
This scope represents an inlined body of a function.
DIE *
constructLexicalScopeDIE (LexicalScope *Scope)
Construct new DW_TAG_lexical_block for this scope and attach DW_AT_low_pc/DW_AT_high_pc labels.
DIE *
getLexicalBlockDIE (const DILexicalBlock *LB)
Get a DIE for the given DILexicalBlock.
DIE *
constructVariableDIE (DbgVariable &DV, bool Abstract=false)
Construct a DIE for the given DbgVariable.
DIE *
constructVariableDIE (DbgVariable &DV, const LexicalScope &Scope, DIE *&ObjectPointer)
Convenience overload which writes the DIE pointer into an out variable ObjectPointer in addition to returning it.
DIE *
constructLabelDIE (DbgLabel &DL, const LexicalScope &Scope)
Construct a DIE for the given DbgLabel.
void
DIE *
getOrCreateContextDIE (const DIScope *Ty) override
Construct a DIE for a given scope.
DIE *
getOrCreateSubprogramDIE (const DISubprogram *SP, const Function *F, bool Minimal=false) override
DIE &
constructSubprogramScopeDIE (const DISubprogram *Sub, const Function &F, LexicalScope *Scope, MCSymbol *LineTableSym)
Construct a DIE for this subprogram scope.
DIE *
createAndAddScopeChildren (LexicalScope *Scope, DIE &ScopeDIE)
DIE &
getOrCreateAbstractSubprogramDIE (const DISubprogram *SP)
Create an abstract subprogram DIE, that should later be populated by constructAbstractSubprogramScopeDIE.
void
constructAbstractSubprogramScopeDIE (LexicalScope *Scope)
useGNUAnalogForDwarf5Feature () const
Whether to use the GNU analog for a DWARF5 tag, attribute, or location atom.
getDwarf5OrGNUTag (dwarf::Tag Tag) const
This takes a DWARF 5 tag and returns it or a GNU analog.
getDwarf5OrGNUAttr (dwarf::Attribute Attr) const
This takes a DWARF 5 attribute and returns it or a GNU analog.
getDwarf5OrGNULocationAtom (dwarf::LocationAtom Loc) const
This takes a DWARF 5 location atom and either returns it or a GNU analog.
DIE &
constructCallSiteEntryDIE (DIE &ScopeDIE, const DISubprogram *CalleeSP, const Function *CalleeF, bool IsTail, const MCSymbol *PCAddr, const MCSymbol *CallAddr, unsigned CallReg, DIType *AllocSiteTy)
Construct a call site entry DIE describing a call within Scope to a callee described by CalleeSP and CalleeF.
void
constructCallSiteParmEntryDIEs (DIE &CallSiteDIE, SmallVector< DbgCallSiteParam, 4 > &Params)
Construct call site parameter DIEs for the CallSiteDIE.
DIE *
getOrCreateImportedEntityDIE (const DIImportedEntity *IE)
Get or create a DIE for an imported entity.
DIE *
constructImportedEntityDIE (const DIImportedEntity *IE)
void
finishSubprogramDefinition (const DISubprogram *SP)
void
finishEntityDefinition (const DbgEntity *Entity)
void
attachLexicalScopesAbstractOrigins ()
getExistingAbstractEntity (const DINode *Node)
void
createAbstractEntity (const DINode *Node, LexicalScope *Scope)
void
setSkeleton (DwarfCompileUnit &Skel)
Set the skeleton unit associated with this unit.
getHeaderSize () const override
Compute the size of a header for this unit, not including the initial length field.
getLength ()
void
emitHeader (bool UseOffsets) override
Emit the header for this unit, not including the initial length field.
void
Add the DW_AT_addr_base attribute to the unit DIE.
MCSymbol *
void
addGlobalName (StringRef Name, const DIE &Die, const DIScope *Context) override
Add a new global name to the compile unit.
void
addGlobalNameForTypeUnit (StringRef Name, const DIScope *Context)
Add a new global name present in a type unit to this compile unit.
void
addGlobalTypeImpl (const DIType *Ty, const DIE &Die, const DIScope *Context) override
Add a new global type to the compile unit.
void
addGlobalTypeUnitType (const DIType *Ty, const DIScope *Context)
Add a new global type present in a type unit to this compile unit.
const StringMap< const DIE * > &
const StringMap< const DIE * > &
void
addVariableAddress (const DbgVariable &DV, DIE &Die, MachineLocation Location)
Add DW_AT_location attribute for a DbgVariable based on provided MachineLocation.
void
addAddress (DIE &Die, dwarf::Attribute Attribute, const MachineLocation &Location)
Add an address attribute to a die based on the location provided.
void
addComplexAddress (const DIExpression *DIExpr, 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 variable (navigating the extra location information encoded in the type) based on the starting location.
void
addLocationList (DIE &Die, dwarf::Attribute Attribute, unsigned Index)
Add a Dwarf loclistptr attribute data and value.
void
applyCommonDbgVariableAttributes (const DbgVariable &Var, DIE &VariableDie)
Add attributes to Var which reflect the common attributes of VariableDie, namely those which are not dependant on the active variant.
void
addExpr (DIELoc &Die, dwarf::Form Form, const MCExpr *Expr)
Add a Dwarf expression attribute data and value.
void
applySubprogramAttributesToDefinition (const DISubprogram *SP, DIE &SPDie)
void
applyLabelAttributes (const DbgLabel &Label, DIE &LabelDie)
const SmallVectorImpl< RangeSpan > &
getRanges - Get the list of ranges for this unit.
SmallVector< RangeSpan, 2 >
takeRanges ()
void
setBaseAddress (const MCSymbol *Base)
void
void
addBaseTypeRef (DIEValueList &Die, int64_t Idx)
Public Member Functions inherited from llvm::DwarfUnit
getUniqueID () const
Gets Unique ID for this unit.
MCSymbol *
Get the the symbol for start of the section for this unit.
MCSymbol *
getEndLabel () const
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.
void
addGlobalType (const DIType *Ty, const DIE &Die, const DIScope *Context)
DIE *
getDIE (const DINode *D) const
Returns the DIE map slot for the specified debug variable.
DIELoc *
getDIELoc ()
Returns a fresh newly allocated DIELoc.
void
insertDIE (const DINode *Desc, DIE *D)
Insert DIE into the map.
void
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 (DIEValueList &Die, std::optional< dwarf::Form > Form, int64_t Integer)
void
addInt (DIE &Die, dwarf::Attribute Attribute, const APInt &Integer, bool Unsigned)
Add an integer attribute data and value; value may be any width.
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
addBlock (DIE &Die, dwarf::Attribute Attribute, const DIExpression *Expr)
Add an expression as block data.
void
addSourceLine (DIE &Die, unsigned Line, unsigned Column, 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.
DIE *
getOrCreateNameSpace (const DINamespace *NS)
DIE *
getOrCreateModule (const DIModule *M)
void
applySubprogramAttributes (const DISubprogram *SP, DIE &SPDie, bool SkipSPAttributes=false)
DIE *
createTypeDIE (const DIScope *Context, DIE &ContextDIE, const DIType *Ty)
Creates type DIE with specific context.
virtual DIE *
getOrCreateTypeDIE (const MDNode *TyNode)
Find existing DIE or create new DIE for the given type.
void
constructContainingTypeDIEs ()
Construct DIEs for types that contain vtables.
std::optional< unsigned >
constructSubprogramArguments (DIE &Buffer, DITypeRefArray Args)
Construct function argument DIEs.
DIE &
createAndAddDIE (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.
useSegmentedStringOffsetsTable () const
void
Add the DW_AT_str_offsets_base attribute to the unit DIE.
void
Add the DW_AT_rnglists_base attribute to the unit DIE.
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.
DIE *
createTypeDIE (const DICompositeType *Ty)
Get context owner's DIE.
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.
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.
getSection () const
Return the section that this DIEUnit will be emitted into.
void
setDebugSectionOffset (uint64_t O)
getDebugSectionOffset () const
DIE &
getUnitDie ()
getUnitDie () const
Additional Inherited Members
Protected Member Functions inherited from llvm::DwarfUnit
DwarfUnit (dwarf::Tag, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, unsigned UniqueID=0)
applySubprogramDefinitionAttributes (const DISubprogram *SP, DIE &SPDie, bool Minimal)
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 () override
DIE *
getOrCreateStaticMemberDIE (const DIDerivedType *DT)
Create new static data member DIE.
void
emitCommonHeader (bool UseOffsets, dwarf::UnitType UT)
Emit the common part of the header for this unit.
shouldPlaceInUnitDIE (const DISubprogram *SP, bool Minimal)
DIE *
getOrCreateSubprogramContextDIE (const DISubprogram *SP, bool IgnoreScope)
Protected Member Functions inherited from llvm::DIEUnit
virtual
~DIEUnit ()=default
.debug_info or .debug_types absolute section offset.
Protected Attributes inherited from llvm::DwarfUnit
A numeric ID unique among all CUs in the module.
MDNode for the compile unit.
Target of Dwarf emission.
MCSymbol *
LabelBegin = nullptr
The start of the unit within its section.
MCSymbol *
EndLabel = nullptr
Emitted at the end of the CU and used to compute the CU Length field.
DIE *
IndexTyDie = nullptr
An anonymous type for index type. Owned by DIEUnit.
DenseMap< const MDNode *, DIE * >
Tracks the mapping of unit level debug information variables to debug information entries.
std::vector< DIEBlock * >
A list of all the DIEBlocks in use.
std::vector< DIELoc * >
A list of all the DIELocs in use.
DenseMap< DIE *, const DINode * >
This map is used to keep track of subprogram DIEs that need DW_AT_containing_type attribute.
Definition at line 45 of file DwarfCompileUnit.h.