LLVM 24.0.0git
llvm::dwarf_linker::parallel::DIEAttributeCloner Class Reference

This class creates clones of input DIE attributes. More...

#include "DWARFLinker/Parallel/DIEAttributeCloner.h"

Public Member Functions

 DIEAttributeCloner (DIE *OutDIE, CompileUnit &InUnit, CompileUnit *OutUnit, const DWARFDebugInfoEntry *InputDieEntry, DIEGenerator &Generator, std::optional< int64_t > FuncAddressAdjustment, std::optional< int64_t > VarAddressAdjustment, bool HasLocationExpressionAddress)
 DIEAttributeCloner (DIE *OutDIE, CompileUnit &InUnit, TypeUnit *OutUnit, const DWARFDebugInfoEntry *InputDieEntry, DIEGenerator &Generator, std::optional< int64_t > FuncAddressAdjustment, std::optional< int64_t > VarAddressAdjustment, bool HasLocationExpressionAddress)
void clone ()
 Clone attributes of input DIE.
unsigned finalizeAbbreviations (bool HasChildrenToClone)
 Create abbreviations for the output DIE after all attributes are cloned.
unsigned getOutOffset ()

Public Attributes

AttributesInfo AttrInfo
 Cannot be used concurrently.

Protected Member Functions

 DIEAttributeCloner (DIE *OutDIE, CompileUnit &InUnit, CompileUnit::OutputUnitVariantPtr OutUnit, const DWARFDebugInfoEntry *InputDieEntry, DIEGenerator &Generator, std::optional< int64_t > FuncAddressAdjustment, std::optional< int64_t > VarAddressAdjustment, bool HasLocationExpressionAddress)
size_t cloneStringAttr (const DWARFFormValue &Val, const DWARFAbbreviationDeclaration::AttributeSpec &AttrSpec)
 Clone string attribute.
size_t addStringAttr (dwarf::Attribute Attr, StringEntry *String)
 Add the string attribute Attr, in the string form of the unit.
size_t cloneDieRefAttr (const DWARFFormValue &Val, const DWARFAbbreviationDeclaration::AttributeSpec &AttrSpec)
 Clone attribute referencing another DIE.
size_t cloneScalarAttr (const DWARFFormValue &Val, const DWARFAbbreviationDeclaration::AttributeSpec &AttrSpec)
 Clone scalar attribute.
size_t cloneBlockAttr (const DWARFFormValue &Val, const DWARFAbbreviationDeclaration::AttributeSpec &AttrSpec)
 Clone block or exprloc attribute.
size_t cloneAddressAttr (const DWARFFormValue &Val, const DWARFAbbreviationDeclaration::AttributeSpec &AttrSpec)
 Clone address attribute.
uint64_t constrainHighPC (uint64_t HighPC, bool IsLength)
 Returns the input DIE's DW_AT_high_pc value HighPC, constrained so the code range it ends stays clear of the symbol the linker places next.
bool shouldSkipAttribute (DWARFAbbreviationDeclaration::AttributeSpec AttrSpec)
 Returns true if attribute should be skipped.

Protected Attributes

DIE * OutDIE = nullptr
 Output DIE.
CompileUnit & InUnit
 Input compilation unit.
CompileUnit::OutputUnitVariantPtr OutUnit
 Output unit(either "plain" compilation unit, either artificial type unit).
SectionDescriptor & DebugInfoOutputSection
 .debug_info section descriptor.
const DWARFDebugInfoEntry * InputDieEntry = nullptr
 Input DIE entry.
uint32_t InputDIEIdx = 0
 Input DIE index.
DIEGenerator & Generator
 Output DIE generator.
std::optional< int64_t > FuncAddressAdjustment
 Relocation adjustment for the function address ranges.
std::optional< int64_t > VarAddressAdjustment
 Relocation adjustment for the variable locations.
bool HasLocationExpressionAddress = false
 Indicates whether InputDieEntry has an location attribute containg address expression.
unsigned AttrOutOffset = 0
 Output offset after all attributes.
OffsetsPtrVector PatchesOffsets
 Patches for the cloned attributes.
RelocationFixups::AttributeSource Source
bool SaveRelocs = false
bool Use_DW_FORM_strp = false
 This flag forces using DW_FORM_strp for string attributes.

Detailed Description

This class creates clones of input DIE attributes.

It enumerates attributes of input DIE, creates clone for each attribute, adds cloned attribute to the output DIE.

Definition at line 53 of file DIEAttributeCloner.h.

Constructor & Destructor Documentation

◆ DIEAttributeCloner() [1/3]

llvm::dwarf_linker::parallel::DIEAttributeCloner::DIEAttributeCloner ( DIE * OutDIE,
CompileUnit & InUnit,
CompileUnit * OutUnit,
const DWARFDebugInfoEntry * InputDieEntry,
DIEGenerator & Generator,
std::optional< int64_t > FuncAddressAdjustment,
std::optional< int64_t > VarAddressAdjustment,
bool HasLocationExpressionAddress )
inline

◆ DIEAttributeCloner() [2/3]

llvm::dwarf_linker::parallel::DIEAttributeCloner::DIEAttributeCloner ( DIE * OutDIE,
CompileUnit & InUnit,
TypeUnit * OutUnit,
const DWARFDebugInfoEntry * InputDieEntry,
DIEGenerator & Generator,
std::optional< int64_t > FuncAddressAdjustment,
std::optional< int64_t > VarAddressAdjustment,
bool HasLocationExpressionAddress )
inline

◆ DIEAttributeCloner() [3/3]

llvm::dwarf_linker::parallel::DIEAttributeCloner::DIEAttributeCloner ( DIE * OutDIE,
CompileUnit & InUnit,
CompileUnit::OutputUnitVariantPtr OutUnit,
const DWARFDebugInfoEntry * InputDieEntry,
DIEGenerator & Generator,
std::optional< int64_t > FuncAddressAdjustment,
std::optional< int64_t > VarAddressAdjustment,
bool HasLocationExpressionAddress )
inlineprotected

Member Function Documentation

◆ addStringAttr()

size_t DIEAttributeCloner::addStringAttr ( dwarf::Attribute Attr,
StringEntry * String )
protected

Add the string attribute Attr, in the string form of the unit.

Definition at line 278 of file DIEAttributeCloner.cpp.

References AttrOutOffset, DebugInfoOutputSection, Generator, InputDIEIdx, InUnit, OutDIE, OutUnit, PatchesOffsets, llvm::String, and Use_DW_FORM_strp.

Referenced by clone(), and cloneStringAttr().

◆ clone()

◆ cloneAddressAttr()

◆ cloneBlockAttr()

◆ cloneDieRefAttr()

◆ cloneScalarAttr()

◆ cloneStringAttr()

◆ constrainHighPC()

uint64_t DIEAttributeCloner::constrainHighPC ( uint64_t HighPC,
bool IsLength )
protected

Returns the input DIE's DW_AT_high_pc value HighPC, constrained so the code range it ends stays clear of the symbol the linker places next.

IsLength tells whether high_pc is encoded as a length rather than an address.

A scope nested in a function inherits the overrun of the function, so it is constrained as well.

Definition at line 808 of file DIEAttributeCloner.cpp.

References FuncAddressAdjustment, InputDieEntry, InUnit, and llvm::dwarf::toAddress().

Referenced by cloneAddressAttr(), and cloneScalarAttr().

◆ finalizeAbbreviations()

unsigned DIEAttributeCloner::finalizeAbbreviations ( bool HasChildrenToClone)

Create abbreviations for the output DIE after all attributes are cloned.

Definition at line 821 of file DIEAttributeCloner.cpp.

References AttrOutOffset, Generator, OutUnit, PatchesOffsets, and SaveRelocs.

◆ getOutOffset()

unsigned llvm::dwarf_linker::parallel::DIEAttributeCloner::getOutOffset ( )
inline

Definition at line 88 of file DIEAttributeCloner.h.

References AttrOutOffset.

◆ shouldSkipAttribute()

bool DIEAttributeCloner::shouldSkipAttribute ( DWARFAbbreviationDeclaration::AttributeSpec AttrSpec)
protected

Returns true if attribute should be skipped.

Definition at line 181 of file DIEAttributeCloner.cpp.

References llvm::DWARFAbbreviationDeclaration::AttributeSpec::Attr, FuncAddressAdjustment, HasLocationExpressionAddress, InputDIEIdx, InUnit, and VarAddressAdjustment.

Referenced by clone().

Member Data Documentation

◆ AttrInfo

AttributesInfo llvm::dwarf_linker::parallel::DIEAttributeCloner::AttrInfo

Cannot be used concurrently.

Definition at line 86 of file DIEAttributeCloner.h.

Referenced by clone(), cloneAddressAttr(), cloneBlockAttr(), cloneScalarAttr(), and cloneStringAttr().

◆ AttrOutOffset

unsigned llvm::dwarf_linker::parallel::DIEAttributeCloner::AttrOutOffset = 0
protected

Output offset after all attributes.

Definition at line 192 of file DIEAttributeCloner.h.

Referenced by addStringAttr(), clone(), cloneBlockAttr(), cloneDieRefAttr(), cloneScalarAttr(), cloneStringAttr(), finalizeAbbreviations(), and getOutOffset().

◆ DebugInfoOutputSection

SectionDescriptor& llvm::dwarf_linker::parallel::DIEAttributeCloner::DebugInfoOutputSection
protected

.debug_info section descriptor.

Definition at line 170 of file DIEAttributeCloner.h.

Referenced by addStringAttr(), clone(), cloneBlockAttr(), cloneDieRefAttr(), cloneScalarAttr(), cloneStringAttr(), and DIEAttributeCloner().

◆ FuncAddressAdjustment

std::optional<int64_t> llvm::dwarf_linker::parallel::DIEAttributeCloner::FuncAddressAdjustment
protected

Relocation adjustment for the function address ranges.

Definition at line 182 of file DIEAttributeCloner.h.

Referenced by cloneAddressAttr(), cloneScalarAttr(), constrainHighPC(), DIEAttributeCloner(), DIEAttributeCloner(), DIEAttributeCloner(), and shouldSkipAttribute().

◆ Generator

DIEGenerator& llvm::dwarf_linker::parallel::DIEAttributeCloner::Generator
protected

◆ HasLocationExpressionAddress

bool llvm::dwarf_linker::parallel::DIEAttributeCloner::HasLocationExpressionAddress = false
protected

Indicates whether InputDieEntry has an location attribute containg address expression.

Definition at line 189 of file DIEAttributeCloner.h.

Referenced by cloneBlockAttr(), DIEAttributeCloner(), DIEAttributeCloner(), DIEAttributeCloner(), and shouldSkipAttribute().

◆ InputDieEntry

const DWARFDebugInfoEntry* llvm::dwarf_linker::parallel::DIEAttributeCloner::InputDieEntry = nullptr
protected

◆ InputDIEIdx

uint32_t llvm::dwarf_linker::parallel::DIEAttributeCloner::InputDIEIdx = 0
protected

◆ InUnit

◆ OutDIE

DIE* llvm::dwarf_linker::parallel::DIEAttributeCloner::OutDIE = nullptr
protected

◆ OutUnit

CompileUnit::OutputUnitVariantPtr llvm::dwarf_linker::parallel::DIEAttributeCloner::OutUnit
protected

Output unit(either "plain" compilation unit, either artificial type unit).

Definition at line 167 of file DIEAttributeCloner.h.

Referenced by addStringAttr(), clone(), cloneAddressAttr(), cloneBlockAttr(), cloneDieRefAttr(), cloneScalarAttr(), cloneStringAttr(), DIEAttributeCloner(), DIEAttributeCloner(), DIEAttributeCloner(), and finalizeAbbreviations().

◆ PatchesOffsets

OffsetsPtrVector llvm::dwarf_linker::parallel::DIEAttributeCloner::PatchesOffsets
protected

Patches for the cloned attributes.

Definition at line 195 of file DIEAttributeCloner.h.

Referenced by addStringAttr(), clone(), cloneBlockAttr(), cloneDieRefAttr(), cloneScalarAttr(), cloneStringAttr(), and finalizeAbbreviations().

◆ SaveRelocs

bool llvm::dwarf_linker::parallel::DIEAttributeCloner::SaveRelocs = false
protected

◆ Source

RelocationFixups::AttributeSource llvm::dwarf_linker::parallel::DIEAttributeCloner::Source
protected

Definition at line 197 of file DIEAttributeCloner.h.

Referenced by clone(), cloneAddressAttr(), and cloneBlockAttr().

◆ Use_DW_FORM_strp

bool llvm::dwarf_linker::parallel::DIEAttributeCloner::Use_DW_FORM_strp = false
protected

This flag forces using DW_FORM_strp for string attributes.

Definition at line 202 of file DIEAttributeCloner.h.

Referenced by addStringAttr(), and DIEAttributeCloner().

◆ VarAddressAdjustment

std::optional<int64_t> llvm::dwarf_linker::parallel::DIEAttributeCloner::VarAddressAdjustment
protected

Relocation adjustment for the variable locations.

Definition at line 185 of file DIEAttributeCloner.h.

Referenced by cloneAddressAttr(), cloneBlockAttr(), cloneScalarAttr(), DIEAttributeCloner(), DIEAttributeCloner(), DIEAttributeCloner(), and shouldSkipAttribute().


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