LLVM 20.0.0git
|
#include "llvm/Analysis/DomTreeUpdater.h"
Public Types | |
using | Base = GenericDomTreeUpdater< DomTreeUpdater, DominatorTree, PostDominatorTree > |
Public Types inherited from llvm::GenericDomTreeUpdater< DomTreeUpdater, DominatorTree, PostDominatorTree > | |
enum | UpdateStrategy |
using | BasicBlockT = typename DomTreeT::NodeType |
Public Member Functions | |
~DomTreeUpdater () | |
Mutation APIs | |
These methods provide APIs for submitting updates to the DominatorTree and the PostDominatorTree. Note: There are two strategies to update the DominatorTree and the PostDominatorTree:
Although GenericDomTree provides several update primitives, it is not encouraged to use these APIs directly. | |
void | deleteBB (BasicBlock *DelBB) |
Delete DelBB. | |
void | callbackDeleteBB (BasicBlock *DelBB, std::function< void(BasicBlock *)> Callback) |
Delete DelBB. | |
Public Member Functions inherited from llvm::GenericDomTreeUpdater< DomTreeUpdater, DominatorTree, PostDominatorTree > | |
GenericDomTreeUpdater (UpdateStrategy Strategy_) | |
GenericDomTreeUpdater (DominatorTree &DT_, UpdateStrategy Strategy_) | |
GenericDomTreeUpdater (DominatorTree *DT_, UpdateStrategy Strategy_) | |
GenericDomTreeUpdater (PostDominatorTree &PDT_, UpdateStrategy Strategy_) | |
GenericDomTreeUpdater (PostDominatorTree *PDT_, UpdateStrategy Strategy_) | |
GenericDomTreeUpdater (DominatorTree &DT_, PostDominatorTree &PDT_, UpdateStrategy Strategy_) | |
GenericDomTreeUpdater (DominatorTree *DT_, PostDominatorTree *PDT_, UpdateStrategy Strategy_) | |
~GenericDomTreeUpdater () | |
bool | isLazy () const |
Returns true if the current strategy is Lazy. | |
bool | isEager () const |
Returns true if the current strategy is Eager. | |
bool | hasDomTree () const |
Returns true if it holds a DomTreeT. | |
bool | hasPostDomTree () const |
Returns true if it holds a PostDomTreeT. | |
bool | hasPendingDeletedBB () const |
Returns true if there is BasicBlockT awaiting deletion. | |
bool | isBBPendingDeletion (BasicBlockT *DelBB) const |
Returns true if DelBB is 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 | hasPendingDomTreeUpdates () const |
Returns true if there are DomTreeT updates queued. | |
bool | hasPendingPostDomTreeUpdates () const |
Returns true if there are PostDomTreeT updates queued. | |
LLVM_DUMP_METHOD void | dump () const |
Debug method to help view the internal state of this class. | |
void | recalculate (FuncT &F) |
Notify DTU that the entry block was replaced. | |
void | applyUpdates (ArrayRef< typename DomTreeT::UpdateType > Updates) |
Submit updates to all available trees. | |
void | applyUpdatesPermissive (ArrayRef< typename DomTreeT::UpdateType > Updates) |
Submit updates to all available trees. | |
DominatorTree & | getDomTree () |
Flush DomTree updates and return DomTree. | |
PostDominatorTree & | getPostDomTree () |
Flush PostDomTree updates and return PostDomTree. | |
void | flush () |
Apply all pending updates to available trees and flush all BasicBlocks awaiting deletion. | |
Additional Inherited Members | |
Protected Member Functions inherited from llvm::GenericDomTreeUpdater< DomTreeUpdater, DominatorTree, PostDominatorTree > | |
bool | isSelfDominance (typename DomTreeT::UpdateType Update) const |
Returns true if the update is self dominance. | |
void | applyDomTreeUpdates () |
Helper function to apply all pending DomTree updates. | |
void | applyPostDomTreeUpdates () |
Helper function to apply all pending PostDomTree updates. | |
bool | isUpdateValid (typename DomTreeT::UpdateType Update) const |
Returns true if the update appears in the LLVM IR. | |
void | eraseDelBBNode (BasicBlockT *DelBB) |
Erase Basic Block node before it is unlinked from Function in the DomTree and PostDomTree. | |
void | tryFlushDeletedBB () |
Helper function to flush deleted BasicBlocks if all available trees are up-to-date. | |
void | dropOutOfDateUpdates () |
Drop all updates applied by all available trees and delete BasicBlocks if all available trees are up-to-date. | |
Protected Attributes inherited from llvm::GenericDomTreeUpdater< DomTreeUpdater, DominatorTree, PostDominatorTree > | |
SmallVector< typename DomTreeT::UpdateType, 16 > | PendUpdates |
size_t | PendDTUpdateIndex |
size_t | PendPDTUpdateIndex |
DominatorTree * | DT |
PostDominatorTree * | PDT |
const UpdateStrategy | Strategy |
SmallPtrSet< BasicBlockT *, 8 > | DeletedBBs |
bool | IsRecalculatingDomTree |
bool | IsRecalculatingPostDomTree |
Definition at line 28 of file DomTreeUpdater.h.
using llvm::DomTreeUpdater::Base = GenericDomTreeUpdater<DomTreeUpdater, DominatorTree, PostDominatorTree> |
Definition at line 35 of file DomTreeUpdater.h.
|
inline |
Definition at line 39 of file DomTreeUpdater.h.
References llvm::GenericDomTreeUpdater< DomTreeUpdater, DominatorTree, PostDominatorTree >::flush().
void llvm::DomTreeUpdater::callbackDeleteBB | ( | BasicBlock * | DelBB, |
std::function< void(BasicBlock *)> | Callback | ||
) |
Delete DelBB.
DelBB will be removed from its Parent and erased from available trees if it exists. Then the callback will be called. Finally, DelBB will be deleted. Under Eager UpdateStrategy, DelBB will be processed immediately. Under Lazy UpdateStrategy, DelBB will be queued until a flush event and all available trees are up-to-date. Assert if any instruction of DelBB is modified while awaiting deletion. Multiple callbacks can be queued for one DelBB under Lazy UpdateStrategy.
Definition at line 69 of file DomTreeUpdater.cpp.
References llvm::GenericDomTreeUpdater< DomTreeUpdater, DominatorTree, PostDominatorTree >::DeletedBBs, llvm::GenericDomTreeUpdater< DomTreeUpdater, DominatorTree, PostDominatorTree >::eraseDelBBNode(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::BasicBlock::removeFromParent(), and llvm::GenericDomTreeUpdater< DomTreeUpdater, DominatorTree, PostDominatorTree >::Strategy.
void llvm::DomTreeUpdater::deleteBB | ( | BasicBlock * | DelBB | ) |
Delete DelBB.
DelBB will be removed from its Parent and erased from available trees if it exists and finally get deleted. Under Eager UpdateStrategy, DelBB will be processed immediately. Under Lazy UpdateStrategy, DelBB will be queued until a flush event and all available trees are up-to-date. Assert if any instruction of DelBB is modified while awaiting deletion. When both DT and PDT are nullptrs, DelBB will be queued until flush() is called.
Definition at line 58 of file DomTreeUpdater.cpp.
References llvm::GenericDomTreeUpdater< DomTreeUpdater, DominatorTree, PostDominatorTree >::DeletedBBs, llvm::GenericDomTreeUpdater< DomTreeUpdater, DominatorTree, PostDominatorTree >::eraseDelBBNode(), llvm::BasicBlock::eraseFromParent(), llvm::SmallPtrSetImpl< PtrType >::insert(), and llvm::GenericDomTreeUpdater< DomTreeUpdater, DominatorTree, PostDominatorTree >::Strategy.
Referenced by llvm::DeleteDeadBlocks(), llvm::MergeBasicBlockIntoOnlyPred(), runSCCP(), and splitCallSite().