clang 10.0.0git

Public Types | Public Member Functions | List of all members
clang::CFGDominatorTreeImpl< IsPostDom > Class Template Reference

Dominator tree builder for Clang's CFG based on llvm::DominatorTreeBase. More...

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

Inheritance diagram for clang::CFGDominatorTreeImpl< IsPostDom >:
[legend]
Collaboration diagram for clang::CFGDominatorTreeImpl< IsPostDom >:
[legend]

## Public Types
using | DominatorTreeBase = llvm::DominatorTreeBase< CFGBlock, IsPostDom >

## Public Member Functions
| CFGDominatorTreeImpl ()=default
| CFGDominatorTreeImpl (CFG *cfg)
| ~CFGDominatorTreeImpl () override=default
DominatorTreeBase & | getBase ()
CFG * | getCFG ()
CFGBlock * | getRoot () const
DomTreeNode * | getRootNode ()
bool | compare (CFGDominatorTreeImpl &Other) const
| Compares two dominator trees. More...
void | buildDominatorTree (CFG *cfg)
| Builds the dominator tree for a given CFG. More...
void | dump ()
| Dumps immediate dominators for each block. More...
bool | dominates (const CFGBlock *A, const CFGBlock *B) const
| Tests whether `A` dominates `B`. More...
bool | properlyDominates (const CFGBlock *A, const CFGBlock *B) const
| Tests whether `A` properly dominates `B`. More...
CFGBlock * | findNearestCommonDominator (CFGBlock *A, CFGBlock *B)
const CFGBlock * | findNearestCommonDominator (const CFGBlock *A, const CFGBlock *B)
void | changeImmediateDominator (CFGBlock *N, CFGBlock *NewIDom)
| Update the dominator tree information when a node's immediate dominator changes. More...
bool | isReachableFromEntry (const CFGBlock *A)
| Tests whether `A` is reachable from the entry block. More...
virtual void | releaseMemory ()
| Releases the memory held by the dominator tree. More...
virtual void | print (raw_ostream &OS, const llvm::Module *M=nullptr) const
| Converts the dominator tree to human readable form. More...
Public Member Functions inherited from clang::ManagedAnalysis
virtual | ~ManagedAnalysis ()

## Additional Inherited Members
Protected Member Functions inherited from clang::ManagedAnalysis
| ManagedAnalysis ()=default

## Detailed Description

### template<bool IsPostDom>
class clang::CFGDominatorTreeImpl< IsPostDom >

Dominator tree builder for Clang's CFG based on llvm::DominatorTreeBase.

Definition at line 42 of file Dominators.h.

## Member Typedef Documentation

## ◆ DominatorTreeBase

template<bool IsPostDom>

using clang::CFGDominatorTreeImpl< IsPostDom >::DominatorTreeBase = llvm::DominatorTreeBase<CFGBlock, IsPostDom>

Definition at line 46 of file Dominators.h.

## Constructor & Destructor Documentation

## ◆ CFGDominatorTreeImpl() [1/2]

template<bool IsPostDom>

clang::CFGDominatorTreeImpl< IsPostDom >::CFGDominatorTreeImpl | ( |  | ) |
| default

## ◆ CFGDominatorTreeImpl() [2/2]

template<bool IsPostDom>

clang::CFGDominatorTreeImpl< IsPostDom >::CFGDominatorTreeImpl | ( | CFG * | cfg | ) |
| inline

Definition at line 50 of file Dominators.h.

## ◆ ~CFGDominatorTreeImpl()

template<bool IsPostDom>

clang::CFGDominatorTreeImpl< IsPostDom >::~CFGDominatorTreeImpl | ( |  | ) |
| override default

## Member Function Documentation

## ◆ buildDominatorTree()

template<bool IsPostDom>

void clang::CFGDominatorTreeImpl< IsPostDom >::buildDominatorTree | ( | CFG * | cfg | ) |
| inline

Builds the dominator tree for a given CFG.

Definition at line 87 of file Dominators.h.

## ◆ changeImmediateDominator()

template<bool IsPostDom>

void clang::CFGDominatorTreeImpl< IsPostDom >::changeImmediateDominator | ( | CFGBlock * | N,
|  | CFGBlock * | NewIDom
| ) |  |
| inline

Update the dominator tree information when a node's immediate dominator changes.

Definition at line 160 of file Dominators.h.

