LLVM  3.7.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
 
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)
 addNewBlock - Add a new node to the dominator tree information. 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 (DominatorTreeBase< typename GraphT::NodeType > &DT, typename GraphT::NodeType *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::NodeType * Eval (DominatorTreeBase< typename GraphT::NodeType > &DT, typename GraphT::NodeType *V, unsigned LastLinked)
 
template<class GraphT >
unsigned DFSPass (DominatorTreeBase< typename GraphT::NodeType > &DT, typename GraphT::NodeType *V, unsigned N)
 
template<class FuncT , class N >
void Calculate (DominatorTreeBase< typename GraphTraits< N >::NodeType > &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 56 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 216 of file GenericDomTree.h.

Constructor & Destructor Documentation

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

Definition at line 316 of file GenericDomTree.h.

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

Definition at line 319 of file GenericDomTree.h.

Member Function Documentation

template<class N>
DomTreeNodeBase<NodeT>* llvm::DominatorTreeBase< N >::addNewBlock ( NodeT *  BB,
NodeT *  DomBB 
)
inline

addNewBlock - 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.

Definition at line 556 of file GenericDomTree.h.

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

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 575 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 345 of file GenericDomTree.h.

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 752 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 582 of file GenericDomTree.h.

Referenced by llvm::MachineDominatorTree::eraseNode(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), 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 483 of file GenericDomTree.h.

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

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

Definition at line 542 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 396 of file GenericDomTree.h.

Referenced by llvm::PostDominatorTree::getDescendants().

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

Definition at line 476 of file GenericDomTree.h.

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

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 392 of file GenericDomTree.h.

Referenced by llvm::LoopInfoBase< N, M >::Analyze(), llvm::IDFCalculator::calculate(), llvm::DominatorTree::compare(), llvm::GraphTraits< DominatorTree * >::getEntryNode(), llvm::DOTGraphTraits< DominatorTree * >::getNodeLabel(), llvm::PostDominatorTree::getRootNode(), llvm::MachineDominatorTree::getRootNode(), llvm::DominatorTreeBase< BasicBlock >::print(), and llvm::DominatorTreeBase< BasicBlock >::updateDFSNumbers().

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

Definition at line 393 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 433 of file GenericDomTree.h.

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

Definition at line 329 of file GenericDomTree.h.

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

Definition at line 383 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 613 of file GenericDomTree.h.

Referenced by llvm::PostDominatorTree::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 414 of file GenericDomTree.h.

Referenced by llvm::ForwardDominanceFrontierBase< BlockT >::calculate(), isLoopInvariant(), llvm::PostDominatorTree::properlyDominates(), and llvm::MachineDominatorTree::properlyDominates().

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

Definition at line 763 of file GenericDomTree.h.

template<class N>
template<class FT >
void llvm::DominatorTreeBase< N >::recalculate ( FT &  F)
inline

recalculate - compute a dominator tree for the given function

Definition at line 717 of file GenericDomTree.h.

Referenced by AddAliasScopeMetadata(), AddAlignmentAssumptions(), llvm::DominatorTreeAnalysis::run(), llvm::UnrollLoop(), and llvm::DominatorTree::verifyDomTree().

template<class N>
void llvm::DominatorTreeBase< N >::releaseMemory ( )
inline
template<class N>
void llvm::DominatorTreeBase< N >::reset ( )
inlineprotected
template<class N>
template<class N , class GraphT >
void llvm::DominatorTreeBase< N >::Split ( DominatorTreeBase< typename GraphT::NodeType > &  DT,
typename GraphT::NodeType *  NewBB 
)
inlineprotected

Definition at line 253 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 603 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 667 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 ( DominatorTreeBase< typename GraphTraits< N >::NodeType > &  DT,
FuncT &  F 
)
friend
template<class N>
template<class GraphT >
unsigned DFSPass ( DominatorTreeBase< typename GraphT::NodeType > &  DT,
typename GraphT::NodeType *  V,
unsigned  N 
)
friend

Definition at line 34 of file GenericDomTreeConstruction.h.

template<class N>
template<class GraphT >
GraphT::NodeType* Eval ( DominatorTreeBase< typename GraphT::NodeType > &  DT,
typename GraphT::NodeType *  V,
unsigned  LastLinked 
)
friend

Definition at line 108 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
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: