LLVM 20.0.0git
|
Stores all information related to a compile unit, be it in its original instance of the object file or its brand new cloned and generated DIE tree. More...
#include "DWARFLinker/Parallel/DWARFLinkerCompileUnit.h"
Classes | |
struct | DIEInfo |
Information gathered about source DIEs. More... | |
class | OutputUnitVariantPtr |
Output unit selector. More... | |
Public Types | |
enum class | Stage : uint8_t { CreatedNotLoaded = 0 , Loaded , LivenessAnalysisDone , UpdateDependenciesCompleteness , TypeNamesAssigned , Cloned , PatchesUpdated , Cleaned , Skipped } |
The stages of new compile unit processing. More... | |
enum | DieOutputPlacement : uint8_t { NotSet = 0 , TypeTable = 1 , PlainDwarf = 2 , Both = 3 } |
Kinds of placement for the output die. More... | |
Public Types inherited from llvm::dwarf_linker::parallel::DwarfUnit | |
enum class | AccelType : uint8_t { AccelType::None , AccelType::Name , AccelType::Namespace , AccelType::ObjC , AccelType::Type } |
Public Member Functions | |
CompileUnit (LinkingGlobalData &GlobalData, unsigned ID, StringRef ClangModuleName, DWARFFile &File, OffsetToUnitTy UnitFromOffset, dwarf::FormParams Format, llvm::endianness Endianess) | |
CompileUnit (LinkingGlobalData &GlobalData, DWARFUnit &OrigUnit, unsigned ID, StringRef ClangModuleName, DWARFFile &File, OffsetToUnitTy UnitFromOffset, dwarf::FormParams Format, llvm::endianness Endianess) | |
Stage | getStage () const |
Returns stage of overall processing. | |
void | setStage (Stage Stage) |
Set stage of overall processing. | |
void | loadLineTable () |
Loads unit line table. | |
StringEntry * | getFileName (unsigned FileIdx, StringPool &GlobalStrings) |
Returns name of the file for the FileIdx from the unit`s line table. | |
const DWARFFile & | getContaingFile () const |
Returns DWARFFile containing this compile unit. | |
bool | loadInputDIEs () |
Load DIEs of input compilation unit. | |
void | maybeResetToLoadedStage () |
Reset compile units data(results of liveness analysis, clonning) if current stage greater than Stage::Loaded. | |
void | analyzeImportedModule (const DWARFDebugInfoEntry *DieEntry) |
Collect references to parseable Swift interfaces in imported DW_TAG_module blocks. | |
void | analyzeDWARFStructure () |
Navigate DWARF tree and set die properties. | |
void | cleanupDataAfterClonning () |
Cleanup unneeded resources after compile unit is cloned. | |
void | updateDieRefPatchesWithClonedOffsets () |
After cloning stage the output DIEs offsets are deallocated. | |
bool | resolveDependenciesAndMarkLiveness (bool InterCUProcessingStarted, std::atomic< bool > &HasNewInterconnectedCUs) |
Search for subprograms and variables referencing live code and discover dependend DIEs. | |
bool | updateDependenciesCompleteness () |
Check dependend DIEs for incompatible placement. | |
void | verifyDependencies () |
Check DIEs to have a consistent marking(keep marking, placement marking). | |
Error | assignTypeNames (TypePool &TypePoolRef) |
Search for type entries and assign names. | |
DIEInfo & | getDIEInfo (unsigned Idx) |
Idx index of the DIE. | |
const DIEInfo & | getDIEInfo (unsigned Idx) const |
Idx index of the DIE. | |
DIEInfo & | getDIEInfo (const DWARFDebugInfoEntry *Entry) |
Idx index of the DIE. | |
const DIEInfo & | getDIEInfo (const DWARFDebugInfoEntry *Entry) const |
Idx index of the DIE. | |
DIEInfo & | getDIEInfo (const DWARFDie &Die) |
Die | |
const DIEInfo & | getDIEInfo (const DWARFDie &Die) const |
Die | |
uint64_t | getDieOutOffset (uint32_t Idx) |
Idx index of the DIE. | |
TypeEntry * | getDieTypeEntry (uint32_t Idx) |
Idx index of the DIE. | |
uint64_t | getDieOutOffset (const DWARFDebugInfoEntry *InputDieEntry) |
InputDieEntry debug info entry. | |
TypeEntry * | getDieTypeEntry (const DWARFDebugInfoEntry *InputDieEntry) |
InputDieEntry debug info entry. | |
void | rememberDieOutOffset (uint32_t Idx, uint64_t Offset) |
Idx index of the DIE. | |
void | setDieTypeEntry (uint32_t Idx, TypeEntry *Entry) |
Idx index of the DIE. | |
void | setDieTypeEntry (const DWARFDebugInfoEntry *InputDieEntry, TypeEntry *Entry) |
InputDieEntry debug info entry. | |
std::optional< uint64_t > | getLowPc () const |
Returns value of DW_AT_low_pc attribute. | |
uint64_t | getHighPc () const |
Returns value of DW_AT_high_pc attribute. | |
bool | hasLabelAt (uint64_t Addr) const |
Returns true if there is a label corresponding to the specified Addr . | |
void | addLabelLowPc (uint64_t LabelLowPc, int64_t PcOffset) |
Add the low_pc of a label that is relocated by applying offset PCOffset . | |
std::optional< UnitEntryPairTy > | resolveDIEReference (const DWARFFormValue &RefValue, ResolveInterCUReferencesMode CanResolveInterCUReferences) |
Resolve the DIE attribute reference that has been extracted in RefValue . | |
std::optional< UnitEntryPairTy > | resolveDIEReference (const DWARFDebugInfoEntry *DieEntry, dwarf::Attribute Attr, ResolveInterCUReferencesMode CanResolveInterCUReferences) |
void | addFunctionRange (uint64_t LowPC, uint64_t HighPC, int64_t PCOffset) |
Add a function range [LowPC , HighPC ) that is relocated by applying offset PCOffset . | |
const RangesTy & | getFunctionRanges () const |
Returns function ranges of this unit. | |
Error | cloneAndEmit (std::optional< std::reference_wrapper< const Triple > > TargetTriple, TypeUnit *ArtificialTypeUnit) |
Clone and emit this compilation unit. | |
Error | cloneAndEmitDebugLocations () |
Clone and emit debug locations(.debug_loc/.debug_loclists). | |
Error | cloneAndEmitRanges () |
Clone and emit ranges. | |
Error | cloneAndEmitDebugMacro () |
Clone and emit debug macros(.debug_macinfo/.debug_macro). | |
std::pair< DIE *, TypeEntry * > | cloneDIE (const DWARFDebugInfoEntry *InputDieEntry, TypeEntry *ClonedParentTypeDIE, uint64_t OutOffset, std::optional< int64_t > FuncAddressAdjustment, std::optional< int64_t > VarAddressAdjustment, BumpPtrAllocator &Allocator, TypeUnit *ArtificialTypeUnit) |
Error | cloneAndEmitLineTable (const Triple &TargetTriple) |
void | cloneDieAttrExpression (const DWARFExpression &InputExpression, SmallVectorImpl< uint8_t > &OutputExpression, SectionDescriptor &Section, std::optional< int64_t > VarAddressAdjustment, OffsetsPtrVector &PatchesOffsets) |
Clone attribute location axpression. | |
uint64_t | getDebugAddrIndex (uint64_t Addr) |
Returns index(inside .debug_addr) of an address. | |
std::optional< std::pair< StringRef, StringRef > > | getDirAndFilenameFromLineTable (const DWARFFormValue &FileIdxValue) |
Returns directory and file from the line table by index. | |
std::optional< std::pair< StringRef, StringRef > > | getDirAndFilenameFromLineTable (uint64_t FileIdx) |
Returns directory and file from the line table by index. | |
DWARFUnit & | getOrigUnit () const |
Returns paired compile unit from input DWARF. | |
const DWARFDebugInfoEntry * | getFirstChildEntry (const DWARFDebugInfoEntry *Die) const |
const DWARFDebugInfoEntry * | getSiblingEntry (const DWARFDebugInfoEntry *Die) const |
DWARFDie | getParent (const DWARFDebugInfoEntry *Die) |
DWARFDie | getDIEAtIndex (unsigned Index) |
const DWARFDebugInfoEntry * | getDebugInfoEntry (unsigned Index) const |
DWARFDie | getUnitDIE (bool ExtractUnitDIEOnly=true) |
DWARFDie | getDIE (const DWARFDebugInfoEntry *Die) |
uint32_t | getDIEIndex (const DWARFDebugInfoEntry *Die) const |
uint32_t | getDIEIndex (const DWARFDie &Die) const |
std::optional< DWARFFormValue > | find (uint32_t DieIdx, ArrayRef< dwarf::Attribute > Attrs) const |
std::optional< DWARFFormValue > | find (const DWARFDebugInfoEntry *Die, ArrayRef< dwarf::Attribute > Attrs) const |
std::optional< uint32_t > | getDIEIndexForOffset (uint64_t Offset) |
void | warn (const Twine &Warning, const DWARFDie *DIE=nullptr) |
void | warn (Error Warning, const DWARFDie *DIE=nullptr) |
void | warn (const Twine &Warning, const DWARFDebugInfoEntry *DieEntry) |
void | error (const Twine &Err, const DWARFDie *DIE=nullptr) |
void | error (Error Err, const DWARFDie *DIE=nullptr) |
void | saveAcceleratorInfo (const DwarfUnit::AccelInfo &Info) |
Save specified accelerator info Info . | |
void | forEachAcceleratorRecord (function_ref< void(AccelInfo &)> Handler) override |
Enumerates all units 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 | |
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 |
Stores all information related to a compile unit, be it in its original instance of the object file or its brand new cloned and generated DIE tree.
NOTE: we need alignment of at least 8 bytes as we use PointerIntPair<CompileUnit *, 3> in the DependencyTracker.h
Definition at line 53 of file DWARFLinkerCompileUnit.h.
Kinds of placement for the output die.
Enumerator | |
---|---|
NotSet | |
TypeTable | Corresponding DIE goes to the type table only. |
PlainDwarf | Corresponding DIE goes to the plain dwarf only. |
Both | Corresponding DIE goes to type table and to plain dwarf. |
Definition at line 155 of file DWARFLinkerCompileUnit.h.
|
strong |
The stages of new compile unit processing.
Enumerator | |
---|---|
CreatedNotLoaded | Created, linked with input DWARF file. |
Loaded | Input DWARF is loaded. |
LivenessAnalysisDone | Input DWARF is analysed(DIEs pointing to the real code section are discovered, type names are assigned if ODR is requested). |
UpdateDependenciesCompleteness | Check if dependencies have incompatible placement. If that is the case modify placement to be compatible. |
TypeNamesAssigned | Type names assigned to DIEs. |
Cloned | Output DWARF is generated. |
PatchesUpdated | Offsets inside patch records are updated. |
Cleaned | Resources(Input DWARF, Output DWARF tree) are released. |
Skipped | Compile Unit should be skipped. |
Definition at line 56 of file DWARFLinkerCompileUnit.h.
CompileUnit::CompileUnit | ( | LinkingGlobalData & | GlobalData, |
unsigned | ID, | ||
StringRef | ClangModuleName, | ||
DWARFFile & | File, | ||
OffsetToUnitTy | UnitFromOffset, | ||
dwarf::FormParams | Format, | ||
llvm::endianness | Endianess | ||
) |
Definition at line 28 of file DWARFLinkerCompileUnit.cpp.
References llvm::dwarf_linker::DebugInfo, llvm::dwarf_linker::parallel::OutputSections::Format, llvm::dwarf_linker::parallel::OutputSections::getOrCreateSectionDescriptor(), llvm::dwarf_linker::parallel::OutputSections::setOutputFormat(), and llvm::dwarf_linker::parallel::DwarfUnit::UnitName.
CompileUnit::CompileUnit | ( | LinkingGlobalData & | GlobalData, |
DWARFUnit & | OrigUnit, | ||
unsigned | ID, | ||
StringRef | ClangModuleName, | ||
DWARFFile & | File, | ||
OffsetToUnitTy | UnitFromOffset, | ||
dwarf::FormParams | Format, | ||
llvm::endianness | Endianess | ||
) |
Definition at line 40 of file DWARFLinkerCompileUnit.cpp.
References llvm::dwarf_linker::DebugInfo, llvm::DWARFDie::find(), llvm::dwarf_linker::parallel::OutputSections::Format, llvm::DWARFDie::getName(), llvm::dwarf_linker::parallel::LinkingGlobalData::getOptions(), llvm::dwarf_linker::parallel::OutputSections::getOrCreateSectionDescriptor(), llvm::DWARFUnit::getUnitDIE(), llvm::dwarf_linker::parallel::OutputSections::GlobalData, llvm::dwarf_linker::parallel::isODRLanguage(), llvm::dwarf_linker::parallel::DWARFLinkerOptions::NoODR, llvm::dwarf_linker::parallel::OutputSections::setOutputFormat(), llvm::ShortName, llvm::StringRef::str(), llvm::dwarf_linker::parallel::DwarfUnit::SysRoot, llvm::dwarf::toStringRef(), llvm::dwarf::toUnsigned(), and llvm::dwarf_linker::parallel::DwarfUnit::UnitName.
void llvm::dwarf_linker::parallel::CompileUnit::addFunctionRange | ( | uint64_t | LowPC, |
uint64_t | HighPC, | ||
int64_t | PCOffset | ||
) |
Add a function range [LowPC
, HighPC
) that is relocated by applying offset PCOffset
.
void llvm::dwarf_linker::parallel::CompileUnit::addLabelLowPc | ( | uint64_t | LabelLowPc, |
int64_t | PcOffset | ||
) |
Add the low_pc of a label that is relocated by applying offset PCOffset
.
|
inline |
Navigate DWARF tree and set die properties.
Definition at line 127 of file DWARFLinkerCompileUnit.h.
References getDebugInfoEntry(), and getUnitDIE().
void CompileUnit::analyzeImportedModule | ( | const DWARFDebugInfoEntry * | DieEntry | ) |
Collect references to parseable Swift interfaces in imported DW_TAG_module blocks.
Definition at line 253 of file DWARFLinkerCompileUnit.cpp.
References llvm::sys::path::append(), llvm::StringRef::empty(), find(), getDIE(), llvm::dwarf_linker::parallel::LinkingGlobalData::getOptions(), llvm::dwarf_linker::parallel::DwarfUnit::getSysRoot(), getUnitDIE(), llvm::dwarf_linker::parallel::OutputSections::GlobalData, llvm::dwarf_linker::guessDeveloperDir(), llvm::sys::path::is_relative(), llvm::dwarf_linker::isInToolchainDir(), llvm::dwarf_linker::parallel::DwarfUnit::Name, llvm::dwarf_linker::parallel::DWARFLinkerOptions::ParseableSwiftInterfaces, llvm::dwarf_linker::parallel::DwarfUnit::SysRoot, llvm::dwarf::toString(), llvm::dwarf::toStringRef(), and warn().
Search for type entries and assign names.
Definition at line 303 of file DWARFLinkerCompileUnit.cpp.
References getDebugInfoEntry(), getUnitDIE(), isValid(), and llvm::Error::success().
void CompileUnit::cleanupDataAfterClonning | ( | ) |
Cleanup unneeded resources after compile unit is cloned.
Definition at line 239 of file DWARFLinkerCompileUnit.cpp.
References llvm::dwarf_linker::parallel::DwarfUnit::AbbreviationsSet, llvm::DWARFUnit::clear(), llvm::dwarf_linker::parallel::DwarfUnit::FileNames, getOrigUnit(), and llvm::DenseMap< KeyT, ValueT, KeyInfoT, BucketT >::shrink_and_clear().
Error CompileUnit::cloneAndEmit | ( | std::optional< std::reference_wrapper< const Triple > > | TargetTriple, |
TypeUnit * | ArtificialTypeUnit | ||
) |
Clone and emit this compilation unit.
Definition at line 1232 of file DWARFLinkerCompileUnit.cpp.
References llvm::dwarf_linker::parallel::DWARFLinkerOptions::AccelTables, Allocator, cloneAndEmitDebugLocations(), cloneAndEmitDebugMacro(), cloneAndEmitLineTable(), cloneAndEmitRanges(), cloneDIE(), llvm::dwarf_linker::DebugInfo, llvm::dwarf_linker::parallel::DwarfUnit::emitAbbreviations(), llvm::dwarf_linker::parallel::DwarfUnit::emitDebugInfo(), llvm::dwarf_linker::parallel::DwarfUnit::emitDebugStringOffsetSection(), llvm::dwarf_linker::parallel::DwarfUnit::emitPubAccelerators(), llvm::DWARFDie::getDebugInfoEntry(), llvm::dwarf_linker::parallel::OutputSections::getDebugInfoHeaderSize(), llvm::dwarf_linker::parallel::LinkingGlobalData::getOptions(), llvm::dwarf_linker::parallel::OutputSections::getOrCreateSectionDescriptor(), getOrigUnit(), llvm::dwarf_linker::parallel::TypePool::getRoot(), llvm::dwarf_linker::parallel::TypeUnit::getTypePool(), llvm::DWARFUnit::getUnitDIE(), llvm::dwarf_linker::parallel::OutputSections::GlobalData, llvm::is_contained(), llvm::DWARFDie::isValid(), llvm::dwarf_linker::DWARFLinkerBase::Pub, llvm::dwarf_linker::parallel::DwarfUnit::setOutUnitDIE(), and llvm::Error::success().
Error CompileUnit::cloneAndEmitDebugLocations | ( | ) |
Clone and emit debug locations(.debug_loc/.debug_loclists).
Definition at line 443 of file DWARFLinkerCompileUnit.cpp.
References llvm::dwarf_linker::DebugLoc, llvm::dwarf_linker::DebugLocLists, llvm::dwarf_linker::parallel::DwarfUnit::getGlobalData(), getOrigUnit(), llvm::dwarf_linker::parallel::OutputSections::getVersion(), and llvm::Error::success().
Referenced by cloneAndEmit().
Error CompileUnit::cloneAndEmitDebugMacro | ( | ) |
Clone and emit debug macros(.debug_macinfo/.debug_macro).
Definition at line 894 of file DWARFLinkerCompileUnit.cpp.
References llvm::Dwarf, llvm::DWARFDie::find(), getContaingFile(), getOrigUnit(), llvm::dwarf_linker::parallel::DwarfUnit::getOutUnitDIE(), llvm::DWARFUnit::getUnitDIE(), llvm::Error::success(), and llvm::dwarf::toSectionOffset().
Referenced by cloneAndEmit().
Definition at line 1517 of file DWARFLinkerCompileUnit.cpp.
References llvm::dwarf::FormParams::AddrSize, llvm::dwarf_linker::DWARFFile::Dwarf, llvm::dwarf_linker::parallel::DwarfUnit::emitDebugLine(), find(), llvm::DWARFDebugLine::Prologue::FormParams, getContaingFile(), llvm::dwarf_linker::parallel::OutputSections::getFormParams(), getFunctionRanges(), llvm::dwarf_linker::parallel::DwarfUnit::getGlobalData(), getOrigUnit(), getUnitDIE(), llvm::DWARFDebugLine::LineTable::Prologue, llvm::DWARFDebugLine::LineTable::Rows, llvm::DWARFDebugLine::LineTable::Sequences, llvm::Error::success(), and warn().
Referenced by cloneAndEmit().
Error CompileUnit::cloneAndEmitRanges | ( | ) |
Clone and emit ranges.
Definition at line 674 of file DWARFLinkerCompileUnit.cpp.
References llvm::dwarf_linker::DebugRange, llvm::dwarf_linker::DebugRngLists, getFunctionRanges(), llvm::dwarf_linker::parallel::DwarfUnit::getGlobalData(), getOrigUnit(), llvm::dwarf_linker::parallel::OutputSections::getVersion(), llvm::AddressRanges::insert(), Range, and llvm::Error::success().
Referenced by cloneAndEmit().
std::pair< DIE *, TypeEntry * > CompileUnit::cloneDIE | ( | const DWARFDebugInfoEntry * | InputDieEntry, |
TypeEntry * | ClonedParentTypeDIE, | ||
uint64_t | OutOffset, | ||
std::optional< int64_t > | FuncAddressAdjustment, | ||
std::optional< int64_t > | VarAddressAdjustment, | ||
BumpPtrAllocator & | Allocator, | ||
TypeUnit * | ArtificialTypeUnit | ||
) |
Definition at line 1288 of file DWARFLinkerCompileUnit.cpp.
References llvm::dwarf_linker::parallel::DIEGenerator::addChild(), Allocator, assert(), cloneDIE(), llvm::DWARFDebugInfoEntry::getAbbreviationDeclarationPtr(), getDIEIndex(), getDIEInfo(), getFirstChildEntry(), getSiblingEntry(), llvm::DWARFDebugInfoEntry::getTag(), llvm::dwarf_linker::parallel::TypePool::getThreadLocalAllocator(), llvm::dwarf_linker::parallel::TypeUnit::getTypePool(), Info, and llvm::StringMapEntryStorage< ValueTy >::second.
Referenced by cloneAndEmit(), and cloneDIE().
void CompileUnit::cloneDieAttrExpression | ( | const DWARFExpression & | InputExpression, |
SmallVectorImpl< uint8_t > & | OutputExpression, | ||
SectionDescriptor & | Section, | ||
std::optional< int64_t > | VarAddressAdjustment, | ||
OffsetsPtrVector & | PatchesOffsets | ||
) |
Clone attribute location axpression.
Definition at line 1093 of file DWARFLinkerCompileUnit.cpp.
References llvm::SmallVectorImpl< T >::append(), assert(), llvm::ArrayRef< T >::begin(), llvm::StringRef::begin(), llvm::encodeULEB128(), llvm::ArrayRef< T >::end(), llvm::StringRef::end(), llvm::formatv(), llvm::DWARFUnit::getAddressByteSize(), llvm::DWARFUnit::getAddrOffsetSectionItem(), llvm::DWARFExpression::Operation::getCode(), llvm::DWARFExpression::getData(), llvm::DWARFExpression::Operation::getDescription(), llvm::DWARFUnit::getDIEIndexForOffset(), llvm::dwarf::FormParams::getDwarfOffsetByteSize(), llvm::dwarf_linker::parallel::OutputSections::getEndianness(), llvm::DWARFExpression::Operation::getEndOffset(), llvm::dwarf_linker::parallel::OutputSections::getFormParams(), llvm::dwarf_linker::parallel::DwarfUnit::getGlobalData(), llvm::DWARFUnit::getOffset(), getOrigUnit(), llvm::DWARFExpression::Operation::getRawOperand(), llvm::DWARFExpression::Operation::getSubCode(), Idx, llvm::native, llvm::Offset, llvm::DWARFExpression::Operation::Description::Op, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase< Size_T >::size(), llvm::StringRef::slice(), llvm::sys::swapByteOrder(), and warn().
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneBlockAttr().
|
inlineoverridevirtual |
Enumerates all units accelerator records.
Implements llvm::dwarf_linker::parallel::DwarfUnit.
Definition at line 575 of file DWARFLinkerCompileUnit.h.
References llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::forEach().
Returns DWARFFile containing this compile unit.
Definition at line 111 of file DWARFLinkerCompileUnit.h.
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::clone(), cloneAndEmitDebugMacro(), cloneAndEmitLineTable(), and llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneScalarAttr().
Returns index(inside .debug_addr) of an address.
Definition at line 436 of file DWARFLinkerCompileUnit.h.
References Addr, and llvm::dwarf_linker::IndexedValuesMap< T >::getValueIndex().
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneAddressAttr().
std::optional< std::pair< StringRef, StringRef > > CompileUnit::getDirAndFilenameFromLineTable | ( | const DWARFFormValue & | FileIdxValue | ) |
Returns directory and file from the line table by index.
Definition at line 1673 of file DWARFLinkerCompileUnit.cpp.
References llvm::DWARFFormValue::getAsSectionOffset(), llvm::DWARFFormValue::getAsSignedConstant(), llvm::DWARFFormValue::getAsUnsignedConstant(), and getDirAndFilenameFromLineTable().
Referenced by llvm::dwarf_linker::parallel::SyntheticTypeNameBuilder::addDieNameFromDeclFileAndDeclLine(), llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneScalarAttr(), and getDirAndFilenameFromLineTable().
std::optional< std::pair< StringRef, StringRef > > CompileUnit::getDirAndFilenameFromLineTable | ( | uint64_t | FileIdx | ) |
Returns directory and file from the line table by index.
Definition at line 1689 of file DWARFLinkerCompileUnit.cpp.
References llvm::sys::path::append(), llvm::StringRef::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::dwarf_linker::parallel::DwarfUnit::FileNames, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::DWARFUnit::getCompilationDir(), getOrigUnit(), llvm::dwarf_linker::parallel::OutputSections::getVersion(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::dwarf_linker::isPathAbsoluteOnWindowsOrPosix(), llvm::dwarf_linker::parallel::DwarfUnit::Name, llvm::sys::path::native, llvm::Expected< T >::takeError(), and warn().
StringEntry * CompileUnit::getFileName | ( | unsigned | FileIdx, |
StringPool & | GlobalStrings | ||
) |
Returns name of the file for the FileIdx
from the unit`s line table.
Definition at line 188 of file DWARFLinkerCompileUnit.cpp.
References llvm::sys::path::append(), assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::sys::path::filename(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::DWARFDebugLine::LineTable::getFileNameByIndex(), getOrigUnit(), llvm::DWARFDebugLine::LineTable::hasFileAtIndex(), llvm::ConcurrentHashTableByPtr< KeyTy, KeyDataTy, AllocatorTy, Info >::insert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::sys::path::parent_path(), and llvm::sys::fs::real_path().
Returns function ranges of this unit.
Definition at line 401 of file DWARFLinkerCompileUnit.h.
Referenced by cloneAndEmitLineTable(), and cloneAndEmitRanges().
|
inline |
Returns value of DW_AT_high_pc attribute.
Definition at line 372 of file DWARFLinkerCompileUnit.h.
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneAddressAttr(), and llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneScalarAttr().
|
inline |
Returns value of DW_AT_low_pc attribute.
Definition at line 369 of file DWARFLinkerCompileUnit.h.
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneAddressAttr(), and llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneScalarAttr().
|
inline |
Returns stage of overall processing.
Definition at line 98 of file DWARFLinkerCompileUnit.h.
Referenced by maybeResetToLoadedStage(), and resolveDIEReference().
Returns true if there is a label corresponding to the specified Addr
.
Definition at line 375 of file DWARFLinkerCompileUnit.h.
References Addr, and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count().
bool CompileUnit::loadInputDIEs | ( | ) |
Load DIEs of input compilation unit.
Definition at line 114 of file DWARFLinkerCompileUnit.cpp.
References getOrigUnit(), getUnitDIE(), and llvm::SmallVectorImpl< T >::resize().
void CompileUnit::loadLineTable | ( | ) |
Loads unit line table.
Definition at line 71 of file DWARFLinkerCompileUnit.cpp.
References llvm::dwarf_linker::DWARFFile::Dwarf, and getOrigUnit().
void CompileUnit::maybeResetToLoadedStage | ( | ) |
Reset compile units data(results of liveness analysis, clonning) if current stage greater than Stage::Loaded.
We need to reset data as we are going to repeat stages.
Definition at line 75 of file DWARFLinkerCompileUnit.cpp.
References llvm::dwarf_linker::parallel::DwarfUnit::Abbreviations, llvm::dwarf_linker::parallel::DwarfUnit::AbbreviationsSet, llvm::AddressRangesBase< T >::clear(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::clear(), llvm::dwarf_linker::IndexedValuesMap< T >::clear(), Cloned, CreatedNotLoaded, llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::erase(), llvm::dwarf_linker::parallel::OutputSections::eraseSections(), getStage(), Info, Loaded, llvm::dwarf_linker::parallel::DwarfUnit::Name, llvm::Offset, llvm::dwarf_linker::parallel::DwarfUnit::OutUnitDIE, and setStage().
bool CompileUnit::resolveDependenciesAndMarkLiveness | ( | bool | InterCUProcessingStarted, |
std::atomic< bool > & | HasNewInterconnectedCUs | ||
) |
Search for subprograms and variables referencing live code and discover dependend DIEs.
Mark live DIEs, set placement for DIEs.
Definition at line 1832 of file DWARFLinkerCompileUnit.cpp.
std::optional< UnitEntryPairTy > CompileUnit::resolveDIEReference | ( | const DWARFDebugInfoEntry * | DieEntry, |
dwarf::Attribute | Attr, | ||
ResolveInterCUReferencesMode | CanResolveInterCUReferences | ||
) |
Definition at line 417 of file DWARFLinkerCompileUnit.cpp.
References find(), and resolveDIEReference().
std::optional< UnitEntryPairTy > CompileUnit::resolveDIEReference | ( | const DWARFFormValue & | RefValue, |
ResolveInterCUReferencesMode | CanResolveInterCUReferences | ||
) |
Resolve the DIE attribute reference that has been extracted in RefValue
.
The resulting DIE might be in another CompileUnit.
Definition at line 381 of file DWARFLinkerCompileUnit.cpp.
References Cloned, llvm::DWARFFormValue::getAsDebugInfoReference(), llvm::DWARFFormValue::getAsRelativeReference(), getDebugInfoEntry(), getDIEIndexForOffset(), llvm::DWARFUnit::getOffset(), getStage(), llvm::DWARFFormValue::getUnit(), and llvm::Offset.
Referenced by llvm::dwarf_linker::parallel::SyntheticTypeNameBuilder::addReferencedODRDies(), llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneDieRefAttr(), llvm::dwarf_linker::parallel::UnitEntryPairTy::getNamespaceOrigin(), and resolveDIEReference().
|
inline |
Save specified accelerator info Info
.
Definition at line 569 of file DWARFLinkerCompileUnit.h.
References llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::add(), and Info.
Referenced by llvm::dwarf_linker::parallel::AcceleratorRecordsSaver::saveNameRecord(), llvm::dwarf_linker::parallel::AcceleratorRecordsSaver::saveNamespaceRecord(), llvm::dwarf_linker::parallel::AcceleratorRecordsSaver::saveObjCNameRecord(), and llvm::dwarf_linker::parallel::AcceleratorRecordsSaver::saveTypeRecord().
|
inline |
Set stage of overall processing.
Definition at line 101 of file DWARFLinkerCompileUnit.h.
Referenced by maybeResetToLoadedStage().
bool CompileUnit::updateDependenciesCompleteness | ( | ) |
Check dependend DIEs for incompatible placement.
Make placement to be consistent.
Definition at line 1841 of file DWARFLinkerCompileUnit.cpp.
References assert().
void CompileUnit::updateDieRefPatchesWithClonedOffsets | ( | ) |
After cloning stage the output DIEs offsets are deallocated.
This method copies output offsets for referenced DIEs into DIEs patches.
Replace stored DIE indexes with DIE output offsets.
Replace stored DIE indexes with DIE output offsets.
Replace stored DIE indexes with DIE output offsets.
Replace stored DIE indexes with DIE output offsets.
Definition at line 334 of file DWARFLinkerCompileUnit.cpp.
References llvm::dwarf_linker::DebugInfo, llvm::dwarf_linker::DebugLoc, llvm::dwarf_linker::DebugLocLists, getDieOutOffset(), llvm::dwarf_linker::parallel::DebugDieRefPatch::RefCU, llvm::dwarf_linker::parallel::DebugULEB128DieRefPatch::RefCU, llvm::dwarf_linker::parallel::DebugDieRefPatch::RefDieIdxOrClonedOffset, llvm::dwarf_linker::parallel::DebugULEB128DieRefPatch::RefDieIdxOrClonedOffset, and llvm::dwarf_linker::parallel::OutputSections::tryGetSectionDescriptor().
void CompileUnit::verifyDependencies | ( | ) |
Check DIEs to have a consistent marking(keep marking, placement marking).
Definition at line 1847 of file DWARFLinkerCompileUnit.cpp.
References assert().