LLVM  4.0.0
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
llvm::DominatorTreeBase< N > Class Template Reference

Core dominator tree base class. More...

#include <LoopInfo.h>

Inheritance diagram for llvm::DominatorTreeBase< N >:
[legend]
Collaboration diagram for llvm::DominatorTreeBase< N >:
[legend]

Classes

struct  InfoRec
 

Public Member Functions

 DominatorTreeBase (bool isPostDom)
 
 DominatorTreeBase (DominatorTreeBase &&Arg)
 
DominatorTreeBaseoperator= (DominatorTreeBase &&RHS)
 
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)
 findNearestCommonDominator - Find nearest common dominator basic block for basic block A and B. More...
 
const NodeT * findNearestCommonDominator (const NodeT *A, const NodeT *B)
 
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...
 
- Public Member Functions inherited from llvm::DominatorBase< NodeT >
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...
 

Protected Types

typedef DenseMap< NodeT
*, std::unique_ptr
< DomTreeNodeBase< NodeT > > > 
DomTreeNodeMapType
 

Protected Member Functions

void reset ()
 
template<class N , class GraphT >
void Split (DominatorTreeBaseByGraphTraits< GraphT > &DT, typename GraphT::NodeRef NewBB)
 
DomTreeNodeBase< NodeT > * getNodeForBlock (NodeT *BB)
 
NodeT * getIDom (NodeT *BB) const
 
void addRoot (NodeT *BB)
 
template<>
void addRoot (MachineBasicBlock *MBB)
 
- Protected Member Functions inherited from llvm::DominatorBase< NodeT >
 DominatorBase (bool isPostDom)
 
 DominatorBase (DominatorBase &&Arg)
 
DominatorBaseoperator= (DominatorBase &&RHS)
 

Protected Attributes

DomTreeNodeMapType DomTreeNodes
 
DomTreeNodeBase< NodeT > * RootNode
 
bool DFSInfoValid
 
unsigned int SlowQueries
 
DenseMap< NodeT *, NodeT * > IDoms
 
std::vector< NodeT * > Vertex
 
DenseMap< NodeT *, InfoRecInfo
 
- Protected Attributes inherited from llvm::DominatorBase< NodeT >
std::vector< NodeT * > Roots
 
bool IsPostDominators
 

Friends

template<class GraphT >
GraphT::NodeRef Eval (DominatorTreeBaseByGraphTraits< GraphT > &DT, typename GraphT::NodeRef V, unsigned LastLinked)
 
template<class GraphT >
unsigned DFSPass (DominatorTreeBaseByGraphTraits< GraphT > &DT, typename GraphT::NodeRef V, unsigned N)
 
template<class FuncT , class N >
void Calculate (DominatorTreeBaseByGraphTraits< GraphTraits< N >> &DT, FuncT &F)
 

Detailed Description

template<class N>
class llvm::DominatorTreeBase< N >

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 59 of file LoopInfo.h.

Member Typedef Documentation

template<class N>
typedef DenseMap<NodeT *, std::unique_ptr<DomTreeNodeBase<NodeT> > > llvm::DominatorTreeBase< N >::DomTreeNodeMapType
protected

Definition at line 238 of file GenericDomTree.h.

Constructor & Destructor Documentation

template<class N>
llvm::DominatorTreeBase< N >::DominatorTreeBase ( bool  isPostDom)
inlineexplicit

Definition at line 338 of file GenericDomTree.h.

template<class N>
llvm::DominatorTreeBase< N >::DominatorTreeBase ( DominatorTreeBase< N > &&  Arg)
inline

Definition at line 341 of file GenericDomTree.h.

Member Function Documentation

template<class N>
DomTreeNodeBase<NodeT>* llvm::DominatorTreeBase< N >::addNewBlock ( NodeT *  BB,
NodeT *  DomBB 
)
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.

Parameters
BBNew node in CFG.
DomBBCFG node that is dominator for BB.
Returns
New dominator tree node that represents new CFG node.

Definition at line 583 of file GenericDomTree.h.

Referenced by llvm::MachineDominatorTree::addNewBlock(), llvm::cloneLoopWithPreheader(), llvm::SplitBlock(), llvm::SplitBlockAndInsertIfThen(), and llvm::UnrollLoop().

template<>
void llvm::DominatorTreeBase< MachineBasicBlock >::addRoot ( MachineBasicBlock MBB)
inlineprotected

Definition at line 28 of file MachineDominators.h.

