14#ifndef LLVM_ANALYSIS_GENERICDOMTREEUPDATER_H
15#define LLVM_ANALYSIS_GENERICDOMTREEUPDATER_H
23template <
typename DerivedT,
typename DomTreeT,
typename PostDomTreeT>
25 DerivedT &derived() {
return *
static_cast<DerivedT *
>(
this); }
26 const DerivedT &derived()
const {
27 return *
static_cast<const DerivedT *
>(
this);
33 using UpdateT =
typename DomTreeT::UpdateType;
55 "Pending updates were not flushed by derived class.");
235 DomTreeT *
DT =
nullptr;
236 PostDomTreeT *
PDT =
nullptr;
245 return Update.getFrom() == Update.getTo();
274 template <
bool IsForward>
void applyUpdatesImpl();
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallSet class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
SmallPtrSet< BasicBlockT *, 8 > DeletedBBs
DomTreeT & getDomTree()
Flush DomTree updates and return DomTree.
PostDomTreeT & getPostDomTree()
Flush PostDomTree updates and return PostDomTree.
bool isEager() const
Returns true if the current strategy is Eager.
void applyPostDomTreeUpdates()
Helper function to apply all pending PostDomTree updates.
void applyUpdatesPermissive(ArrayRef< UpdateT > Updates)
Submit updates to all available trees.
GenericDomTreeUpdater(PostDomTreeT &PDT_, UpdateStrategy Strategy_)
void applyUpdates(ArrayRef< UpdateT > Updates)
Submit updates to all available trees.
bool IsRecalculatingPostDomTree
void eraseDelBBNode(BasicBlockT *DelBB)
Erase Basic Block node before it is unlinked from Function in the DomTree and PostDomTree.
void flush()
Apply all pending updates to available trees and flush all BasicBlocks awaiting deletion.
bool hasPendingUpdates() const
Returns true if either of DT or PDT is valid and the tree has at least one update pending.
bool hasDomTree() const
Returns true if it holds a DomTreeT.
bool isSelfDominance(UpdateT Update) const
Returns true if the update is self dominance.
const UpdateStrategy Strategy
typename DomTreeT::UpdateType UpdateT
bool hasPostDomTree() const
Returns true if it holds a PostDomTreeT.
typename DomTreeT::NodeType BasicBlockT
GenericDomTreeUpdater(DomTreeT &DT_, UpdateStrategy Strategy_)
void tryFlushDeletedBB()
Helper function to flush deleted BasicBlocks if all available trees are up-to-date.
bool isBBPendingDeletion(BasicBlockT *DelBB) const
Returns true if DelBB is awaiting deletion.
GenericDomTreeUpdater(DomTreeT *DT_, PostDomTreeT *PDT_, UpdateStrategy Strategy_)
void dropOutOfDateUpdates()
Drop all updates applied by all available trees and delete BasicBlocks if all available trees are up-...
bool IsRecalculatingDomTree
bool hasPendingPostDomTreeUpdates() const
Returns true if there are PostDomTreeT updates queued.
size_t PendPDTUpdateIndex
void recalculate(FuncT &F)
Notify DTU that the entry block was replaced.
void splitCriticalEdge(BasicBlockT *FromBB, BasicBlockT *ToBB, BasicBlockT *NewBB)
Apply updates that the critical edge (FromBB, ToBB) has been split with NewBB.
void applyDomTreeUpdates()
Helper function to apply all pending DomTree updates.
GenericDomTreeUpdater(UpdateStrategy Strategy_)
GenericDomTreeUpdater(DomTreeT &DT_, PostDomTreeT &PDT_, UpdateStrategy Strategy_)
GenericDomTreeUpdater(PostDomTreeT *PDT_, UpdateStrategy Strategy_)
bool isUpdateValid(UpdateT Update) const
Returns true if the update appears in the LLVM IR.
SmallVector< DomTreeUpdate, 16 > PendUpdates
bool hasPendingDeletedBB() const
Returns true if there is BasicBlockT awaiting deletion.
LLVM_DUMP_METHOD void dump() const
Debug method to help view the internal state of this class.
bool hasPendingDomTreeUpdates() const
Returns true if there are DomTreeT updates queued.
GenericDomTreeUpdater(DomTreeT *DT_, UpdateStrategy Strategy_)
bool isLazy() const
Returns true if the current strategy is Lazy.
bool contains(ConstPtrType Ptr) const
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This is an optimization pass for GlobalISel generic memory operations.
Helper structure used to hold all the basic blocks involved in the split of a critical edge.
DomTreeUpdate(CriticalEdge E)
DomTreeUpdate(UpdateT Update)