class DWARFLinker::DIECloner

Declaration

class DWARFLinker::DIECloner { /* full declaration omitted */ };

Declared at: llvm/include/llvm/DWARFLinker/DWARFLinker.h:531

Member Variables

private llvm::DWARFLinker& Linker
private llvm::DwarfEmitter* Emitter
private llvm::DWARFFile& ObjFile
private llvm::BumpPtrAllocator& DIEAlloc
Allocator used for all the DIEValue objects.
private std::vector<std::unique_ptr<CompileUnit>>& CompileUnits
private bool Update

Method Overview

  • public DIECloner(llvm::DWARFLinker & Linker, llvm::DwarfEmitter * Emitter, llvm::DWARFFile & ObjFile, llvm::BumpPtrAllocator & DIEAlloc, std::vector<std::unique_ptr<CompileUnit>> & CompileUnits, bool Update)
  • private void addObjCAccelerator(llvm::CompileUnit & Unit, const llvm::DIE * Die, llvm::DwarfStringPoolEntryRef Name, llvm::OffsetsStringPool & StringPool, bool SkipPubSection)
  • private unsigned int cloneAddressAttribute(llvm::DIE & Die, llvm::DWARFLinker::DIECloner::AttributeSpec AttrSpec, const llvm::DWARFFormValue & Val, const llvm::CompileUnit & Unit, llvm::DWARFLinker::DIECloner::AttributesInfo & Info)
  • public uint64_t cloneAllCompileUnits(llvm::DWARFContext & DwarfContext, const llvm::DWARFFile & File, llvm::OffsetsStringPool & StringPool, bool IsLittleEndian)
  • private unsigned int cloneAttribute(llvm::DIE & Die, const llvm::DWARFDie & InputDIE, const llvm::DWARFFile & File, llvm::CompileUnit & U, llvm::OffsetsStringPool & StringPool, const llvm::DWARFFormValue & Val, const llvm::DWARFLinker::DIECloner::AttributeSpec AttrSpec, unsigned int AttrSize, llvm::DWARFLinker::DIECloner::AttributesInfo & AttrInfo, bool IsLittleEndian)
  • private unsigned int cloneBlockAttribute(llvm::DIE & Die, const llvm::DWARFFile & File, llvm::CompileUnit & Unit, llvm::DWARFLinker::DIECloner::AttributeSpec AttrSpec, const llvm::DWARFFormValue & Val, unsigned int AttrSize, bool IsLittleEndian)
  • public llvm::DIE * cloneDIE(const llvm::DWARFDie & InputDIE, const llvm::DWARFFile & File, llvm::CompileUnit & U, llvm::OffsetsStringPool & StringPool, int64_t PCOffset, uint32_t OutOffset, unsigned int Flags, bool IsLittleEndian, llvm::DIE * Die = nullptr)
  • private unsigned int cloneDieReferenceAttribute(llvm::DIE & Die, const llvm::DWARFDie & InputDIE, llvm::DWARFLinker::DIECloner::AttributeSpec AttrSpec, unsigned int AttrSize, const llvm::DWARFFormValue & Val, const llvm::DWARFFile & File, llvm::CompileUnit & Unit)
  • private void cloneExpression(llvm::DataExtractor & Data, llvm::DWARFExpression Expression, const llvm::DWARFFile & File, llvm::CompileUnit & Unit, SmallVectorImpl<uint8_t> & OutputBuffer)
  • private unsigned int cloneScalarAttribute(llvm::DIE & Die, const llvm::DWARFDie & InputDIE, const llvm::DWARFFile & File, llvm::CompileUnit & U, llvm::DWARFLinker::DIECloner::AttributeSpec AttrSpec, const llvm::DWARFFormValue & Val, unsigned int AttrSize, llvm::DWARFLinker::DIECloner::AttributesInfo & Info)
  • private unsigned int cloneStringAttribute(llvm::DIE & Die, llvm::DWARFLinker::DIECloner::AttributeSpec AttrSpec, const llvm::DWARFFormValue & Val, const llvm::DWARFUnit & U, llvm::OffsetsStringPool & StringPool, llvm::DWARFLinker::DIECloner::AttributesInfo & Info)
  • private bool getDIENames(const llvm::DWARFDie & Die, llvm::DWARFLinker::DIECloner::AttributesInfo & Info, llvm::OffsetsStringPool & StringPool, bool StripTemplate = false)
  • private uint32_t hashFullyQualifiedName(llvm::DWARFDie DIE, llvm::CompileUnit & U, const llvm::DWARFFile & File, int RecurseDepth = 0)

Methods

DIECloner(
    llvm::DWARFLinker& Linker,
    llvm::DwarfEmitter* Emitter,
    llvm::DWARFFile& ObjFile,
    llvm::BumpPtrAllocator& DIEAlloc,
    std::vector<std::unique_ptr<CompileUnit>>&
        CompileUnits,
    bool Update)

Declared at: llvm/include/llvm/DWARFLinker/DWARFLinker.h:544

Parameters

