clang  6.0.0svn
Public Member Functions | Public Attributes | List of all members
clang::DominatorTree Class Reference

Concrete subclass of DominatorTreeBase for Clang This class implements the dominators tree functionality given a Clang CFG. More...

#include "clang/Analysis/Analyses/Dominators.h"

Inheritance diagram for clang::DominatorTree:
Inheritance graph
[legend]
Collaboration diagram for clang::DominatorTree:
Collaboration graph
[legend]

Public Member Functions

 DominatorTree ()
 
 ~DominatorTree () override
 
llvm::DomTreeBase< CFGBlock > & getBase ()
 
CFGBlockgetRoot () const
 This method returns the root CFGBlock of the dominators tree. More...
 
DomTreeNodegetRootNode () const
 This method returns the root DomTreeNode, which is the wrapper for CFGBlock. More...
 
bool compare (DominatorTree &Other) const
 This method compares two dominator trees. More...
 
void buildDominatorTree (AnalysisDeclContext &AC)
 This method builds the dominator tree for a given CFG The CFG information is passed via AnalysisDeclContext. More...
 
void dump ()
 This method dumps immediate dominators for each block, mainly used for debug purposes. More...
 
bool dominates (const CFGBlock *A, const CFGBlock *B) const
 This method tests if one CFGBlock dominates the other. More...
 
bool properlyDominates (const CFGBlock *A, const CFGBlock *B) const
 This method tests if one CFGBlock properly dominates the other. More...
 
CFGBlockfindNearestCommonDominator (CFGBlock *A, CFGBlock *B)
 This method finds the nearest common dominator CFG block for CFG block A and B. More...
 
const CFGBlockfindNearestCommonDominator (const CFGBlock *A, const CFGBlock *B)
 
void changeImmediateDominator (CFGBlock *N, CFGBlock *NewIDom)
 This method is used to update the dominator tree information when a node's immediate dominator changes. More...
 
bool isReachableFromEntry (const CFGBlock *A)
 This method tests if the given CFGBlock can be reachable from root. More...
 
virtual void releaseMemory ()
 This method releases the memory held by the dominator tree. More...
 
virtual void print (raw_ostream &OS, const llvm::Module *M=nullptr) const
 This method converts the dominator tree to human readable form. More...
 
- Public Member Functions inherited from clang::ManagedAnalysis
virtual ~ManagedAnalysis ()
 

Public Attributes

llvm::DomTreeBase< CFGBlock > * DT
 

Additional Inherited Members

- Protected Member Functions inherited from clang::ManagedAnalysis
 ManagedAnalysis ()
 

Detailed Description

Concrete subclass of DominatorTreeBase for Clang This class implements the dominators tree functionality given a Clang CFG.

Definition at line 38 of file Dominators.h.

Constructor & Destructor Documentation

◆ DominatorTree()

clang::DominatorTree::DominatorTree ( )
inline

Definition at line 43 of file Dominators.h.

◆ ~DominatorTree()

clang::DominatorTree::~DominatorTree ( )
inlineoverride

Definition at line 47 of file Dominators.h.

Member Function Documentation

◆ buildDominatorTree()

void clang::DominatorTree::buildDominatorTree ( AnalysisDeclContext AC)
inline

This method builds the dominator tree for a given CFG The CFG information is passed via AnalysisDeclContext.

Definition at line 83 of file Dominators.h.

References clang::AnalysisDeclContext::getCFG().

◆ changeImmediateDominator()

void clang::DominatorTree::changeImmediateDominator ( CFGBlock N,
CFGBlock NewIDom 
)
inline

This method is used to update the dominator tree information when a node's immediate dominator changes.

Definition at line 135 of file Dominators.h.

◆ compare()

bool clang::DominatorTree::compare ( DominatorTree Other) const
inline

This method compares two dominator trees.

The method returns false if the other dominator tree matches this dominator tree, otherwise returns true.

Definition at line 67 of file Dominators.h.

References getBase(), and getRootNode().

◆ dominates()

bool clang::DominatorTree::dominates ( const CFGBlock A,
const CFGBlock B 
) const
inline

This method tests if one CFGBlock dominates the other.

The method return true if A dominates B, false otherwise. Note a block always dominates itself.

Definition at line 109 of file Dominators.h.

◆ dump()

void clang::DominatorTree::dump ( )
inline

This method dumps immediate dominators for each block, mainly used for debug purposes.

Definition at line 91 of file Dominators.h.

◆ findNearestCommonDominator() [1/2]

CFGBlock* clang::DominatorTree::findNearestCommonDominator ( CFGBlock A,
CFGBlock B 
)
inline

This method finds the nearest common dominator CFG block for CFG block A and B.

If there is no such block then return NULL.

Definition at line 123 of file Dominators.h.

◆ findNearestCommonDominator() [2/2]

const CFGBlock* clang::DominatorTree::findNearestCommonDominator ( const CFGBlock A,
const CFGBlock B 
)
inline

Definition at line 127 of file Dominators.h.

◆ getBase()

llvm::DomTreeBase<CFGBlock>& clang::DominatorTree::getBase ( )
inline

Definition at line 49 of file Dominators.h.

Referenced by compare().

◆ getRoot()

CFGBlock* clang::DominatorTree::getRoot ( ) const
inline

This method returns the root CFGBlock of the dominators tree.

Definition at line 53 of file Dominators.h.

◆ getRootNode()

DomTreeNode* clang::DominatorTree::getRootNode ( ) const
inline

This method returns the root DomTreeNode, which is the wrapper for CFGBlock.

Definition at line 59 of file Dominators.h.

Referenced by compare(), and llvm::GraphTraits< ::clang::DominatorTree *>::getEntryNode().

◆ isReachableFromEntry()

bool clang::DominatorTree::isReachableFromEntry ( const CFGBlock A)
inline

This method tests if the given CFGBlock can be reachable from root.

Returns true if reachable, false otherwise.

Definition at line 142 of file Dominators.h.

◆ print()

virtual void clang::DominatorTree::print ( raw_ostream &  OS,
const llvm::Module *  M = nullptr 
) const
inlinevirtual

This method converts the dominator tree to human readable form.

Definition at line 154 of file Dominators.h.

◆ properlyDominates()

bool clang::DominatorTree::properlyDominates ( const CFGBlock A,
const CFGBlock B 
) const
inline

This method tests if one CFGBlock properly dominates the other.

The method return true if A properly dominates B, false otherwise.

Definition at line 116 of file Dominators.h.

◆ releaseMemory()

virtual void clang::DominatorTree::releaseMemory ( )
inlinevirtual

This method releases the memory held by the dominator tree.

Definition at line 148 of file Dominators.h.

Member Data Documentation

◆ DT

llvm::DomTreeBase<CFGBlock>* clang::DominatorTree::DT

Definition at line 41 of file Dominators.h.


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