template<class N>
void llvm::DominatorTreeBase< N >::addRoot ( NodeT *  BB)
inlineprotected
template<class N>
void llvm::DominatorTreeBase< N >::changeImmediateDominator ( DomTreeNodeBase< NodeT > *  N,
DomTreeNodeBase< NodeT > *  NewIDom 
)
inline
template<class N>
void llvm::DominatorTreeBase< N >::changeImmediateDominator ( NodeT *  BB,
NodeT *  NewBB 
)
inline

Definition at line 627 of file GenericDomTree.h.

template<class N>
bool llvm::DominatorTreeBase< N >::compare ( const DominatorTreeBase< N > &  Other) const
inline

compare - Return false if the other dominator tree base matches this dominator tree base.

Otherwise return true.

Definition at line 367 of file GenericDomTree.h.

Referenced by llvm::MachineDominatorTree::compare().

template<class N>
bool llvm::DominatorTreeBase< N >::dominates ( const DomTreeNodeBase< NodeT > *  A,
const DomTreeNodeBase< NodeT > *  B 
) const
inline
template<class NodeT >
bool llvm::DominatorTreeBase< NodeT >::dominates ( const NodeT *  A,
const NodeT *  B 
) const

Definition at line 795 of file GenericDomTree.h.

template<class N>
void llvm::DominatorTreeBase< N >::eraseNode ( NodeT *  BB)
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 634 of file GenericDomTree.h.

Referenced by llvm::MachineDominatorTree::eraseNode(), foldBlockIntoPredecessor(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), llvm::LoopDeletionPass::runImpl(), and simplifyOneLoop().

template<class N>
NodeT* llvm::DominatorTreeBase< N >::findNearestCommonDominator ( NodeT *  A,
NodeT *  B 
)
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 504 of file GenericDomTree.h.

Referenced by llvm::MachineDominatorTree::findNearestCommonDominator(), llvm::DominatorTreeBase< BasicBlock >::findNearestCommonDominator(), getInsertPointForUses(), nearest_common_dominator(), and llvm::UnrollLoop().

template<class N>
const NodeT* llvm::DominatorTreeBase< N >::findNearestCommonDominator ( const NodeT *  A,
const NodeT *  B 
)
inline

Definition at line 563 of file GenericDomTree.h.

template<class N>
void llvm::DominatorTreeBase< N >::getDescendants ( NodeT *  R,
SmallVectorImpl< NodeT * > &  Result 
) const
inline

Get all nodes dominated by R, including R itself.

Definition at line 417 of file GenericDomTree.h.

template<class N>
NodeT* llvm::DominatorTreeBase< N >::getIDom ( NodeT *  BB) const
inlineprotected
template<class N>
DomTreeNodeBase<NodeT>* llvm::DominatorTreeBase< N >::getNode ( NodeT *  BB) const
inline
template<class N>
DomTreeNodeBase<NodeT>* llvm::DominatorTreeBase< N >::getNodeForBlock ( NodeT *  BB)
inlineprotected
template<class N>
NodeT* llvm::DominatorTreeBase< N >::getRoot ( ) const
inline
template<class N>
DomTreeNodeBase<NodeT>* llvm::DominatorTreeBase< N >::getRootNode ( )
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 413 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::MachineDominatorTree::getRootNode(), llvm::MemorySSA::OptimizeUses::optimizeUses(), llvm::DominatorTreeBase< BasicBlock >::print(), and llvm::DominatorTreeBase< BasicBlock >::updateDFSNumbers().

template<class N>
const DomTreeNodeBase<NodeT>* llvm::DominatorTreeBase< N >::getRootNode ( ) const
inline

Definition at line 414 of file GenericDomTree.h.

template<class N>
bool llvm::DominatorTreeBase< N >::isReachableFromEntry ( const NodeT *  A) const
inline
template<class N>
bool llvm::DominatorTreeBase< N >::isReachableFromEntry ( const DomTreeNodeBase< NodeT > *  A) const
inline

Definition at line 454 of file GenericDomTree.h.

template<class N>
DominatorTreeBase& llvm::DominatorTreeBase< N >::operator= ( DominatorTreeBase< N > &&  RHS)
inline

Definition at line 351 of file GenericDomTree.h.

template<class N>
DomTreeNodeBase<NodeT>* llvm::DominatorTreeBase< N >::operator[] ( NodeT *  BB) const
inline

See getNode.

Definition at line 404 of file GenericDomTree.h.

template<class N>
void llvm::DominatorTreeBase< N >::print ( raw_ostream o) const
inline

print - Convert to human readable form

