|
LLVM
5.0.0
|
Core dominator tree base class. More...
#include "llvm/Analysis/LoopInfo.h"
Public Types | |
| using | NodeType = NodeT |
| using | NodePtr = NodeT * |
Public Member Functions | |
| DominatorTreeBase () | |
| DominatorTreeBase (DominatorTreeBase &&Arg) | |
| DominatorTreeBase & | operator= (DominatorTreeBase &&RHS) |
| DominatorTreeBase (const DominatorTreeBase &)=delete | |
| DominatorTreeBase & | operator= (const DominatorTreeBase &)=delete |
| const std::vector< NodeT * > & | getRoots () const |
| getRoots - Return the root blocks of the current CFG. More... | |
| bool | isPostDominator () const |
| isPostDominator - Returns true if analysis based of postdoms More... | |
| bool | compare (const DominatorTreeBase &Other) const |
| compare - Return false if the other dominator tree base matches this dominator tree base. More... | |
| void | releaseMemory () |
| DomTreeNodeBase< NodeT > * | getNode (NodeT *BB) const |
| getNode - return the (Post)DominatorTree node for the specified basic block. More... | |
| DomTreeNodeBase< NodeT > * | operator[] (NodeT *BB) const |
| See getNode. More... | |
| DomTreeNodeBase< NodeT > * | getRootNode () |
| getRootNode - This returns the entry node for the CFG of the function. More... | |
| const DomTreeNodeBase< NodeT > * | getRootNode () const |
| void | getDescendants (NodeT *R, SmallVectorImpl< NodeT * > &Result) const |
| Get all nodes dominated by R, including R itself. More... | |
| bool | properlyDominates (const DomTreeNodeBase< NodeT > *A, const DomTreeNodeBase< NodeT > *B) const |
| properlyDominates - Returns true iff A dominates B and A != B. More... | |
| bool | properlyDominates (const NodeT *A, const NodeT *B) const |
| bool | isReachableFromEntry (const NodeT *A) const |
| isReachableFromEntry - Return true if A is dominated by the entry block of the function containing it. More... | |
| bool | isReachableFromEntry (const DomTreeNodeBase< NodeT > *A) const |
| bool | dominates (const DomTreeNodeBase< NodeT > *A, const DomTreeNodeBase< NodeT > *B) const |
| dominates - Returns true iff A dominates B. More... | |
| bool | dominates (const NodeT *A, const NodeT *B) const |
| NodeT * | getRoot () const |
| NodeT * | findNearestCommonDominator (NodeT *A, NodeT *B) const |
| findNearestCommonDominator - Find nearest common dominator basic block for basic block A and B. More... | |
| const NodeT * | findNearestCommonDominator (const NodeT *A, const NodeT *B) const |
| bool | isVirtualRoot (const DomTreeNodeBase< NodeT > *A) const |
| void | insertEdge (NodeT *From, NodeT *To) |
| Inform the dominator tree about a CFG edge insertion and update the tree. More... | |
| void | deleteEdge (NodeT *From, NodeT *To) |
| Inform the dominator tree about a CFG edge deletion and update the tree. More... | |
| DomTreeNodeBase< NodeT > * | addNewBlock (NodeT *BB, NodeT *DomBB) |
| Add a new node to the dominator tree information. More... | |
| DomTreeNodeBase< NodeT > * | setNewRoot (NodeT *BB) |
| Add a new node to the forward dominator tree and make it a new root. More... | |
| void | changeImmediateDominator (DomTreeNodeBase< NodeT > *N, DomTreeNodeBase< NodeT > *NewIDom) |
| changeImmediateDominator - This method is used to update the dominator tree information when a node's immediate dominator changes. More... | |
| void | changeImmediateDominator (NodeT *BB, NodeT *NewBB) |
| void | eraseNode (NodeT *BB) |
| eraseNode - Removes a node from the dominator tree. More... | |
| void | splitBlock (NodeT *NewBB) |
| splitBlock - BB is split and now it has one successor. More... | |
| void | print (raw_ostream &O) const |
| print - Convert to human readable form More... | |
| void | updateDFSNumbers () const |
| updateDFSNumbers - Assign In and Out numbers to the nodes while walking dominator tree in dfs order. More... | |
| template<class FT > | |
| void | recalculate (FT &F) |
| recalculate - compute a dominator tree for the given function More... | |
| bool | verify () const |
| verify - check parent and sibling property More... | |
Static Public Attributes | |
| static constexpr bool | IsPostDominator = IsPostDom |
Protected Types | |
| using | DomTreeNodeMapType = DenseMap< NodeT *, std::unique_ptr< DomTreeNodeBase< NodeT >>> |
| using | ParentPtr = decltype(std::declval< NodeT * >() ->getParent()) |
Protected Member Functions | |
| void | addRoot (NodeT *BB) |
| void | reset () |
| template<class N > | |
| void | Split (typename GraphTraits< N >::NodeRef NewBB) |
| template<> | |
| void | addRoot (MachineBasicBlock *MBB) |
Protected Attributes | |
| std::vector< NodeT * > | Roots |
| DomTreeNodeMapType | DomTreeNodes |
| DomTreeNodeBase< NodeT > * | RootNode |
| ParentPtr | Parent = nullptr |
| bool | DFSInfoValid = false |
| unsigned int | SlowQueries = 0 |
Friends | |
| struct | DomTreeBuilder::SemiNCAInfo< DominatorTreeBase > |
Core dominator tree base class.
This class is a generic template over graph nodes. It is instantiated for various graphs in the LLVM IR or in the code generator.
Definition at line 60 of file LoopInfo.h.
|
protected |
Definition at line 215 of file GenericDomTree.h.
| using llvm::DominatorTreeBase< N, IsPostDom >::NodePtr = NodeT * |
Definition at line 230 of file GenericDomTree.h.
| using llvm::DominatorTreeBase< N, IsPostDom >::NodeType = NodeT |
Definition at line 229 of file GenericDomTree.h.
|
protected |
Definition at line 218 of file GenericDomTree.h.
|
inline |
Definition at line 233 of file GenericDomTree.h.
|
inline |
Definition at line 235 of file GenericDomTree.h.
|
delete |
|
inline |
Add a new node to the dominator tree information.
This creates a new node as a child of DomBB dominator node, linking it into the children list of the immediate dominator.
| BB | New node in CFG. |
| DomBB | CFG node that is dominator for BB. |
Definition at line 505 of file GenericDomTree.h.
Referenced by cloneLoopBlocks(), CloneLoopBlocks(), llvm::cloneLoopWithPreheader(), llvm::DominatorTreeBase< BasicBlock, false >::Split(), llvm::SplitBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::UnrollLoop(), and unswitchTrivialSwitch().
|
inlineprotected |
Definition at line 32 of file MachineDominators.h.
|
inlineprotected |
Definition at line 676 of file GenericDomTree.h.
Referenced by llvm::DominatorTreeBase< BasicBlock, false >::recalculate(), and llvm::DominatorTreeBase< BasicBlock, false >::setNewRoot().
|
inline |
changeImmediateDominator - This method is used to update the dominator tree information when a node's immediate dominator changes.
Definition at line 543 of file GenericDomTree.h.
Referenced by llvm::DominatorTreeBase< BasicBlock, false >::changeImmediateDominator(), cloneLoopBlocks(), llvm::cloneLoopWithPreheader(), ConnectEpilog(), ConnectProlog(), deleteDeadLoop(), foldBlockIntoPredecessor(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), llvm::peelLoop(), simplifyOneLoop(), llvm::DominatorTreeBase< BasicBlock, false >::Split(), llvm::SplitBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), updateDTAfterUnswitch(), updateLoopExitIDom(), and llvm::LoopVersioning::versionLoop().
|
inline |
Definition at line 550 of file GenericDomTree.h.
|
inline |
compare - Return false if the other dominator tree base matches this dominator tree base.
Otherwise return true.
Definition at line 271 of file GenericDomTree.h.
|
inline |
Inform the dominator tree about a CFG edge deletion and update the tree.
This function has to be called just after making the update on the actual CFG. There cannot be any other updates that the dominator tree doesn't know about. The only exception is when the deletion that the tree is informed about makes some (domominator) subtree unreachable – in this case, it is fine to perform deletions within this subtree.
Note that for postdominators it automatically takes care of deleting a reverse edge internally (so there's no need to swap the parameters).
Definition at line 488 of file GenericDomTree.h.
|
inline |
dominates - Returns true iff A dominates B.
Note that this is not a constant time operation!
Definition at line 364 of file GenericDomTree.h.
Referenced by llvm::LoopInfoBase< N, M >::analyze(), isFullPostDominator(), llvm::DominatorTreeBase< BasicBlock, false >::properlyDominates(), and llvm::DominatorTreeBase< BasicBlock, false >::Split().
| bool llvm::DominatorTreeBase< NodeT, IsPostDom >::dominates | ( | const NodeT * | A, |
| const NodeT * | B | ||
| ) | const |
Definition at line 777 of file GenericDomTree.h.
|
inline |
eraseNode - Removes a node from the dominator tree.
Block must not dominate any other blocks. Removes node from its immediate dominator's children list. Deletes dominator node associated with basic block BB.
Definition at line 557 of file GenericDomTree.h.
Referenced by deleteDeadLoop(), foldBlockIntoPredecessor(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), and simplifyOneLoop().
|
inline |
findNearestCommonDominator - Find nearest common dominator basic block for basic block A and B.
If there is no such block then return NULL.
Definition at line 416 of file GenericDomTree.h.
Referenced by llvm::DominatorTreeBase< BasicBlock, false >::findNearestCommonDominator(), getInsertPointForUses(), nearest_common_dominator(), llvm::DominatorTreeBase< BasicBlock, false >::Split(), llvm::UnrollLoop(), and updateLoopExitIDom().
|
inline |
Definition at line 444 of file GenericDomTree.h.
|
inline |
Get all nodes dominated by R, including R itself.
Definition at line 322 of file GenericDomTree.h.
|
inline |
getNode - return the (Post)DominatorTree node for the specified basic block.
This is the same as using operator[] on this class. The result may (but is not required to) be null for a forward (backwards) statically unreachable block.
Definition at line 301 of file GenericDomTree.h.
Referenced by llvm::DominatorTreeBase< BasicBlock, false >::addNewBlock(), llvm::DominatorTreeBase< BasicBlock, false >::changeImmediateDominator(), cloneLoopBlocks(), CloneLoopBlocks(), llvm::cloneLoopWithPreheader(), computeBlocksDominatingExits(), containsUnconditionalCallSafepoint(), llvm::DominatorTreeBase< BasicBlock, false >::eraseNode(), findBestInsertionSet(), llvm::DominatorTreeBase< BasicBlock, false >::findNearestCommonDominator(), foldBlockIntoPredecessor(), llvm::formLCSSAForInstructions(), llvm::DominatorTreeBase< BasicBlock, false >::getDescendants(), llvm::DominatorTreeBase< BasicBlock, false >::isReachableFromEntry(), isSimplifiedLoopNest(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), llvm::DominatorTreeBase< BasicBlock, false >::operator[](), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), preheader(), llvm::DominatorTreeBase< BasicBlock, false >::setNewRoot(), simplifyOneLoop(), SinkInstruction(), llvm::DominatorTreeBase< BasicBlock, false >::Split(), llvm::SplitBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::UnrollLoop(), and llvm::UnrollRuntimeLoopRemainder().
|
inline |
Definition at line 409 of file GenericDomTree.h.
Referenced by nearest_common_dominatee().
|
inline |
getRootNode - This returns the entry node for the CFG of the function.
If this tree represents the post-dominance relations for a function, however, this root may be a node with the block == NULL. This is the case when there are multiple exit nodes from a particular function. Consumers of post-dominance information must be capable of dealing with this possibility.
Definition at line 318 of file GenericDomTree.h.
Referenced by llvm::LoopInfoBase< N, M >::analyze(), llvm::DominatorTree::compare(), llvm::GraphTraits< PostDominatorTree * >::getEntryNode(), llvm::GraphTraits< DominatorTree * >::getEntryNode(), llvm::DOTGraphTraits< DominatorTree * >::getNodeLabel(), llvm::DOTGraphTraits< PostDominatorTree * >::getNodeLabel(), llvm::MemorySSA::OptimizeUses::optimizeUses(), llvm::DominatorTreeBase< BasicBlock, false >::print(), llvm::DominatorTreeBase< BasicBlock, false >::updateDFSNumbers(), and llvm::MachineDominatorTree::verifyDomTree().
|
inline |
Definition at line 319 of file GenericDomTree.h.
|
inline |
getRoots - Return the root blocks of the current CFG.
This may include multiple blocks if we are computing post dominators. For forward dominators, this will always be a single block (the entry node).
Definition at line 263 of file GenericDomTree.h.
Referenced by llvm::ForwardDominanceFrontierBase< BasicBlock >::analyze().
|
inline |
Inform the dominator tree about a CFG edge insertion and update the tree.
This function has to be called just before or just after making the update on the actual CFG. There cannot be any other updates that the dominator tree doesn't know about.
Note that for postdominators it automatically takes care of inserting a reverse edge internally (so there's no need to swap the parameters).
Definition at line 469 of file GenericDomTree.h.
|
inline |
isPostDominator - Returns true if analysis based of postdoms
Definition at line 267 of file GenericDomTree.h.
Referenced by llvm::DominatorTreeBase< BasicBlock, false >::findNearestCommonDominator(), llvm::DominatorTreeBase< BasicBlock, false >::isReachableFromEntry(), llvm::DominatorTreeBase< BasicBlock, false >::isVirtualRoot(), llvm::DominatorTreeBase< BasicBlock, false >::print(), and llvm::DominatorTreeBase< BasicBlock, false >::setNewRoot().
|
inline |
isReachableFromEntry - Return true if A is dominated by the entry block of the function containing it.
Definition at line 353 of file GenericDomTree.h.
Referenced by llvm::LoopInfoBase< N, M >::analyze(), llvm::discoverAndMapSubloop(), llvm::DominatorTreeBase< BasicBlock, false >::dominates(), llvm::DominatorTreeBase< BasicBlock, false >::isReachableFromEntry(), and llvm::DominatorTreeBase< BasicBlock, false >::Split().
|
inline |
Definition at line 359 of file GenericDomTree.h.
|
inline |
Definition at line 452 of file GenericDomTree.h.
|
inline |
Definition at line 245 of file GenericDomTree.h.
|
delete |
|
inline |
See getNode.
Definition at line 309 of file GenericDomTree.h.
|
inline |
print - Convert to human readable form
Definition at line 587 of file GenericDomTree.h.
Referenced by llvm::PostDominatorTreeWrapperPass::print(), llvm::DominatorTreeWrapperPass::print(), llvm::DominatorTree::verifyDomTree(), and llvm::MachineDominatorTree::verifyDomTree().
|
inline |
properlyDominates - Returns true iff A dominates B and A != B.
Note that this is not a constant time operation!
Definition at line 340 of file GenericDomTree.h.
Referenced by llvm::ForwardDominanceFrontierBase< BlockT >::calculate(), ConstructSSAForLoadSet(), isLoadInvariantInLoop(), isLoopInvariant(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), and llvm::replaceDominatedUsesWith().
| bool llvm::DominatorTreeBase< NodeT, IsPostDom >::properlyDominates | ( | const NodeT * | A, |
| const NodeT * | B | ||
| ) | const |
Definition at line 789 of file GenericDomTree.h.
|
inline |
recalculate - compute a dominator tree for the given function
Definition at line 653 of file GenericDomTree.h.
Referenced by AddAliasScopeMetadata(), AddAlignmentAssumptions(), llvm::OptimizationRemarkEmitter::OptimizationRemarkEmitter(), llvm::PostDominatorTreeAnalysis::run(), llvm::DominatorTreeAnalysis::run(), llvm::PostDominatorTreeWrapperPass::runOnFunction(), llvm::DominatorTree::verifyDomTree(), and llvm::MachineDominatorTree::verifyDomTree().
|
inline |
Definition at line 295 of file GenericDomTree.h.
Referenced by llvm::PostDominatorTreeWrapperPass::releaseMemory(), and llvm::DominatorTreeWrapperPass::releaseMemory().
|
inlineprotected |
Definition at line 678 of file GenericDomTree.h.
Referenced by llvm::DominatorTreeBase< BasicBlock, false >::recalculate(), llvm::DominatorTreeBase< BasicBlock, false >::releaseMemory(), and llvm::JumpThreadingPass::run().
|
inline |
Add a new node to the forward dominator tree and make it a new root.
| BB | New node in CFG. |
Definition at line 519 of file GenericDomTree.h.
|
inlineprotected |
Definition at line 690 of file GenericDomTree.h.
|
inline |
splitBlock - BB is split and now it has one successor.
Update dominator tree to reflect this change.
Definition at line 578 of file GenericDomTree.h.
Referenced by insertUniqueBackedgeBlock(), and UpdateAnalysisInformation().
|
inline |
updateDFSNumbers - Assign In and Out numbers to the nodes while walking dominator tree in dfs order.
Definition at line 604 of file GenericDomTree.h.
Referenced by llvm::DominatorTreeBase< BasicBlock, false >::dominates().
|
inline |
verify - check parent and sibling property
Definition at line 673 of file GenericDomTree.h.
|
friend |
Definition at line 224 of file GenericDomTree.h.
|
mutableprotected |
Definition at line 221 of file GenericDomTree.h.
Referenced by llvm::DominatorTreeBase< BasicBlock, false >::addNewBlock(), llvm::DominatorTreeBase< BasicBlock, false >::changeImmediateDominator(), llvm::DominatorTreeBase< BasicBlock, false >::dominates(), llvm::DominatorTreeBase< BasicBlock, false >::operator=(), llvm::DominatorTreeBase< BasicBlock, false >::print(), llvm::DominatorTreeBase< BasicBlock, false >::reset(), llvm::DominatorTreeBase< BasicBlock, false >::setNewRoot(), and llvm::DominatorTreeBase< BasicBlock, false >::updateDFSNumbers().
|
protected |
Definition at line 216 of file GenericDomTree.h.
Referenced by llvm::DominatorTreeBase< BasicBlock, false >::addNewBlock(), llvm::DominatorTreeBase< BasicBlock, false >::compare(), llvm::DominatorTreeBase< BasicBlock, false >::eraseNode(), llvm::DominatorTreeBase< BasicBlock, false >::getNode(), llvm::DominatorTreeBase< BasicBlock, false >::operator=(), llvm::DominatorTreeBase< BasicBlock, false >::reset(), and llvm::DominatorTreeBase< BasicBlock, false >::setNewRoot().
|
static |
Definition at line 231 of file GenericDomTree.h.
Referenced by llvm::DominatorTreeBase< BasicBlock, false >::isPostDominator(), llvm::DominatorTreeBase< BasicBlock, false >::recalculate(), and llvm::DominatorTreeBase< BasicBlock, false >::splitBlock().
|
protected |
Definition at line 219 of file GenericDomTree.h.
Referenced by llvm::DominatorTreeBase< BasicBlock, false >::compare(), llvm::DominatorTreeBase< BasicBlock, false >::deleteEdge(), llvm::DominatorTreeBase< BasicBlock, false >::insertEdge(), llvm::DominatorTreeBase< BasicBlock, false >::operator=(), llvm::DominatorTreeBase< BasicBlock, false >::recalculate(), and llvm::DominatorTreeBase< BasicBlock, false >::reset().
|
protected |
Definition at line 217 of file GenericDomTree.h.
Referenced by llvm::DominatorTreeBase< BasicBlock, false >::getRootNode(), llvm::DominatorTreeBase< BasicBlock, false >::operator=(), llvm::DominatorTreeBase< BasicBlock, false >::reset(), and llvm::DominatorTreeBase< BasicBlock, false >::setNewRoot().
|
protected |
Definition at line 212 of file GenericDomTree.h.
Referenced by llvm::DominatorTreeBase< BasicBlock, false >::addRoot(), llvm::DominatorTreeBase< BasicBlock, false >::getRoot(), llvm::DominatorTreeBase< BasicBlock, false >::getRoots(), llvm::DominatorTreeBase< BasicBlock, false >::operator=(), llvm::DominatorTreeBase< BasicBlock, false >::reset(), and llvm::DominatorTreeBase< BasicBlock, false >::setNewRoot().
|
mutableprotected |
Definition at line 222 of file GenericDomTree.h.
Referenced by llvm::DominatorTreeBase< BasicBlock, false >::dominates(), llvm::DominatorTreeBase< BasicBlock, false >::operator=(), llvm::DominatorTreeBase< BasicBlock, false >::print(), llvm::DominatorTreeBase< BasicBlock, false >::reset(), and llvm::DominatorTreeBase< BasicBlock, false >::updateDFSNumbers().
1.8.6