LLVM 20.0.0git
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
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 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.
 
bool shouldSkipAttribute (DWARFAbbreviationDeclaration::AttributeSpec AttrSpec)
 Returns true if attribute should be skipped.
 

Protected Attributes

DIEOutDIE = nullptr
 Output DIE.
 
CompileUnitInUnit
 Input compilation unit.
 
CompileUnit::OutputUnitVariantPtr OutUnit
 Output unit(either "plain" compilation unit, either artificial type unit).
 
SectionDescriptorDebugInfoOutputSection
 .debug_info section descriptor.
 
const DWARFDebugInfoEntryInputDieEntry = nullptr
 Input DIE entry.
 
uint32_t InputDIEIdx = 0
 Input DIE index.
 
DIEGeneratorGenerator
 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.
 
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 47 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

Definition at line 49 of file DIEAttributeCloner.h.

◆ 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

Definition at line 61 of file DIEAttributeCloner.h.

◆ 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

◆ clone()

void DIEAttributeCloner::clone ( )

Clone attributes of input DIE.

Definition at line 16 of file DIEAttributeCloner.cpp.

References llvm::dwarf_linker::DWARFFile::Addresses, llvm::dwarf_linker::parallel::DIEGenerator::addScalarAttribute(), AttrInfo, AttrOutOffset, cloneAddressAttr(), cloneBlockAttr(), cloneDieRefAttr(), cloneScalarAttr(), cloneStringAttr(), llvm::Data, DebugInfoOutputSection, llvm::dwarf_linker::DebugStrOffsets, llvm::DWARFFormValue::extractValue(), llvm::dwarf::FormEncodingString(), Generator, llvm::DWARFDebugInfoEntry::getAbbreviationDeclarationPtr(), llvm::dwarf_linker::parallel::CompileUnit::getContaingFile(), llvm::DWARFUnit::getDebugInfoExtractor(), llvm::dwarf_linker::parallel::OutputSections::getDebugStrOffsetsHeaderSize(), llvm::dwarf_linker::parallel::CompileUnit::getDIEAtIndex(), llvm::dwarf_linker::parallel::OutputSections::getFormParams(), llvm::DWARFUnit::getNextUnitOffset(), llvm::DWARFUnit::getNumDIEs(), llvm::DIE::getOffset(), llvm::DWARFDebugInfoEntry::getOffset(), llvm::DWARFDie::getOffset(), llvm::dwarf_linker::parallel::OutputSections::getOrCreateSectionDescriptor(), llvm::dwarf_linker::parallel::CompileUnit::getOrigUnit(), llvm::DWARFDebugInfoEntry::getTag(), llvm::getULEB128Size(), llvm::dwarf_linker::parallel::OutputSections::getVersion(), llvm::dwarf_linker::parallel::AttributesInfo::HasStringOffsetBaseAttr, InputDieEntry, InputDIEIdx, InUnit, llvm::dwarf_linker::parallel::CompileUnit::OutputUnitVariantPtr::isCompileUnit(), llvm::dwarf_linker::parallel::SectionDescriptor::notePatchWithOffsetUpdate(), llvm::Offset, OutDIE, OutUnit, PatchesOffsets, shouldSkipAttribute(), llvm::DWARFFormValue::skipValue(), and llvm::dwarf_linker::parallel::CompileUnit::warn().

◆ cloneAddressAttr()

size_t DIEAttributeCloner::cloneAddressAttr ( const DWARFFormValue Val,
const DWARFAbbreviationDeclaration::AttributeSpec AttrSpec 
)
protected

◆ cloneBlockAttr()

size_t DIEAttributeCloner::cloneBlockAttr ( const DWARFFormValue Val,
const DWARFAbbreviationDeclaration::AttributeSpec AttrSpec 
)
protected

◆ cloneDieRefAttr()

size_t DIEAttributeCloner::cloneDieRefAttr ( const DWARFFormValue Val,
const DWARFAbbreviationDeclaration::AttributeSpec AttrSpec 
)
protected

◆ cloneScalarAttr()

size_t DIEAttributeCloner::cloneScalarAttr ( const DWARFFormValue Val,
const DWARFAbbreviationDeclaration::AttributeSpec AttrSpec 
)
protected

Clone scalar attribute.

Definition at line 304 of file DIEAttributeCloner.cpp.