Definition at line 665 of file GenericDomTree.h.

Referenced by llvm::PostDominatorTreeWrapperPass::print(), llvm::DominatorTreeWrapperPass::print(), and llvm::DominatorTree::verifyDomTree().

template<class N>
bool llvm::DominatorTreeBase< N >::properlyDominates ( const DomTreeNodeBase< NodeT > *  A,
const DomTreeNodeBase< NodeT > *  B 
) const
inline

properlyDominates - Returns true iff A dominates B and A != B.

Note that this is not a constant time operation!

Definition at line 435 of file GenericDomTree.h.

Referenced by llvm::ForwardDominanceFrontierBase< BlockT >::calculate(), ConstructSSAForLoadSet(), isLoopInvariant(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), llvm::MachineDominatorTree::properlyDominates(), and llvm::replaceDominatedUsesWith().

template<class NodeT >
bool llvm::DominatorTreeBase< NodeT >::properlyDominates ( const NodeT *  A,
const NodeT *  B 
) const

Definition at line 806 of file GenericDomTree.h.

template<class N>
template<class FT >
void llvm::DominatorTreeBase< N >::recalculate ( FT &  F)
inline
template<class N>
void llvm::DominatorTreeBase< N >::releaseMemory ( )
inline
template<class N>
void llvm::DominatorTreeBase< N >::reset ( )
inlineprotected
template<class N>
DomTreeNodeBase<NodeT>* llvm::DominatorTreeBase< N >::setNewRoot ( NodeT *  BB)
inline

Add a new node to the forward dominator tree and make it a new root.

Parameters
BBNew node in CFG.
Returns
New dominator tree node that represents new CFG node.

Definition at line 597 of file GenericDomTree.h.

template<class N>
template<class N , class GraphT >
void llvm::DominatorTreeBase< N >::Split ( DominatorTreeBaseByGraphTraits< GraphT > &  DT,
typename GraphT::NodeRef  NewBB 
)
inlineprotected

Definition at line 275 of file GenericDomTree.h.

template<class N>
void llvm::DominatorTreeBase< N >::splitBlock ( NodeT *  NewBB)
inline

splitBlock - BB is split and now it has one successor.

Update dominator tree to reflect this change.

Definition at line 655 of file GenericDomTree.h.

Referenced by insertUniqueBackedgeBlock(), llvm::MachineDominatorTree::splitBlock(), and UpdateAnalysisInformation().

template<class N>
void llvm::DominatorTreeBase< N >::updateDFSNumbers ( ) const
inline

updateDFSNumbers - Assign In and Out numbers to the nodes while walking dominator tree in dfs order.

Definition at line 718 of file GenericDomTree.h.

Referenced by llvm::DominatorTreeBase< BasicBlock >::dominates().

Friends And Related Function Documentation

template<class N>
template<class FuncT , class N >
void Calculate ( DominatorTreeBaseByGraphTraits< GraphTraits< N >> &  DT,
FuncT &  F 
)
friend
template<class N>
template<class GraphT >
unsigned DFSPass ( DominatorTreeBaseByGraphTraits< GraphT > &  DT,
typename GraphT::NodeRef  V,
unsigned  N 
)
friend

Definition at line 33 of file GenericDomTreeConstruction.h.

template<class N>
template<class GraphT >
GraphT::NodeRef Eval ( DominatorTreeBaseByGraphTraits< GraphT > &  DT,
typename GraphT::NodeRef  V,
unsigned  LastLinked 
)
friend

Definition at line 106 of file GenericDomTreeConstruction.h.

Member Data Documentation

template<class N>
bool llvm::DominatorTreeBase< N >::DFSInfoValid
mutableprotected
template<class N>
DomTreeNodeMapType llvm::DominatorTreeBase< N >::DomTreeNodes
protected
template<class N>
DenseMap<NodeT *, NodeT *> llvm::DominatorTreeBase< N >::IDoms
protected
template<class N>
DenseMap<NodeT *, InfoRec> llvm::DominatorTreeBase< N >::Info
protected

Definition at line 260 of file GenericDomTree.h.

Referenced by llvm::DominatorTreeBase< BasicBlock >::operator=().

template<class N>
DomTreeNodeBase<NodeT>* llvm::DominatorTreeBase< N >::RootNode
protected
template<class N>
unsigned int llvm::DominatorTreeBase< N >::SlowQueries
mutableprotected
template<class N>
std::vector<NodeT *> llvm::DominatorTreeBase< N >::Vertex
protected

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