harpoon.Analysis
Class DomTree<HCE extends HCodeElement>

java.lang.Object
  extended by harpoon.Analysis.DomTree<HCE>

public class DomTree<HCE extends HCodeElement>
extends Object

DomTree computes the dominator tree of a flowgraph-structured IR. The HCode must have a valid CFGrapher.

Version:
$Id: DomTree.java,v 1.13 2007/04/03 19:59:21 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>

Constructor Summary
DomTree(HCode<HCE> hcode, boolean isPost)
          Creates a new DomTree with the dominator tree for the given HCode; if isPost is true, creates a postdominator tree instead.
DomTree(HCode<HCE> hcode, CFGrapher<HCE> grapher, boolean isPost)
          Creates a new DomTree with the dominator tree for the given HCode; if isPost is true, creates a postdominator tree instead.
 
Method Summary
 HCE[] children(HCE n)
          Return the children of an HCodeElement in the immediate (post)dominator tree.
 HCE idom(HCE n)
          Return the immediate (post)dominator of an HCodeElement.
 HCE[] roots()
          Return the roots of the (post-)dominator tree (forest).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomTree

public DomTree(HCode<HCE> hcode,
               boolean isPost)
Creates a new DomTree with the dominator tree for the given HCode; if isPost is true, creates a postdominator tree instead. Uses the default CFGrapher, which means the elements of the HCode must implement CFGraphable.


DomTree

public DomTree(HCode<HCE> hcode,
               CFGrapher<HCE> grapher,
               boolean isPost)
Creates a new DomTree with the dominator tree for the given HCode; if isPost is true, creates a postdominator tree instead. Uses the specified CFGrapher to construct the control flow graph of the HCode.

Method Detail

roots

public HCE[] roots()
Return the roots of the (post-)dominator tree (forest).


idom

public HCE idom(HCE n)
Return the immediate (post)dominator of an HCodeElement.

Returns:
the immediate (post)dominator of n, or null if n is the root (a leaf) of the flow graph.

children

public HCE[] children(HCE n)
Return the children of an HCodeElement in the immediate (post)dominator tree.

Returns:
an array with all the children of n in the immediate dominator tree, or a zero-length array if n is a tree leaf.