References llvm::dwarf_linker::parallel::DIEGenerator::addLocListAttribute(), llvm::dwarf_linker::parallel::DIEGenerator::addScalarAttribute(), llvm::DWARFAbbreviationDeclaration::AttributeSpec::Attr, AttrInfo, AttrOutOffset, llvm::dwarf_linker::DebugAddr, DebugInfoOutputSection, llvm::dwarf_linker::DebugLine, llvm::dwarf_linker::DebugMacinfo, llvm::dwarf_linker::DebugMacro, llvm::dwarf_linker::DebugStrOffsets, llvm::dwarf::doesFormBelongToClass(), llvm::dwarf_linker::DWARFFile::Dwarf, llvm::DWARFFormValue::FC_SectionOffset, llvm::DWARFAbbreviationDeclaration::AttributeSpec::Form, FuncAddressAdjustment, Generator, llvm::dwarf_linker::parallel::CompileUnit::OutputUnitVariantPtr::getAsCompileUnit(), llvm::DWARFFormValue::getAsSectionOffset(), llvm::DWARFFormValue::getAsSignedConstant(), llvm::DWARFFormValue::getAsUnsignedConstant(), llvm::dwarf_linker::parallel::CompileUnit::getContaingFile(), llvm::dwarf_linker::parallel::OutputSections::getDebugAddrHeaderSize(), llvm::dwarf_linker::parallel::OutputSections::getDebugStrOffsetsHeaderSize(), llvm::dwarf_linker::parallel::CompileUnit::getDieTypeEntry(), llvm::dwarf_linker::parallel::CompileUnit::getDirAndFilenameFromLineTable(), llvm::dwarf_linker::parallel::DwarfUnit::getGlobalData(), llvm::dwarf_linker::parallel::CompileUnit::getHighPc(), llvm::DWARFUnit::getLoclistOffset(), llvm::dwarf_linker::parallel::CompileUnit::getLowPc(), llvm::dwarf_linker::parallel::LinkingGlobalData::getOptions(), llvm::dwarf_linker::parallel::OutputSections::getOrCreateSectionDescriptor(), llvm::dwarf_linker::parallel::CompileUnit::getOrigUnit(), llvm::DWARFUnit::getRnglistOffset(), llvm::dwarf_linker::parallel::LinkingGlobalData::getStringPool(), llvm::DWARFDebugInfoEntry::getTag(), llvm::DWARFUnit::getVersion(), llvm::dwarf_linker::parallel::AttributesInfo::HasLiveAddress, llvm::dwarf_linker::parallel::AttributesInfo::HasRanges, llvm::dwarf_linker::parallel::AttributesInfo::HasStringOffsetBaseAttr, InputDieEntry, InputDIEIdx, llvm::ConcurrentHashTableByPtr< KeyTy, KeyDataTy, AllocatorTy, Info >::insert(), InUnit, llvm::dwarf_linker::parallel::CompileUnit::OutputUnitVariantPtr::isCompileUnit(), llvm::dwarf_linker::parallel::AttributesInfo::IsDeclaration, llvm::dwarf_linker::parallel::CompileUnit::OutputUnitVariantPtr::isTypeUnit(), llvm::Macro, llvm::DWARFAttribute::mayHaveLocationList(), llvm::dwarf_linker::parallel::SectionDescriptor::notePatchWithOffsetUpdate(), llvm::Offset, OutDIE, OutUnit, PatchesOffsets, llvm::dwarf_linker::parallel::DWARFLinkerOptions::UpdateIndexTablesOnly, VarAddressAdjustment, and llvm::dwarf_linker::parallel::CompileUnit::warn().

Referenced by clone().

◆ cloneStringAttr()

size_t DIEAttributeCloner::cloneStringAttr ( const DWARFFormValue Val,
const DWARFAbbreviationDeclaration::AttributeSpec AttrSpec 
)
protected

◆ finalizeAbbreviations()

unsigned DIEAttributeCloner::finalizeAbbreviations ( bool  HasChildrenToClone)

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

Definition at line 647 of file DIEAttributeCloner.cpp.

References AttrOutOffset, llvm::dwarf_linker::parallel::DIEGenerator::finalizeAbbreviations(), Generator, and PatchesOffsets.

◆ getOutOffset()

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

Definition at line 82 of file DIEAttributeCloner.h.

References AttrOutOffset.

◆ shouldSkipAttribute()

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

Member Data Documentation

◆ AttrInfo

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

Cannot be used concurrently.

Definition at line 80 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 173 of file DIEAttributeCloner.h.

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

◆ DebugInfoOutputSection

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

.debug_info section descriptor.

Definition at line 151 of file DIEAttributeCloner.h.

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

◆ FuncAddressAdjustment

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

Relocation adjustment for the function address ranges.

Definition at line 163 of file DIEAttributeCloner.h.

Referenced by cloneAddressAttr(), cloneScalarAttr(), 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 170 of file DIEAttributeCloner.h.

Referenced by cloneBlockAttr(), and shouldSkipAttribute().

◆ InputDieEntry

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

Input DIE entry.

Definition at line 154 of file DIEAttributeCloner.h.

Referenced by clone(), cloneAddressAttr(), cloneDieRefAttr(), cloneScalarAttr(), and DIEAttributeCloner().

◆ InputDIEIdx

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

◆ InUnit

CompileUnit& llvm::dwarf_linker::parallel::DIEAttributeCloner::InUnit
protected

◆ OutDIE

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

Output DIE.

Definition at line 142 of file DIEAttributeCloner.h.

Referenced by clone(), cloneDieRefAttr(), cloneScalarAttr(), and cloneStringAttr().

◆ OutUnit

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

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

Definition at line 148 of file DIEAttributeCloner.h.

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

◆ PatchesOffsets

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

Patches for the cloned attributes.

Definition at line 176 of file DIEAttributeCloner.h.

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

◆ 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 179 of file DIEAttributeCloner.h.

Referenced by cloneStringAttr(), and DIEAttributeCloner().

◆ VarAddressAdjustment

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

Relocation adjustment for the variable locations.

Definition at line 166 of file DIEAttributeCloner.h.

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


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