clang API Documentation
Concrete subclass of DominatorTreeBase for Clang This class implements the dominators tree functionality given a Clang CFG. More...
#include <Dominators.h>
Public Member Functions | |
DominatorTree () | |
~DominatorTree () | |
llvm::DominatorTreeBase < CFGBlock > & | getBase () |
CFGBlock * | getRoot () const |
This method returns the root CFGBlock of the dominators tree. | |
DomTreeNode * | getRootNode () const |
This method returns the root DomTreeNode, which is the wrapper for CFGBlock. | |
bool | compare (DominatorTree &Other) const |
This method compares two dominator trees. The method returns false if the other dominator tree matches this dominator tree, otherwise returns true. | |
void | buildDominatorTree (AnalysisDeclContext &AC) |
This method builds the dominator tree for a given CFG The CFG information is passed via AnalysisDeclContext. | |
void | dump () |
This method dumps immediate dominators for each block, mainly used for debug purposes. | |
bool | dominates (const CFGBlock *A, const CFGBlock *B) const |
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. | |
bool | properlyDominates (const CFGBlock *A, const CFGBlock *B) const |
This method tests if one CFGBlock properly dominates the other. The method return true if A properly dominates B, false otherwise. | |
CFGBlock * | findNearestCommonDominator (CFGBlock *A, CFGBlock *B) |
This method finds the nearest common dominator CFG block for CFG block A and B. If there is no such block then return NULL. | |
const CFGBlock * | findNearestCommonDominator (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. | |
bool | isReachableFromEntry (const CFGBlock *A) |
This method tests if the given CFGBlock can be reachable from root. Returns true if reachable, false otherwise. | |
virtual void | releaseMemory () |
This method releases the memory held by the dominator tree. | |
virtual void | print (raw_ostream &OS, const llvm::Module *M=nullptr) const |
This method converts the dominator tree to human readable form. | |
Public Attributes | |
llvm::DominatorTreeBase < CFGBlock > * | DT |
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.
clang::DominatorTree::DominatorTree | ( | ) | [inline] |
Definition at line 43 of file Dominators.h.
References DT.
clang::DominatorTree::~DominatorTree | ( | ) | [inline] |
Definition at line 47 of file Dominators.h.
References DT.
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 85 of file Dominators.h.
References DT, and clang::AnalysisDeclContext::getCFG().
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 137 of file Dominators.h.
References DT.
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 69 of file Dominators.h.
References DT, getBase(), and getRootNode().
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 111 of file Dominators.h.
References DT.
void clang::DominatorTree::dump | ( | ) | [inline] |
This method dumps immediate dominators for each block, mainly used for debug purposes.
Definition at line 93 of file Dominators.h.
References clang::CFG::begin(), DT, and clang::CFG::end().
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 125 of file Dominators.h.
References DT.
const CFGBlock* clang::DominatorTree::findNearestCommonDominator | ( | const CFGBlock * | A, |
const CFGBlock * | B | ||
) | [inline] |
Definition at line 129 of file Dominators.h.
References DT.
llvm::DominatorTreeBase<CFGBlock>& clang::DominatorTree::getBase | ( | ) | [inline] |
CFGBlock* clang::DominatorTree::getRoot | ( | ) | const [inline] |
This method returns the root CFGBlock of the dominators tree.
Definition at line 55 of file Dominators.h.
References DT.
DomTreeNode* clang::DominatorTree::getRootNode | ( | ) | const [inline] |
This method returns the root DomTreeNode, which is the wrapper for CFGBlock.
Definition at line 61 of file Dominators.h.
References DT.
Referenced by compare(), and llvm::GraphTraits< ::clang::DominatorTree * >::getEntryNode().
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 144 of file Dominators.h.
References DT.
virtual void clang::DominatorTree::print | ( | raw_ostream & | OS, |
const llvm::Module * | M = nullptr |
||
) | const [inline, virtual] |
This method converts the dominator tree to human readable form.
Definition at line 156 of file Dominators.h.
References DT.
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 118 of file Dominators.h.
References DT.
virtual void clang::DominatorTree::releaseMemory | ( | ) | [inline, virtual] |
This method releases the memory held by the dominator tree.
Definition at line 150 of file Dominators.h.
References DT.
llvm::DominatorTreeBase<CFGBlock>* clang::DominatorTree::DT |
Definition at line 41 of file Dominators.h.
Referenced by buildDominatorTree(), changeImmediateDominator(), compare(), dominates(), DominatorTree(), dump(), findNearestCommonDominator(), getBase(), getRoot(), getRootNode(), isReachableFromEntry(), print(), properlyDominates(), releaseMemory(), and ~DominatorTree().