LLVM 20.0.0git
|
Type Unit is used to represent an artificial compilation unit which keeps all type information. More...
#include "DWARFLinker/Parallel/DWARFLinkerTypeUnit.h"
Classes | |
struct | TypeUnitAccelInfo |
TypeUnitAccelInfo extends AccelInfo structure with type specific fileds. More... | |
Public Member Functions | |
TypeUnit (LinkingGlobalData &GlobalData, unsigned ID, std::optional< uint16_t > Language, dwarf::FormParams Format, llvm::endianness Endianess) | |
void | createDIETree (BumpPtrAllocator &Allocator) |
Generates DIE tree based on information from TypesMap. | |
Error | finishCloningAndEmit (const Triple &TargetTriple) |
Emits resulting dwarf based on information from DIE tree. | |
TypePool & | getTypePool () |
Returns global type pool. | |
void | forEachAcceleratorRecord (function_ref< void(AccelInfo &)> Handler) override |
Enumerates all accelerator records and call Handler for each. | |
uint64_t | getDebugStrIndex (const StringEntry *String) override |
Returns index for the specified String inside .debug_str_offsets. | |
void | saveAcceleratorInfo (const TypeUnitAccelInfo &Info) |
Adds Info to the unit's accelerator records. | |
Public Member Functions inherited from llvm::dwarf_linker::parallel::DwarfUnit | |
virtual | ~DwarfUnit () |
DwarfUnit (LinkingGlobalData &GlobalData, unsigned ID, StringRef ClangModuleName) | |
unsigned | getUniqueID () const |
Unique id of the unit. | |
uint64_t | getUnitSize () const |
Returns size of this(newly generated) compile unit. | |
StringRef | getUnitName () const |
Returns this unit name. | |
StringRef | getSysRoot () |
Return the DW_AT_LLVM_sysroot of the compile unit or an empty StringRef. | |
bool | isClangModule () const |
Return true if this compile unit is from Clang module. | |
const std::string & | getClangModuleName () const |
Return Clang module name;. | |
LinkingGlobalData & | getGlobalData () |
Return global data. | |
bool | isInterconnectedCU () const |
Returns true if unit is inter-connected(it references/referenced by other unit). | |
void | setInterconnectedCU () |
Mark this unit as inter-connected(it references/referenced by other unit). | |
void | assignAbbrev (DIEAbbrev &Abbrev) |
Adds Abbrev into unit`s abbreviation table. | |
const std::vector< std::unique_ptr< DIEAbbrev > > & | getAbbreviations () const |
Returns abbreviations for this compile unit. | |
DIE * | getOutUnitDIE () |
Returns output unit DIE. | |
void | setOutUnitDIE (DIE *UnitDie) |
Set output unit DIE. | |
dwarf::Tag | getTag () const |
Returns unit DWARF tag. | |
Error | emitAbbreviations () |
Error | emitDebugInfo (const Triple &TargetTriple) |
Emit .debug_info section for unit DIEs. | |
Error | emitDebugLine (const Triple &TargetTriple, const DWARFDebugLine::LineTable &OutLineTable) |
Emit .debug_line section. | |
Error | emitDebugStringOffsetSection () |
Emit the .debug_str_offsets section for current unit. | |
void | warn (const Twine &Warning) |
void | error (const Twine &Err) |
void | emitPubAccelerators () |
Emit .debug_pubnames and .debug_pubtypes for Unit . | |
virtual void | forEachAcceleratorRecord (function_ref< void(AccelInfo &)> Handler)=0 |
Enumerates accelerator data. | |
virtual uint64_t | getDebugStrIndex (const StringEntry *String) |
Returns index(inside .debug_str_offsets) of specified string. | |
Public Member Functions inherited from llvm::dwarf_linker::parallel::OutputSections | |
OutputSections (LinkingGlobalData &GlobalData) | |
void | setOutputFormat (dwarf::FormParams Format, llvm::endianness Endianness) |
Sets output format for all keeping sections. | |
const SectionDescriptor & | getSectionDescriptor (DebugSectionKind SectionKind) const |
Returns descriptor for the specified section of SectionKind . | |
SectionDescriptor & | getSectionDescriptor (DebugSectionKind SectionKind) |
Returns descriptor for the specified section of SectionKind . | |
std::optional< const SectionDescriptor * > | tryGetSectionDescriptor (DebugSectionKind SectionKind) const |
Returns descriptor for the specified section of SectionKind . | |
std::optional< SectionDescriptor * > | tryGetSectionDescriptor (DebugSectionKind SectionKind) |
Returns descriptor for the specified section of SectionKind . | |
SectionDescriptor & | getOrCreateSectionDescriptor (DebugSectionKind SectionKind) |
Returns descriptor for the specified section of SectionKind . | |
void | eraseSections () |
Erases data of all sections. | |
void | forEach (function_ref< void(SectionDescriptor &)> Handler) |
Enumerate all sections and call Handler for each. | |
void | forEach (function_ref< void(std::shared_ptr< SectionDescriptor > Section)> Handler) |
Enumerate all sections and call Handler for each. | |
void | assignSectionsOffsetAndAccumulateSize (std::array< uint64_t, SectionKindsNum > &SectionSizesAccumulator) |
Enumerate all sections, for each section set current offset (kept by SectionSizesAccumulator ), update current offset with section length. | |
void | applyPatches (SectionDescriptor &Section, StringEntryToDwarfStringPoolEntryMap &DebugStrStrings, StringEntryToDwarfStringPoolEntryMap &DebugLineStrStrings, TypeUnit *TypeUnitPtr) |
Enumerate all sections, for each section apply all section patches. | |
llvm::endianness | getEndianness () const |
Endiannes for the sections. | |
uint16_t | getVersion () const |
Return DWARF version. | |
uint16_t | getDebugInfoHeaderSize () const |
Return size of header of debug_info table. | |
uint16_t | getDebugAddrHeaderSize () const |
Return size of header of debug_ table. | |
uint16_t | getDebugStrOffsetsHeaderSize () const |
Return size of header of debug_str_offsets table. | |
const dwarf::FormParams & | getFormParams () const |
Return size of address. | |
Additional Inherited Members | |
Public Types inherited from llvm::dwarf_linker::parallel::DwarfUnit | |
enum class | AccelType : uint8_t { AccelType::None , AccelType::Name , AccelType::Namespace , AccelType::ObjC , AccelType::Type } |
Protected Types inherited from llvm::dwarf_linker::parallel::DwarfUnit | |
using | FileNamesCache = DenseMap< uint64_t, std::pair< std::string, std::string > > |
Cache for file names for this unit. | |
Protected Types inherited from llvm::dwarf_linker::parallel::OutputSections | |
using | SectionsSetTy = std::map< DebugSectionKind, std::shared_ptr< SectionDescriptor > > |
All keeping sections. | |
Protected Member Functions inherited from llvm::dwarf_linker::parallel::DwarfUnit | |
void | emitDwarfAbbrevEntry (const DIEAbbrev &Abbrev, SectionDescriptor &AbbrevSection) |
Emit single abbreviation entry. | |
std::optional< uint64_t > | emitPubAcceleratorEntry (SectionDescriptor &OutSection, const AccelInfo &Info, std::optional< uint64_t > LengthOffset) |
Emit single pubnames/pubtypes accelerator entry. | |
Protected Attributes inherited from llvm::dwarf_linker::parallel::DwarfUnit | |
unsigned | ID = 0 |
Unique ID for the unit. | |
std::string | UnitName |
The name of this unit. | |
std::string | SysRoot |
The DW_AT_LLVM_sysroot of this unit. | |
std::string | ClangModuleName |
If this is a Clang module, this holds the module's name. | |
uint64_t | UnitSize = 0 |
dwarf::Tag | UnitTag = dwarf::DW_TAG_null |
DWARF unit tag. | |
std::atomic< bool > | IsInterconnectedCU = {false} |
true if current unit references_to/is_referenced by other unit. | |
FoldingSet< DIEAbbrev > | AbbreviationsSet |
FoldingSet that uniques the abbreviations. | |
std::vector< std::unique_ptr< DIEAbbrev > > | Abbreviations |
Storage for the unique Abbreviations. | |
DIE * | OutUnitDIE = nullptr |
Output unit DIE. | |
FileNamesCache | FileNames |
IndexedValuesMap< const StringEntry * > | DebugStringIndexMap |
Maps a string into the index inside .debug_str_offsets section. | |
Protected Attributes inherited from llvm::dwarf_linker::parallel::OutputSections | |
LinkingGlobalData & | GlobalData |
dwarf::FormParams | Format = {4, 4, dwarf::DWARF32} |
Format for sections. | |
llvm::endianness | Endianness = llvm::endianness::native |
Endiannes for sections. | |
SectionsSetTy | SectionDescriptors |
Type Unit is used to represent an artificial compilation unit which keeps all type information.
This type information is referenced from other compilation units.
Definition at line 24 of file DWARFLinkerTypeUnit.h.
TypeUnit::TypeUnit | ( | LinkingGlobalData & | GlobalData, |
unsigned | ID, | ||
std::optional< uint16_t > | Language, | ||
dwarf::FormParams | Format, | ||
llvm::endianness | Endianess | ||
) |
Definition at line 18 of file DWARFLinkerTypeUnit.cpp.
References llvm::dwarf_linker::DebugInfo, llvm::DWARFDebugLine::Prologue::DefaultIsStmt, llvm::dwarf_linker::parallel::OutputSections::Format, llvm::DWARFDebugLine::Prologue::FormParams, llvm::dwarf_linker::parallel::OutputSections::getFormParams(), llvm::dwarf_linker::parallel::OutputSections::getOrCreateSectionDescriptor(), llvm::DWARFDebugLine::Prologue::LineBase, llvm::DWARFDebugLine::Prologue::LineRange, llvm::DWARFDebugLine::Prologue::MaxOpsPerInst, llvm::DWARFDebugLine::Prologue::MinInstLength, llvm::DWARFDebugLine::Prologue::OpcodeBase, llvm::DWARFDebugLine::LineTable::Prologue, llvm::dwarf_linker::parallel::OutputSections::setOutputFormat(), llvm::DWARFDebugLine::Prologue::StandardOpcodeLengths, and llvm::dwarf_linker::parallel::DwarfUnit::UnitName.
void TypeUnit::createDIETree | ( | BumpPtrAllocator & | Allocator | ) |
Generates DIE tree based on information from TypesMap.
Definition at line 42 of file DWARFLinkerTypeUnit.cpp.
References llvm::dwarf_linker::parallel::DIEGenerator::addScalarAttribute(), llvm::dwarf_linker::parallel::DIEGenerator::addStringPlaceholderAttribute(), Allocator, llvm::dwarf_linker::parallel::DIEGenerator::createDIE(), llvm::dwarf_linker::DebugInfo, llvm::dwarf_linker::DebugLine, llvm::dwarf_linker::parallel::DwarfUnit::DebugStringIndexMap, llvm::DWARFDebugLine::Prologue::FileNames, llvm::DIE::getAbbrevNumber(), llvm::dwarf_linker::parallel::OutputSections::getDebugInfoHeaderSize(), llvm::dwarf_linker::parallel::OutputSections::getDebugStrOffsetsHeaderSize(), llvm::DIE::getOffset(), llvm::dwarf_linker::parallel::OutputSections::getOrCreateSectionDescriptor(), llvm::dwarf_linker::parallel::TypePool::getRoot(), llvm::dwarf_linker::parallel::LinkingGlobalData::getStringPool(), llvm::getULEB128Size(), llvm::dwarf_linker::parallel::DwarfUnit::getUnitName(), llvm::dwarf_linker::parallel::OutputSections::GlobalData, llvm::dwarf_linker::parallel::SectionDescriptor::notePatchWithOffsetUpdate(), llvm::DWARFDebugLine::LineTable::Prologue, llvm::DIE::setOffset(), llvm::dwarf_linker::parallel::DwarfUnit::setOutUnitDIE(), llvm::DIE::setSize(), llvm::parallel::TaskGroup::spawn(), and llvm::SmallString< InternalLen >::str().
Referenced by finishCloningAndEmit().
Emits resulting dwarf based on information from DIE tree.
Definition at line 340 of file DWARFLinkerTypeUnit.cpp.
References llvm::dwarf_linker::parallel::DWARFLinkerOptions::AccelTables, Allocator, createDIETree(), llvm::dwarf_linker::DebugAbbrev, llvm::dwarf_linker::DebugInfo, llvm::dwarf_linker::DebugLine, llvm::dwarf_linker::DebugPubNames, llvm::dwarf_linker::DebugPubTypes, llvm::dwarf_linker::DebugStrOffsets, llvm::dwarf_linker::parallel::DwarfUnit::emitAbbreviations(), llvm::dwarf_linker::parallel::DwarfUnit::emitDebugInfo(), llvm::dwarf_linker::parallel::DwarfUnit::emitDebugLine(), llvm::dwarf_linker::parallel::DwarfUnit::emitDebugStringOffsetSection(), llvm::dwarf_linker::parallel::DwarfUnit::emitPubAccelerators(), F, llvm::DWARFDebugLine::Prologue::FileNames, llvm::dwarf_linker::parallel::LinkingGlobalData::getOptions(), llvm::dwarf_linker::parallel::OutputSections::getOrCreateSectionDescriptor(), llvm::dwarf_linker::parallel::DwarfUnit::getOutUnitDIE(), llvm::dwarf_linker::parallel::OutputSections::GlobalData, llvm::is_contained(), llvm::parallelForEachError(), llvm::DWARFDebugLine::LineTable::Prologue, llvm::dwarf_linker::DWARFLinkerBase::Pub, and llvm::Error::success().
|
inlineoverridevirtual |
Enumerates all accelerator records and call Handler
for each.
Implements llvm::dwarf_linker::parallel::DwarfUnit.
Definition at line 56 of file DWARFLinkerTypeUnit.h.
|
inlineoverridevirtual |
Returns index for the specified String
inside .debug_str_offsets.
Reimplemented from llvm::dwarf_linker::parallel::DwarfUnit.
Definition at line 70 of file DWARFLinkerTypeUnit.h.
References llvm::dwarf_linker::parallel::DwarfUnit::DebugStringIndexMap, and llvm::String.
|
inline |
Returns global type pool.
Definition at line 37 of file DWARFLinkerTypeUnit.h.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmit(), and llvm::dwarf_linker::parallel::CompileUnit::cloneDIE().
|
inline |
Adds Info
to the unit's accelerator records.
Definition at line 76 of file DWARFLinkerTypeUnit.h.
References Info.
Referenced by llvm::dwarf_linker::parallel::AcceleratorRecordsSaver::saveNamespaceRecord(), and llvm::dwarf_linker::parallel::AcceleratorRecordsSaver::saveTypeRecord().