15 #ifndef LLVM_DOMTREEUPDATER_H 16 #define LLVM_DOMTREEUPDATER_H 33 : DT(&DT_), Strategy(Strategy_) {}
35 : DT(DT_), Strategy(Strategy_) {}
37 : PDT(&PDT_), Strategy(Strategy_) {}
39 : PDT(PDT_), Strategy(Strategy_) {}
42 : DT(&DT_), PDT(&PDT_), Strategy(Strategy_) {}
45 : DT(DT_), PDT(PDT_), Strategy(Strategy_) {}
96 bool ForceRemoveDuplicates =
false);
189 class CallBackOnDeletion final :
public CallbackVH {
193 :
CallbackVH(V), DelBB(V), Callback_(Callback) {}
197 std::function<void(BasicBlock *)> Callback_;
199 void deleted()
override {
206 size_t PendDTUpdateIndex = 0;
207 size_t PendPDTUpdateIndex = 0;
212 std::vector<CallBackOnDeletion> Callbacks;
213 bool IsRecalculatingDomTree =
false;
214 bool IsRecalculatingPostDomTree =
false;
224 bool forceFlushDeletedBB();
232 void applyDomTreeUpdates();
235 void applyPostDomTreeUpdates();
239 void tryFlushDeletedBB();
243 void dropOutOfDateUpdates();
259 #endif // LLVM_DOMTREEUPDATER_H DomTreeUpdater(DominatorTree &DT_, UpdateStrategy Strategy_)
DomTreeUpdater(DominatorTree *DT_, UpdateStrategy Strategy_)
Compute iterated dominance frontiers using a linear time algorithm.
DominatorTree & getDomTree()
Flush DomTree updates and return DomTree.
bool hasPostDomTree() const
Returns true if it holds a PostDominatorTree.
void flush()
Apply all pending updates to available trees and flush all BasicBlocks awaiting deletion.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
bool isLazy() const
Returns true if the current strategy is Lazy.
DomTreeUpdater(PostDominatorTree &PDT_, UpdateStrategy Strategy_)
DomTreeUpdater(PostDominatorTree *PDT_, UpdateStrategy Strategy_)
PostDominatorTree & getPostDomTree()
Flush PostDomTree updates and return PostDomTree.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
DomTreeUpdater(DominatorTree &DT_, PostDominatorTree &PDT_, UpdateStrategy Strategy_)
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
LLVM Basic Block Representation.
void deleteBB(BasicBlock *DelBB)
Delete DelBB.
DomTreeUpdater(DominatorTree *DT_, PostDominatorTree *PDT_, UpdateStrategy Strategy_)
bool isEager() const
Returns true if the current strategy is Eager.
bool recalculate(Function &F)
Recalculate all available trees.
virtual void deleted()
Callback for Value destruction.
void deleteEdge(BasicBlock *From, BasicBlock *To)
Notify all available trees on an edge deletion.
bool hasPendingDeletedBB() const
Returns true if there is BasicBlock awaiting deletion.
void insertEdge(BasicBlock *From, BasicBlock *To)
Notify all available trees on an edge insertion.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
bool hasPendingUpdates() const
Returns true if either of DT or PDT is valid and the tree has at least one update pending...
void applyUpdates(ArrayRef< DominatorTree::UpdateType > Updates, bool ForceRemoveDuplicates=false)
Apply updates on all available trees.
PostDominatorTree Class - Concrete subclass of DominatorTree that is used to compute the post-dominat...
DomTreeBuilder::UpdateKind UpdateKind
void deleteEdgeRelaxed(BasicBlock *From, BasicBlock *To)
Notify all available trees on an edge deletion.
bool hasPendingDomTreeUpdates() const
Returns true if there are DominatorTree updates queued.
void insertEdgeRelaxed(BasicBlock *From, BasicBlock *To)
Notify all available trees on an edge insertion.
void callbackDeleteBB(BasicBlock *DelBB, std::function< void(BasicBlock *)> Callback)
Delete DelBB.
bool isBBPendingDeletion(BasicBlock *DelBB) const
Returns true if DelBB is awaiting deletion.
bool hasPendingPostDomTreeUpdates() const
Returns true if there are PostDominatorTree updates queued.
LLVM_DUMP_METHOD void dump() const
Debug method to help view the internal state of this class.
DomTreeBuilder::Update< NodePtr > UpdateType
print Print MemDeps of function
This file defines a set of templates that efficiently compute a dominator tree over a generic graph...
Value handle with callbacks on RAUW and destruction.
DomTreeUpdater(UpdateStrategy Strategy_)
bool hasDomTree() const
Returns true if it holds a DominatorTree.