Go to the documentation of this file.
14 #ifndef LLVM_ANALYSIS_DOMTREEUPDATER_H
15 #define LLVM_ANALYSIS_DOMTREEUPDATER_H
26 class 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 {
207 :
CallbackVH(V), DelBB(V), Callback_(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;
238 bool forceFlushDeletedBB();
241 void applyDomTreeUpdates();
244 void applyPostDomTreeUpdates();
248 void tryFlushDeletedBB();
252 void dropOutOfDateUpdates();
268 #endif // LLVM_ANALYSIS_DOMTREEUPDATER_H
bool hasPendingDeletedBB() const
Returns true if there is BasicBlock awaiting deletion.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This is an optimization pass for GlobalISel generic memory operations.
DomTreeUpdater(DominatorTree *DT_, PostDominatorTree *PDT_, UpdateStrategy Strategy_)
void deleteBB(BasicBlock *DelBB)
Delete DelBB.
virtual void deleted()
Callback for Value destruction.
bool isEager() const
Returns true if the current strategy is Eager.
void applyUpdates(ArrayRef< DominatorTree::UpdateType > Updates)
Submit updates to all available trees.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
bool hasPendingUpdates() const
Returns true if either of DT or PDT is valid and the tree has at least one update pending.
LLVM Basic Block Representation.
bool hasPendingPostDomTreeUpdates() const
Returns true if there are PostDominatorTree updates queued.
void callbackDeleteBB(BasicBlock *DelBB, std::function< void(BasicBlock *)> Callback)
Delete DelBB.
bool isBBPendingDeletion(BasicBlock *DelBB) const
Returns true if DelBB is awaiting deletion.
LLVM_DUMP_METHOD void dump() const
Debug method to help view the internal state of this class.
cfg::Update< NodePtr > UpdateType
bool hasPendingDomTreeUpdates() const
Returns true if there are DominatorTree updates queued.
void recalculate(Function &F)
Notify DTU that the entry block was replaced.
DomTreeUpdater(UpdateStrategy Strategy_)
bool hasDomTree() const
Returns true if it holds a DominatorTree.
DomTreeUpdater(DominatorTree &DT_, UpdateStrategy Strategy_)
DomTreeUpdater(DominatorTree *DT_, UpdateStrategy Strategy_)
DominatorTree & getDomTree()
Flush DomTree updates and return DomTree.
bool hasPostDomTree() const
Returns true if it holds a PostDominatorTree.
@ BasicBlock
Various leaf nodes.
print Print MemDeps of function
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
DomTreeUpdater(PostDominatorTree &PDT_, UpdateStrategy Strategy_)
PostDominatorTree Class - Concrete subclass of DominatorTree that is used to compute the post-dominat...
void flush()
Apply all pending updates to available trees and flush all BasicBlocks awaiting deletion.
bool isLazy() const
Returns true if the current strategy is Lazy.
DomTreeUpdater(PostDominatorTree *PDT_, UpdateStrategy Strategy_)
Value handle with callbacks on RAUW and destruction.
PostDominatorTree & getPostDomTree()
Flush PostDomTree updates and return PostDomTree.
void applyUpdatesPermissive(ArrayRef< DominatorTree::UpdateType > Updates)
Submit updates to all available trees.
DomTreeUpdater(DominatorTree &DT_, PostDominatorTree &PDT_, UpdateStrategy Strategy_)