Package com.tonic.analysis.ssa.analysis
Class PostDominatorTree
- java.lang.Object
-
- com.tonic.analysis.ssa.analysis.PostDominatorTree
-
public class PostDominatorTree extends Object
Post-dominator tree for a CFG, computed by dominator analysis on the reverse graph.
-
-
Constructor Summary
Constructors Constructor Description PostDominatorTree(IRMethod method)Creates an empty tree for the given method.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcompute()Computes the post-dominator tree.IRBlockfindMergePoint(IRBlock branchBlock)Finds the merge point for an if-then-else by finding the immediate post-dominator of the branch block.Set<IRBlock>getExitBlocks()Map<IRBlock,IRBlock>getImmediatePostDominator()IRBlockgetImmediatePostDominator(IRBlock block)Gets the immediate post-dominator of the specified block.IRMethodgetMethod()Map<IRBlock,Set<IRBlock>>getPostDominatorTreeChildren()Set<IRBlock>getPostDominatorTreeChildren(IRBlock block)Gets the children of the specified block in the post-dominator tree.Map<IRBlock,Integer>getReversePostorder()Map<IRBlock,Integer>getReversePreorder()booleanpostDominates(IRBlock a, IRBlock b)Checks if block A post-dominates block B.booleanstrictlyPostDominates(IRBlock a, IRBlock b)Checks if block A strictly post-dominates block B.
-
-
-
Constructor Detail
-
PostDominatorTree
public PostDominatorTree(IRMethod method)
Creates an empty tree for the given method.- Parameters:
method- the method to analyze
-
-
Method Detail
-
getMethod
public IRMethod getMethod()
- Returns:
- the method
-
getImmediatePostDominator
public Map<IRBlock,IRBlock> getImmediatePostDominator()
- Returns:
- the immediate post dominator
-
getPostDominatorTreeChildren
public Map<IRBlock,Set<IRBlock>> getPostDominatorTreeChildren()
- Returns:
- the post dominator tree children
-
getReversePostorder
public Map<IRBlock,Integer> getReversePostorder()
- Returns:
- the reverse postorder
-
compute
public void compute()
Computes the post-dominator tree.
-
getImmediatePostDominator
public IRBlock getImmediatePostDominator(IRBlock block)
Gets the immediate post-dominator of the specified block.- Parameters:
block- the block to query- Returns:
- the immediate post-dominator, or null if none exists
-
getPostDominatorTreeChildren
public Set<IRBlock> getPostDominatorTreeChildren(IRBlock block)
Gets the children of the specified block in the post-dominator tree.- Parameters:
block- the block to query- Returns:
- the set of post-dominator tree children
-
postDominates
public boolean postDominates(IRBlock a, IRBlock b)
Checks if block A post-dominates block B. A post-dominates B if every path from B to exit must go through A.- Parameters:
a- the potential post-dominatorb- the block to test- Returns:
- true if a post-dominates b
-
strictlyPostDominates
public boolean strictlyPostDominates(IRBlock a, IRBlock b)
Checks if block A strictly post-dominates block B.- Parameters:
a- the potential post-dominatorb- the block to test- Returns:
- true if a strictly post-dominates b
-
-