LLVM 20.0.0git
Classes | Public Types | Public Member Functions | List of all members
llvm::DomTreeUpdater Class Reference

#include "llvm/Analysis/DomTreeUpdater.h"

Inheritance diagram for llvm::DomTreeUpdater:
Inheritance graph
[legend]

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:

  1. Eager UpdateStrategy: Updates are submitted and then flushed immediately.
  2. Lazy UpdateStrategy: Updates are submitted but only flushed when you explicitly call Flush APIs. It is recommended to use this update strategy when you submit a bunch of updates multiple times which can then add up to a large number of updates between two queries on the DominatorTree. The incremental updater can reschedule the updates or decide to recalculate the dominator tree in order to speedup the updating process depending on the number of updates.

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.
 
DominatorTreegetDomTree ()
 Flush DomTree updates and return DomTree.
 
PostDominatorTreegetPostDomTree ()
 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
 
DominatorTreeDT
 
PostDominatorTreePDT
 
const UpdateStrategy Strategy
 
SmallPtrSet< BasicBlockT *, 8 > DeletedBBs
 
bool IsRecalculatingDomTree
 
bool IsRecalculatingPostDomTree
 

Detailed Description

Examples
/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/llvm/include/llvm/Transforms/Utils/Local.h.

Definition at line 28 of file DomTreeUpdater.h.

Member Typedef Documentation

◆ Base

Definition at line 35 of file DomTreeUpdater.h.

Constructor & Destructor Documentation

◆ ~DomTreeUpdater()

llvm::DomTreeUpdater::~DomTreeUpdater ( )
inline

Member Function Documentation

◆ callbackDeleteBB()

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.

◆ deleteBB()

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().


The documentation for this class was generated from the following files: