class DwarfCompileUnit

Declaration

class DwarfCompileUnit : public DwarfUnit { /* full declaration omitted */ };

Description

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

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:45

Inherits from: DwarfUnit

Member Variables

public std::vector<BaseTypeRef> ExprRefedBaseTypes

Inherited from DwarfUnit:

protected CUNode
protected DIEValueAllocator
protected Asm
protected EndLabel = nullptr
protected DD
protected DU
protected IndexTyDie
protected MDNodeToDieMap
protected DIEBlocks
protected DIELocs
protected ContainingTypeMap

Method Overview

Inherited from DwarfUnit:

Inherited from DIEUnit:

Methods

DwarfCompileUnit(
    unsigned int UID,
    const llvm::DICompileUnit* Node,
    llvm::AsmPrinter* A,
    llvm::DwarfDebug* DW,
    llvm::DwarfFile* DWU,
    llvm::UnitKind Kind = UnitKind::Full)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:108

Parameters

unsigned int UID
const llvm::DICompileUnit* Node
llvm::AsmPrinter* A
llvm::DwarfDebug* DW
llvm::DwarfFile* DWU
llvm::UnitKind Kind = UnitKind::Full

void addAddrTableBase()

Description

Add the DW_AT_addr_base attribute to the unit DIE.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:292

void addAddress(
    llvm::DIE& Die,
    dwarf::Attribute Attribute,
    const llvm::MachineLocation& Location)

Description

Add an address attribute to a die based on the location provided.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:325

Parameters

llvm::DIE& Die
dwarf::Attribute Attribute
const llvm::MachineLocation& Location

void addAddressExpr(llvm::DIE& Die,
                    dwarf::Attribute Attribute,
                    const llvm::MCExpr* Expr)

Description

Add an attribute containing an address expression to \p Die.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:344

Parameters

llvm::DIE& Die
dwarf::Attribute Attribute
const llvm::MCExpr* Expr

void addBaseTypeRef(llvm::DIEValueList& Die,
                    int64_t Idx)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:363

Parameters

llvm::DIEValueList& Die
int64_t Idx

void addComplexAddress(
    const llvm::DbgVariable& DV,
    llvm::DIE& Die,
    dwarf::Attribute Attribute,
    const llvm::MachineLocation& Location)

Description

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. Add the DWARF information to the die.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:332

Parameters

const llvm::DbgVariable& DV
llvm::DIE& Die
dwarf::Attribute Attribute
const llvm::MachineLocation& Location

void addExpr(llvm::DIELoc& Die,
             dwarf::Form Form,
             const llvm::MCExpr* Expr)

Description

Add a Dwarf expression attribute data and value.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:341

Parameters

llvm::DIELoc& Die
dwarf::Form Form
const llvm::MCExpr* Expr

void addGlobalName(llvm::StringRef Name,
                   const llvm::DIE& Die,
                   const llvm::DIScope* Context)

Description

Add a new global name to the compile unit.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:304

Parameters

llvm::StringRef Name
const llvm::DIE& Die
const llvm::DIScope* Context

void addGlobalNameForTypeUnit(
    llvm::StringRef Name,
    const llvm::DIScope* Context)

Description

Add a new global name present in a type unit to this compile unit.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:308

Parameters

llvm::StringRef Name
const llvm::DIScope* Context

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

Description

Add a new global type to the compile unit.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:311

Parameters

const llvm::DIType* Ty
const llvm::DIE& Die
const llvm::DIScope* Context

void addGlobalTypeUnitType(
    const llvm::DIType* Ty,
    const llvm::DIScope* Context)

Description

Add a new global type present in a type unit to this compile unit.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:315

Parameters

const llvm::DIType* Ty
const llvm::DIScope* Context

void addImportedEntity(
    const llvm::DIImportedEntity* IE)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:167

Parameters

const llvm::DIImportedEntity* IE

void addLabelAddress(llvm::DIE& Die,
                     dwarf::Attribute Attribute,
                     const llvm::MCSymbol* Label)

Description

addLabelAddress - Add a dwarf label attribute data and value using either DW_FORM_addr or DW_FORM_GNU_addr_index.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:155

Parameters

