14#ifndef LLVM_ANALYSIS_DOMTREEUPDATER_H
15#define LLVM_ANALYSIS_DOMTREEUPDATER_H
26class PostDominatorTree;
34 : DT(&DT_), Strategy(Strategy_) {}
36 : DT(DT_), Strategy(Strategy_) {}
38 : PDT(&PDT_), Strategy(Strategy_) {}
40 : PDT(PDT_), Strategy(Strategy_) {}
43 : DT(&DT_), PDT(&PDT_), Strategy(Strategy_) {}
46 : DT(DT_), PDT(PDT_), Strategy(Strategy_) {}
203 class CallBackOnDeletion final :
public CallbackVH {
210 BasicBlock *DelBB =
nullptr;
211 std::function<void(BasicBlock *)> Callback_;
213 void deleted()
override {
219 SmallVector<DominatorTree::UpdateType, 16> PendUpdates;
220 size_t PendDTUpdateIndex = 0;
221 size_t PendPDTUpdateIndex = 0;
222 DominatorTree *DT =
nullptr;
223 PostDominatorTree *PDT =
nullptr;
225 SmallPtrSet<BasicBlock *, 8> DeletedBBs;
226 std::vector<CallBackOnDeletion> Callbacks;
227 bool IsRecalculatingDomTree =
false;
228 bool IsRecalculatingPostDomTree =
false;
235 void validateDeleteBB(BasicBlock *DelBB);
238 bool forceFlushDeletedBB();
241 void applyDomTreeUpdates();
244 void applyPostDomTreeUpdates();
248 void tryFlushDeletedBB();
252 void dropOutOfDateUpdates();
256 void eraseDelBBNode(BasicBlock *DelBB);
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file defines the SmallPtrSet class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
Value handle with callbacks on RAUW and destruction.
virtual void deleted()
Callback for Value destruction.
void flush()
Apply all pending updates to available trees and flush all BasicBlocks awaiting deletion.
void recalculate(Function &F)
Notify DTU that the entry block was replaced.
bool hasPendingDomTreeUpdates() const
Returns true if there are DominatorTree updates queued.
bool hasPostDomTree() const
Returns true if it holds a PostDominatorTree.
bool hasDomTree() const
Returns true if it holds a DominatorTree.
bool isEager() const
Returns true if the current strategy is Eager.
LLVM_DUMP_METHOD void dump() const
Debug method to help view the internal state of this class.
PostDominatorTree & getPostDomTree()
Flush PostDomTree updates and return PostDomTree.
DomTreeUpdater(DominatorTree *DT_, PostDominatorTree *PDT_, UpdateStrategy Strategy_)
bool hasPendingPostDomTreeUpdates() const
Returns true if there are PostDominatorTree updates queued.
bool hasPendingDeletedBB() const
Returns true if there is BasicBlock awaiting deletion.
bool isLazy() const
Returns true if the current strategy is Lazy.
bool hasPendingUpdates() const
Returns true if either of DT or PDT is valid and the tree has at least one update pending.
DomTreeUpdater(PostDominatorTree *PDT_, UpdateStrategy Strategy_)
DomTreeUpdater(DominatorTree &DT_, PostDominatorTree &PDT_, UpdateStrategy Strategy_)
bool isBBPendingDeletion(BasicBlock *DelBB) const
Returns true if DelBB is awaiting deletion.
void callbackDeleteBB(BasicBlock *DelBB, std::function< void(BasicBlock *)> Callback)
Delete DelBB.
DomTreeUpdater(UpdateStrategy Strategy_)
DomTreeUpdater(DominatorTree &DT_, UpdateStrategy Strategy_)
void applyUpdates(ArrayRef< DominatorTree::UpdateType > Updates)
Submit updates to all available trees.
DomTreeUpdater(DominatorTree *DT_, UpdateStrategy Strategy_)
void deleteBB(BasicBlock *DelBB)
Delete DelBB.
DominatorTree & getDomTree()
Flush DomTree updates and return DomTree.
DomTreeUpdater(PostDominatorTree &PDT_, UpdateStrategy Strategy_)
void applyUpdatesPermissive(ArrayRef< DominatorTree::UpdateType > Updates)
Submit updates to all available trees.
cfg::Update< NodePtr > UpdateType
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
PostDominatorTree Class - Concrete subclass of DominatorTree that is used to compute the post-dominat...
This is an optimization pass for GlobalISel generic memory operations.