llvm::DWARFLinker& Linker
llvm::DwarfEmitter* Emitter
llvm::DWARFFile& ObjFile
llvm::BumpPtrAllocator& DIEAlloc
std::vector<std::unique_ptr<CompileUnit>>& CompileUnits
bool Update

void addObjCAccelerator(
    llvm::CompileUnit& Unit,
    const llvm::DIE* Die,
    llvm::DwarfStringPoolEntryRef Name,
    llvm::OffsetsStringPool& StringPool,
    bool SkipPubSection)

Description

Helper for cloneDIE.

Declared at: llvm/include/llvm/DWARFLinker/DWARFLinker.h:682

Parameters

llvm::CompileUnit& Unit
const llvm::DIE* Die
llvm::DwarfStringPoolEntryRef Name
llvm::OffsetsStringPool& StringPool
bool SkipPubSection

unsigned int cloneAddressAttribute(
    llvm::DIE& Die,
    llvm::DWARFLinker::DIECloner::AttributeSpec
        AttrSpec,
    const llvm::DWARFFormValue& Val,
    const llvm::CompileUnit& Unit,
    llvm::DWARFLinker::DIECloner::AttributesInfo&
        Info)

Description

Clone an attribute referencing another DIE and add it to \p Die.

Declared at: llvm/include/llvm/DWARFLinker/DWARFLinker.h:657

Parameters

llvm::DIE& Die
llvm::DWARFLinker::DIECloner::AttributeSpec AttrSpec
const llvm::DWARFFormValue& Val
const llvm::CompileUnit& Unit
llvm::DWARFLinker::DIECloner::AttributesInfo& Info

Returns

the size of the new attribute.

uint64_t cloneAllCompileUnits(
    llvm::DWARFContext& DwarfContext,
    const llvm::DWARFFile& File,
    llvm::OffsetsStringPool& StringPool,
    bool IsLittleEndian)

Description

Construct the output DIE tree by cloning the DIEs we chose to keep above. If there are no valid relocs, then there's nothing to clone/emit.

Declared at: llvm/include/llvm/DWARFLinker/DWARFLinker.h:570

Parameters

llvm::DWARFContext& DwarfContext
const llvm::DWARFFile& File
llvm::OffsetsStringPool& StringPool
bool IsLittleEndian

unsigned int cloneAttribute(
    llvm::DIE& Die,
    const llvm::DWARFDie& InputDIE,
    const llvm::DWARFFile& File,
    llvm::CompileUnit& U,
    llvm::OffsetsStringPool& StringPool,
    const llvm::DWARFFormValue& Val,
    const llvm::DWARFLinker::DIECloner::
        AttributeSpec AttrSpec,
    unsigned int AttrSize,
    llvm::DWARFLinker::DIECloner::AttributesInfo&
        AttrInfo,
    bool IsLittleEndian)

Description

Helper for cloneDIE.

Declared at: llvm/include/llvm/DWARFLinker/DWARFLinker.h:616

Parameters

llvm::DIE& Die
const llvm::DWARFDie& InputDIE
const llvm::DWARFFile& File
llvm::CompileUnit& U
llvm::OffsetsStringPool& StringPool
const llvm::DWARFFormValue& Val
const llvm::DWARFLinker::DIECloner::AttributeSpec AttrSpec
unsigned int AttrSize
llvm::DWARFLinker::DIECloner::AttributesInfo& AttrInfo
bool IsLittleEndian

unsigned int cloneBlockAttribute(
    llvm::DIE& Die,
    const llvm::DWARFFile& File,
    llvm::CompileUnit& Unit,
    llvm::DWARFLinker::DIECloner::AttributeSpec
        AttrSpec,
    const llvm::DWARFFormValue& Val,
    unsigned int AttrSize,
    bool IsLittleEndian)

Description

Clone an attribute referencing another DIE and add it to \p Die.

Declared at: llvm/include/llvm/DWARFLinker/DWARFLinker.h:649

Parameters

llvm::DIE& Die
const llvm::DWARFFile& File
llvm::CompileUnit& Unit
llvm::DWARFLinker::DIECloner::AttributeSpec AttrSpec
const llvm::DWARFFormValue& Val
unsigned int AttrSize
bool IsLittleEndian

Returns

the size of the new attribute.

llvm::DIE* cloneDIE(
    const llvm::DWARFDie& InputDIE,
    const llvm::DWARFFile& File,
    llvm::CompileUnit& U,
    llvm::OffsetsStringPool& StringPool,
    int64_t PCOffset,
    uint32_t OutOffset,
    unsigned int Flags,
    bool IsLittleEndian,
    llvm::DIE* Die = nullptr)

Description

Recursively clone \p InputDIE into an tree of DIE objects where useless (as decided by lookForDIEsToKeep()) bits have been stripped out and addresses have been rewritten according to the address map.

Declared at: llvm/include/llvm/DWARFLinker/DWARFLinker.h:562

Parameters

