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);
54 "Pending updates were not flushed by derived class.");
211 DomTreeT *
DT =
nullptr;
212 PostDomTreeT *
PDT =
nullptr;
221 return Update.getFrom() == Update.getTo();
233 bool isUpdateValid(
typename DomTreeT::UpdateType Update)
const;
#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.
void applyUpdatesPermissive(ArrayRef< typename DomTreeT::UpdateType > Updates)
Submit updates to all available trees.
bool isEager() const
Returns true if the current strategy is Eager.
void applyPostDomTreeUpdates()
Helper function to apply all pending PostDomTree updates.
GenericDomTreeUpdater(PostDomTreeT &PDT_, UpdateStrategy Strategy_)
bool IsRecalculatingPostDomTree
void applyUpdates(ArrayRef< typename DomTreeT::UpdateType > Updates)
Submit updates to all available trees.
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.
SmallVector< typename DomTreeT::UpdateType, 16 > PendUpdates
bool hasDomTree() const
Returns true if it holds a DomTreeT.
const UpdateStrategy Strategy
bool isSelfDominance(typename DomTreeT::UpdateType Update) const
Returns true if the update is self dominance.
bool hasPostDomTree() const
Returns true if it holds a PostDomTreeT.
typename DomTreeT::NodeType BasicBlockT
GenericDomTreeUpdater(DomTreeT &DT_, UpdateStrategy Strategy_)
bool isUpdateValid(typename DomTreeT::UpdateType Update) const
Returns true if the update appears in the LLVM IR.
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 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 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.