9#ifndef LLVM_LIB_DWARFLINKER_PARALLEL_DEPENDENCYTRACKER_H
10#define LLVM_LIB_DWARFLINKER_PARALLEL_DEPENDENCYTRACKER_H
43 bool InterCUProcessingStarted,
44 std::atomic<bool> &HasNewInterconnectedCUs);
109 bool isSingleAction(LiveRootWorklistActionTy Action) {
227 "CompileUnit insufficiently aligned to have enough low bits.");
293 std::optional<UnitEntryPairTy> ReferencedBy,
306 std::atomic<bool> &HasNewInterconnectedCUs);
316 bool InterCUProcessingStarted,
317 std::atomic<bool> &HasNewInterconnectedCUs,
364 bool InterCUProcessingStarted,
365 std::atomic<bool> &HasNewInterconnectedCUs,
378 std::optional<UnitEntryPairTy> ReferencedBy,
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the DenseMap class.
This file defines the PointerIntPair class.
This file defines the SmallVector class.
A pointer to another debug information entry.
DWARFDebugInfoEntry - A DIE with only the minimum required data.
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
PointerIntPair - This class implements a pair of a pointer and small integer.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Stores all information related to a compile unit, be it in its original instance of the object file o...
DieOutputPlacement
Kinds of placement for the output die.
UnitEntryPairTy getReferencedByEntry() const
LiveRootWorklistItemTy(const LiveRootWorklistItemTy &)=default
LiveRootWorklistItemTy(LiveRootWorklistActionTy Action, UnitEntryPairTy RootEntry, UnitEntryPairTy ReferencedBy, const DWARFDebugInfoEntry *ReferencedTypeDieEntry=nullptr)
LiveRootWorklistItemTy()=default
LiveRootWorklistItemTy(LiveRootWorklistActionTy Action, UnitEntryPairTy RootEntry)
PointerIntPair< CompileUnit *, 3, LiveRootWorklistActionTy, CompileUnitPointerTraits > RootCU
UnitEntryPairTy getRootEntry() const
const DWARFDebugInfoEntry * getReferencedTypeDieEntry() const
const DWARFDebugInfoEntry * ReferencedByDieEntry
const DWARFDebugInfoEntry * ReferencedTypeDieEntry
The DIE actually referenced by ReferencedByDieEntry.
CompileUnit * ReferencedByCU
Another root entry which references this RootDieEntry.
const DWARFDebugInfoEntry * RootDieEntry
LiveRootWorklistActionTy getAction() const
CompileUnit::DieOutputPlacement getPlacement() const
bool hasReferencedByOtherEntry() const
bool markDIEEntryAsKeptRec(LiveRootWorklistActionTy Action, const UnitEntryPairTy &RootEntry, const UnitEntryPairTy &Entry, bool InterCUProcessingStarted, std::atomic< bool > &HasNewInterconnectedCUs, TreeWalkKindTy Kind=TreeWalkKindTy::MarkTree)
Mark whole DIE tree as kept recursively.
void verifyKeepChain()
Recursively walk the DIE tree and check "keepness" and "placement" information.
RootEntriesListTy Dependencies
List of entries dependencies.
void markParentsAsKeepingChildren(const UnitEntryPairTy &Entry)
Mark parents as keeping children.
UnitEntryPairTy getRootForSpecifiedEntry(UnitEntryPairTy Entry)
static bool recordsDepsOnly(TreeWalkKindTy Kind)
bool demoteIfIncomplete(const UnitEntryPairTy &Root, const DWARFDebugInfoEntry *ReferencedTypeDieEntry, const UnitEntryPairTy &ReferencedBy)
Demote ReferencedBy to plain DWARF if it may not stay in the type table while the DIE it references t...
bool markCollectedLiveRootsAsKept(bool InterCUProcessingStarted, std::atomic< bool > &HasNewInterconnectedCUs)
Examine worklist and mark all 'root DIE's as kept and set "Placement" property.
bool InterCUProcessingWasStarted
Whether inter-unit references could be resolved during marking.
bool applySubtreeSummaries()
Apply each summarized subtree's dependencies to every root recorded as referencing it.
bool isLiveAction(LiveRootWorklistActionTy Action)
bool isChildrenAction(LiveRootWorklistActionTy Action)
TreeWalkKindTy
What a tree walk does, and for a walk that only records dependencies, which root the dependencies it ...
@ MarkTree
Mark the tree as kept and schedule the roots it references.
@ RecordSubtreeDeps
Do not mark.
@ RecordNestedSubprogramDeps
Do not mark.
bool isTypeAction(LiveRootWorklistActionTy Action)
void addActionToRootEntriesWorkList(LiveRootWorklistActionTy Action, const UnitEntryPairTy &Entry, std::optional< UnitEntryPairTy > ReferencedBy, const DWARFDebugInfoEntry *ReferencedTypeDieEntry=nullptr)
Add action item to the work list.
DenseMap< SubtreeDependenciesKeyTy, SubtreeDependenciesTy > SubtreeSummaries
Dependency summaries of already-marked subtrees, keyed by subtree and action.
SubtreeDependenciesTy * CollectedSubtreeDeps
Where the walk in progress collects the dependencies that belong to the root referencing the walked s...
bool isTypeTableCandidate(const DWARFDebugInfoEntry *DIEEntry)
DependencyTracker(CompileUnit &CU)
size_t MaterializedRefs
Number of leading SubtreeDependencyRefs whose subtree is summarized.
SmallVector< LiveRootWorklistItemTy > RootEntriesListTy
void setPlainDwarfPlacementRec(const UnitEntryPairTy &Entry)
Mark whole DIE tree as placed in "PlainDwarf".
RootEntriesListTy RootEntriesWorkList
List of entries which are 'root DIE's.
SmallVector< SubtreeDependencyTy > SubtreeDependenciesTy
static bool isLiveSubprogramEntry(const UnitEntryPairTy &Entry)
Returns true if specified subprogram references live code section.
std::tuple< CompileUnit *, const DWARFDebugInfoEntry *, LiveRootWorklistActionTy > SubtreeDependenciesKeyTy
A subtree paired with the action it is walked with, which selects both the visited children and the a...
void recordSubtreeDependencies(LiveRootWorklistActionTy Action, const UnitEntryPairTy &RootEntry, const UnitEntryPairTy &Entry)
Record that RootEntry references the already-marked subtree Entry, and therefore carries the complete...
bool resolveDependenciesAndMarkLiveness(bool InterCUProcessingStarted, std::atomic< bool > &HasNewInterconnectedCUs)
Recursively walk the DIE tree and look for DIEs to keep.
static bool isLiveVariableEntry(const UnitEntryPairTy &Entry, bool IsLiveParent)
Returns true if specified variable references live code section.
@ MarkSingleTypeEntry
Mark current item as type entry.
@ MarkSingleLiveEntry
Mark current item as live entry.
@ MarkTypeEntryRec
Mark current item and all its children as type entry.
@ MarkLiveChildrenRec
Mark all children of current item as live entry.
@ MarkLiveEntryRec
Mark current item and all its children as live entry.
@ MarkTypeChildrenRec
Mark all children of current item as type entry.
SmallVector< SubtreeDependencyRefTy > SubtreeDependencyRefs
Roots referencing an already-marked subtree.
void collectRootsToKeep(const UnitEntryPairTy &Entry, std::optional< UnitEntryPairTy > ReferencedBy, bool IsLiveParent)
This function navigates DIEs tree starting from specified Entry.
bool maybeAddReferencedRoots(LiveRootWorklistActionTy Action, const UnitEntryPairTy &RootEntry, const UnitEntryPairTy &Entry, bool InterCUProcessingStarted, std::atomic< bool > &HasNewInterconnectedCUs, TreeWalkKindTy Kind=TreeWalkKindTy::MarkTree)
Check referenced DIEs and add them into the worklist.
bool updateDependenciesCompleteness()
Check if dependencies have incompatible placement.
void materializeSubtreeSummaries()
Walk every subtree that a recorded reference stands for, once per subtree and action,...
This is an optimization pass for GlobalISel generic memory operations.
static void * getAsVoidPointer(CompileUnit *P)
static constexpr int NumLowBitsAvailable
static CompileUnit * getFromVoidPointer(void *P)
A root referencing an already-marked subtree, standing in for all of that subtree's dependencies.
UnitEntryPairTy ReferencedBy
LiveRootWorklistActionTy Action
A completeness dependency of a subtree that belongs to whichever root references the subtree,...
LiveRootWorklistActionTy Action
const DWARFDebugInfoEntry * ReferencedTypeDieEntry
This is a helper structure which keeps a debug info entry with it's containing compilation unit.
const DWARFDebugInfoEntry * DieEntry