const llvm::DWARFDie& InputDIE
const llvm::DWARFFile& File
llvm::CompileUnit& U
llvm::OffsetsStringPool& StringPool
int64_t PCOffset
(while cloning a function scope) is the offset applied to the entry point of the function to get the linked address.
uint32_t OutOffset
is the offset the cloned DIE in the output compile unit.
unsigned int Flags
bool IsLittleEndian
llvm::DIE* Die = nullptr
the output DIE to use, pass NULL to create one.

Returns

the root of the cloned tree or null if nothing was selected.

unsigned int cloneDieReferenceAttribute(
    llvm::DIE& Die,
    const llvm::DWARFDie& InputDIE,
    llvm::DWARFLinker::DIECloner::AttributeSpec
        AttrSpec,
    unsigned int AttrSize,
    const llvm::DWARFFormValue& Val,
    const llvm::DWARFFile& File,
    llvm::CompileUnit& Unit)

Description

Clone an attribute referencing another DIE and add it to \p Die.

Declared at: llvm/include/llvm/DWARFLinker/DWARFLinker.h:634

Parameters

llvm::DIE& Die
const llvm::DWARFDie& InputDIE
llvm::DWARFLinker::DIECloner::AttributeSpec AttrSpec
unsigned int AttrSize
const llvm::DWARFFormValue& Val
const llvm::DWARFFile& File
llvm::CompileUnit& Unit

Returns

the size of the new attribute.

void cloneExpression(
    llvm::DataExtractor& Data,
    llvm::DWARFExpression Expression,
    const llvm::DWARFFile& File,
    llvm::CompileUnit& Unit,
    SmallVectorImpl<uint8_t>& OutputBuffer)

Description

Clone a DWARF expression that may be referencing another DIE.

Declared at: llvm/include/llvm/DWARFLinker/DWARFLinker.h:642

Parameters

llvm::DataExtractor& Data
llvm::DWARFExpression Expression
const llvm::DWARFFile& File
llvm::CompileUnit& Unit
SmallVectorImpl<uint8_t>& OutputBuffer

unsigned int cloneScalarAttribute(
    llvm::DIE& Die,
    const llvm::DWARFDie& InputDIE,
    const llvm::DWARFFile& File,
    llvm::CompileUnit& U,
    llvm::DWARFLinker::DIECloner::AttributeSpec
        AttrSpec,
    const llvm::DWARFFormValue& Val,
    unsigned int AttrSize,
    llvm::DWARFLinker::DIECloner::AttributesInfo&
        Info)

Description

Clone a scalar attribute and add it to \p Die.

Declared at: llvm/include/llvm/DWARFLinker/DWARFLinker.h:664

Parameters

llvm::DIE& Die
const llvm::DWARFDie& InputDIE
const llvm::DWARFFile& File
llvm::CompileUnit& U
llvm::DWARFLinker::DIECloner::AttributeSpec AttrSpec
const llvm::DWARFFormValue& Val
unsigned int AttrSize
llvm::DWARFLinker::DIECloner::AttributesInfo& Info

Returns

the size of the new attribute.

unsigned int cloneStringAttribute(
    llvm::DIE& Die,
    llvm::DWARFLinker::DIECloner::AttributeSpec
        AttrSpec,
    const llvm::DWARFFormValue& Val,
    const llvm::DWARFUnit& U,
    llvm::OffsetsStringPool& StringPool,
    llvm::DWARFLinker::DIECloner::AttributesInfo&
        Info)

Description

Clone a string attribute described by \p AttrSpec and add it to \p Die.

Declared at: llvm/include/llvm/DWARFLinker/DWARFLinker.h:626

Parameters

llvm::DIE& Die
llvm::DWARFLinker::DIECloner::AttributeSpec AttrSpec
const llvm::DWARFFormValue& Val
const llvm::DWARFUnit& U
llvm::OffsetsStringPool& StringPool
llvm::DWARFLinker::DIECloner::AttributesInfo& Info

Returns

the size of the new attribute.

bool getDIENames(
    const llvm::DWARFDie& Die,
    llvm::DWARFLinker::DIECloner::AttributesInfo&
        Info,
    llvm::OffsetsStringPool& StringPool,
    bool StripTemplate = false)

Description

Get the potential name and mangled name for the entity described by \p Die and store them in \Infoif they are not already there.

Declared at: llvm/include/llvm/DWARFLinker/DWARFLinker.h:674

Parameters

const llvm::DWARFDie& Die
llvm::DWARFLinker::DIECloner::AttributesInfo& Info
llvm::OffsetsStringPool& StringPool
bool StripTemplate = false

Returns

is a name was found.

uint32_t hashFullyQualifiedName(
    llvm::DWARFDie DIE,
    llvm::CompileUnit& U,
    const llvm::DWARFFile& File,
    int RecurseDepth = 0)

Declared at: llvm/include/llvm/DWARFLinker/DWARFLinker.h:677

Parameters

llvm::DWARFDie DIE
llvm::CompileUnit& U
const llvm::DWARFFile& File
int RecurseDepth = 0