## ◆ compare()

template<bool IsPostDom>

bool clang::CFGDominatorTreeImpl< IsPostDom >::compare | ( | CFGDominatorTreeImpl< IsPostDom > & | Other | ) | const
| inline

Compares two dominator trees.

Returns
  false if the other dominator tree matches this dominator tree, false otherwise.

Definition at line 73 of file Dominators.h.

## ◆ dominates()

template<bool IsPostDom>

bool clang::CFGDominatorTreeImpl< IsPostDom >::dominates | ( | const CFGBlock * | A,
|  | const CFGBlock * | B
| ) |  | const
| inline

Tests whether `A` dominates `B`.

Note a block always dominates itself.

Definition at line 136 of file Dominators.h.

## ◆ dump()

template<bool IsPostDom>

void clang::CFGDominatorTreeImpl< IsPostDom >::dump | ( |  | ) |
| inline

Dumps immediate dominators for each block.

Definition at line 94 of file Dominators.h.

## ◆ findNearestCommonDominator() [1/2]

template<bool IsPostDom>

CFGBlock* clang::CFGDominatorTreeImpl< IsPostDom >::findNearestCommonDominator | ( | CFGBlock * | A,
|  | CFGBlock * | B
| ) |  |
| inline

Returns
  the nearest common dominator CFG block for CFG block `A` and `B`. If there is no such block then return NULL.

Definition at line 149 of file Dominators.h.

## ◆ findNearestCommonDominator() [2/2]

template<bool IsPostDom>

const CFGBlock* clang::CFGDominatorTreeImpl< IsPostDom >::findNearestCommonDominator | ( | const CFGBlock * | A,
|  | const CFGBlock * | B
| ) |  |
| inline

Definition at line 153 of file Dominators.h.

## ◆ getBase()

template<bool IsPostDom>

DominatorTreeBase& clang::CFGDominatorTreeImpl< IsPostDom >::getBase | ( |  | ) |
| inline

Definition at line 56 of file Dominators.h.

Referenced by clang::CFGDominatorTreeImpl< true >::compare().

## ◆ getCFG()

template<bool IsPostDom>

CFG* clang::CFGDominatorTreeImpl< IsPostDom >::getCFG | ( |  | ) |
| inline

Definition at line 58 of file Dominators.h.

Referenced by clang::ControlDependencyCalculator::dump().

## ◆ getRoot()

template<bool IsPostDom>

CFGBlock* clang::CFGDominatorTreeImpl< IsPostDom >::getRoot | ( |  | ) | const
| inline

Returns
  the root CFGBlock of the dominators tree.

Definition at line 61 of file Dominators.h.

## ◆ getRootNode()

template<bool IsPostDom>

DomTreeNode* clang::CFGDominatorTreeImpl< IsPostDom >::getRootNode | ( |  | ) |
| inline

Returns
  the root DomTreeNode, which is the wrapper for CFGBlock.

Definition at line 66 of file Dominators.h.

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

## ◆ isReachableFromEntry()

template<bool IsPostDom>

bool clang::CFGDominatorTreeImpl< IsPostDom >::isReachableFromEntry | ( | const CFGBlock * | A | ) |
| inline

Tests whether `A` is reachable from the entry block.

Definition at line 165 of file Dominators.h.

## ◆ print()

template<bool IsPostDom>

virtual void clang::CFGDominatorTreeImpl< IsPostDom >::print | ( | raw_ostream & | OS,
|  | const llvm::Module * | M = `nullptr`
| ) |  | const
| inline virtual

Converts the dominator tree to human readable form.

Definition at line 175 of file Dominators.h.

## ◆ properlyDominates()

template<bool IsPostDom>

bool clang::CFGDominatorTreeImpl< IsPostDom >::properlyDominates | ( | const CFGBlock * | A,
|  | const CFGBlock * | B
| ) |  | const
| inline

Tests whether `A` properly dominates `B`.

Returns
  false if `A` is the same block as `B`, otherwise whether A dominates B.

Definition at line 143 of file Dominators.h.

## ◆ releaseMemory()

template<bool IsPostDom>

virtual void clang::CFGDominatorTreeImpl< IsPostDom >::releaseMemory | ( |  | ) |
| inline virtual

Releases the memory held by the dominator tree.

Definition at line 170 of file Dominators.h.

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

- include/clang/Analysis/Analyses/Dominators.h