llvm::DIE& Die
dwarf::Attribute Attribute
const llvm::MCSymbol* Label

void addLocalLabelAddress(
    llvm::DIE& Die,
    dwarf::Attribute Attribute,
    const llvm::MCSymbol* Label)

Description

addLocalLabelAddress - Add a dwarf label attribute data and value using DW_FORM_addr only.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:160

Parameters

llvm::DIE& Die
dwarf::Attribute Attribute
const llvm::MCSymbol* Label

void addLocationAttribute(
    llvm::DIE* ToDIE,
    const llvm::DIGlobalVariable* GV,
    ArrayRef<llvm::DwarfCompileUnit::GlobalExpr>
        GlobalExprs)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:150

Parameters

llvm::DIE* ToDIE
const llvm::DIGlobalVariable* GV
ArrayRef<llvm::DwarfCompileUnit::GlobalExpr> GlobalExprs

void addLocationList(llvm::DIE& Die,
                     dwarf::Attribute Attribute,
                     unsigned int Index)

Description

Add a Dwarf loclistptr attribute data and value.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:337

Parameters

llvm::DIE& Die
dwarf::Attribute Attribute
unsigned int Index

void addRange(llvm::RangeSpan Range)

Description

addRange - Add an address range to the list of ranges for this unit.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:179

Parameters

llvm::RangeSpan Range

void addScopeRangeList(
    llvm::DIE& ScopeDIE,
    SmallVector<llvm::RangeSpan, 2> Range)

Description

A helper function to construct a RangeSpanList for a given lexical scope.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:194

Parameters

llvm::DIE& ScopeDIE
SmallVector<llvm::RangeSpan, 2> Range

void addVariableAddress(
    const llvm::DbgVariable& DV,
    llvm::DIE& Die,
    llvm::MachineLocation Location)

Description

Add DW_AT_location attribute for a DbgVariable based on provided MachineLocation.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:322

Parameters

const llvm::DbgVariable& DV
llvm::DIE& Die
llvm::MachineLocation Location

void applyLabelAttributes(
    const llvm::DbgLabel& Label,
    llvm::DIE& LabelDie)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:349

Parameters

const llvm::DbgLabel& Label
llvm::DIE& LabelDie

void applyStmtList(llvm::DIE& D)

Description

Apply the DW_AT_stmt_list from this compile unit to the specified DIE.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:124

Parameters

llvm::DIE& D

void applySubprogramAttributesToDefinition(
    const llvm::DISubprogram* SP,
    llvm::DIE& SPDie)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:346

Parameters

const llvm::DISubprogram* SP
llvm::DIE& SPDie

void applyVariableAttributes(
    const llvm::DbgVariable& Var,
    llvm::DIE& VariableDie)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:338

Parameters

const llvm::DbgVariable& Var
llvm::DIE& VariableDie

void attachLowHighPC(llvm::DIE& D,
                     const llvm::MCSymbol* Begin,
                     const llvm::MCSymbol* End)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:181

Parameters

llvm::DIE& D
const llvm::MCSymbol* Begin
const llvm::MCSymbol* End

void attachRangesOrLowHighPC(
    llvm::DIE& D,
    SmallVector<llvm::RangeSpan, 2> Ranges)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:196

Parameters

llvm::DIE& D
SmallVector<llvm::RangeSpan, 2> Ranges

void attachRangesOrLowHighPC(
    llvm::DIE& D,
    const SmallVectorImpl<llvm::InsnRange>&
        Ranges)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:198

Parameters

llvm::DIE& D
const SmallVectorImpl<llvm::InsnRange>& Ranges

void constructAbstractSubprogramScopeDIE(
    llvm::LexicalScope* Scope)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:231

Parameters

llvm::LexicalScope* Scope

llvm::DIE& constructCallSiteEntryDIE(
    llvm::DIE& ScopeDIE,
    const llvm::DISubprogram* CalleeSP,
    bool IsTail,
    const llvm::MCSymbol* PCAddr,
    const llvm::MCExpr* PCOffset,
    unsigned int CallReg)

Description

Construct a call site entry DIE describing a call within \p Scope to a callee described by \p CalleeSP. \p IsTail specifies whether the call is a tail call.\p PCAddr (used for GDB + DWARF 4 tuning) points to the PC value after the call instruction.\p PCOffset (used for cases other than GDB + DWARF 4 tuning) must be non-zero for non-tail calls (in the case of non-gdb tuning, since for GDB + DWARF 5 tuning we still generate PC info for tail calls) or be the function-local offset to PC value after the call instruction.\p CallReg is a register location for an indirect call. For direct calls the \p CallReg is set to 0.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:253

Parameters

llvm::DIE& ScopeDIE
const llvm::DISubprogram* CalleeSP
bool IsTail
const llvm::MCSymbol* PCAddr
const llvm::MCExpr* PCOffset
unsigned int CallReg

void constructCallSiteParmEntryDIEs(
    llvm::DIE& CallSiteDIE,
    SmallVector<llvm::DbgCallSiteParam, 4>&
        Params)

Description

Construct call site parameter DIEs for the \p CallSiteDIE. The \p Params were collected by the \ref collectCallSiteParameters. Note: The order of parameters does not matter, since debuggers recognize call site parameters by the DW_AT_location attribute.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:260

Parameters

llvm::DIE& CallSiteDIE
SmallVector<llvm::DbgCallSiteParam, 4>& Params

llvm::DIE* constructImportedEntityDIE(
    const llvm::DIImportedEntity* Module)

Description

Construct import_module DIE.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:264

Parameters

const llvm::DIImportedEntity* Module

llvm::DIE* constructInlinedScopeDIE(
    llvm::LexicalScope* Scope)

Description

This scope represents inlined body of a function. Construct DIE to represent this concrete inlined copy of the function.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:203

Parameters

llvm::LexicalScope* Scope

llvm::DIE* constructLabelDIE(
    llvm::DbgLabel& DL,
    const llvm::LexicalScope& Scope)

Description

Construct a DIE for the given DbgLabel.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:216

Parameters

llvm::DbgLabel& DL
const llvm::LexicalScope& Scope

llvm::DIE* constructLexicalScopeDIE(
    llvm::LexicalScope* Scope)

Description

Construct new DW_TAG_lexical_block for this scope and attach DW_AT_low_pc/DW_AT_high_pc labels.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:207

Parameters

llvm::LexicalScope* Scope

void constructScopeDIE(
    llvm::LexicalScope* Scope,
    SmallVectorImpl<llvm::DIE*>& FinalChildren)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:189

Parameters

llvm::LexicalScope* Scope
SmallVectorImpl<llvm::DIE*>& FinalChildren

llvm::DIE& constructSubprogramScopeDIE(
    const llvm::DISubprogram* Sub,
    llvm::LexicalScope* Scope)

Description

Construct a DIE for this subprogram scope.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:226

Parameters

const llvm::DISubprogram* Sub
llvm::LexicalScope* Scope

llvm::DIE* constructVariableDIE(
    llvm::DbgVariable& DV,
    bool Abstract = false)

Description

constructVariableDIE - Construct a DIE for the given DbgVariable.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:210

Parameters

llvm::DbgVariable& DV
bool Abstract = false

llvm::DIE* constructVariableDIE(
    llvm::DbgVariable& DV,
    const llvm::LexicalScope& Scope,
    llvm::DIE*& ObjectPointer)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:212

Parameters

llvm::DbgVariable& DV
const llvm::LexicalScope& Scope
llvm::DIE*& ObjectPointer

void createAbstractEntity(
    const llvm::DINode* Node,
    llvm::LexicalScope* Scope)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:272

Parameters

const llvm::DINode* Node
llvm::LexicalScope* Scope

llvm::DIE* createAndAddScopeChildren(
    llvm::LexicalScope* Scope,
    llvm::DIE& ScopeDIE)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:229

Parameters

llvm::LexicalScope* Scope
llvm::DIE& ScopeDIE

void createBaseTypeDIEs()

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:223

llvm::DIE* createScopeChildrenDIE(
    llvm::LexicalScope* Scope,
    SmallVectorImpl<llvm::DIE*>& Children,
    bool* HasNonScopeChildren = nullptr)

Description

A helper function to create children of a Scope DIE.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:219

Parameters

llvm::LexicalScope* Scope
SmallVectorImpl<llvm::DIE*>& Children
bool* HasNonScopeChildren = nullptr

void emitHeader(bool UseOffsets)

Description

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

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:289

Parameters

bool UseOffsets

void finishEntityDefinition(
    const llvm::DbgEntity* Entity)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:267

Parameters

const llvm::DbgEntity* Entity

void finishSubprogramDefinition(
    const llvm::DISubprogram* SP)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:266

Parameters

const llvm::DISubprogram* SP

const llvm::MCSymbol* getBaseAddress() const

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:356

llvm::DwarfCompileUnit& getCU()

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:163

uint64_t getDWOId() const

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:358

dwarf::Attribute getDwarf5OrGNUAttr(
    dwarf::Attribute Attr) const

Description

This takes a DWARF 5 attribute and returns it or a GNU analog.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:237

Parameters

dwarf::Attribute Attr

dwarf::LocationAtom getDwarf5OrGNULocationAtom(
    dwarf::LocationAtom Loc) const

Description

This takes a DWARF 5 location atom and either returns it or a GNU analog.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:240

Parameters

dwarf::LocationAtom Loc

dwarf::Tag getDwarf5OrGNUTag(dwarf::Tag Tag) const

Description

This takes a DWARF 5 tag and returns it or a GNU analog.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:234

Parameters

dwarf::Tag Tag

llvm::DbgEntity* getExistingAbstractEntity(
    const llvm::DINode* Node)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:271

Parameters

const llvm::DINode* Node

const StringMap<const llvm::DIE*>&
getGlobalNames() const

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:317

const StringMap<const llvm::DIE*>&
getGlobalTypes() const

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:318

unsigned int getHeaderSize() const

Description

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

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:277

llvm::MCSymbol* getLabelBegin() const

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:294

unsigned int getLength()

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:284

llvm::MCSymbol* getMacroLabelBegin() const

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:299

llvm::DIE* getOrCreateCommonBlock(
    const llvm::DICommonBlock* CB,
    ArrayRef<llvm::DwarfCompileUnit::GlobalExpr>
        GlobalExprs)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:147

Parameters

const llvm::DICommonBlock* CB
ArrayRef<llvm::DwarfCompileUnit::GlobalExpr> GlobalExprs

llvm::DIE* getOrCreateGlobalVariableDIE(
    const llvm::DIGlobalVariable* GV,
    ArrayRef<llvm::DwarfCompileUnit::GlobalExpr>
        GlobalExprs)

Description

Get or create global variable DIE.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:144

Parameters

const llvm::DIGlobalVariable* GV
ArrayRef<llvm::DwarfCompileUnit::GlobalExpr> GlobalExprs

unsigned int getOrCreateSourceID(
    const llvm::DIFile* File)

Description

Look up the source ID for the given file. If none currently exists, create a new ID and insert it in the line table.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:165

Parameters

const llvm::DIFile* File

const SmallVectorImpl<llvm::RangeSpan>&
getRanges() const

Description

getRanges - Get the list of ranges for this unit.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:352

llvm::DwarfCompileUnit* getSkeleton() const

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:115

unsigned int getUniqueID() const

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:113

bool hasDwarfPubSections() const

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:361

bool hasRangeLists() const

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:112

bool includeMinimalInlineScopes() const

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:119

void initStmtList()

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:121

void setBaseAddress(const llvm::MCSymbol* Base)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:355

Parameters

const llvm::MCSymbol* Base

void setDWOId(uint64_t DwoId)

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:359

Parameters

uint64_t DwoId

void setSkeleton(llvm::DwarfCompileUnit& Skel)

Description

Set the skeleton unit associated with this unit.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:275

Parameters

llvm::DwarfCompileUnit& Skel

SmallVector<llvm::RangeSpan, 2> takeRanges()

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:353

llvm::DIE& updateSubprogramScopeDIE(
    const llvm::DISubprogram* SP)

Description

Find DIE for the given subprogram and attach appropriate DW_AT_low_pc and DW_AT_high_pc attributes. If there are global variables in this scope then create and insert DIEs for these variables.

Declared at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:187

Parameters

const llvm::DISubprogram* SP