コード例 #1
0
 /**
  * This method returns true if the passed node dominates this node
  *
  * @param master the proposed dominating node
  * @return whether the passed node dominates me
  */
 boolean _isDominatedBy(DominatorTreeNode master) {
   DominatorTreeNode node = this;
   while ((node != null) && (node != master)) {
     node = (DominatorTreeNode) node.getParent();
   }
   return node == master;
 }
コード例 #2
0
 private void initializeRanges() {
   DominatorTreeNode node = this;
   DominatorTreeNode parent = (DominatorTreeNode) getParent();
   while (parent != null) {
     node = parent;
     parent = (DominatorTreeNode) node.getParent();
   }
   node.initializeRanges(0);
 }
コード例 #3
0
 private int initializeRanges(int i) {
   low = ++i;
   Enumeration<TreeNode> childEnum = getChildren();
   while (childEnum.hasMoreElements()) {
     DominatorTreeNode child = (DominatorTreeNode) childEnum.nextElement();
     i = child.initializeRanges(i);
   }
   high = ++i;
   return i;
 }
コード例 #4
0
 /**
  * Return the distance of this node from the root of the dominator tree.
  *
  * @return the distance of this node from the root of the dominator tree.
  */
 int getDepth() {
   if (depth == -1) {
     DominatorTreeNode dad = (DominatorTreeNode) getParent();
     if (dad == null) {
       depth = 0;
     } else {
       depth = dad.getDepth() + 1;
     }
   }
   return depth;
 }
コード例 #5
0
 /**
  * This method returns the set of blocks that dominates the passed block, i.e., it answers the
  * question "Who dominates me?"
  *
  * @param ir the governing IR
  * @return a BitVector containing those blocks that dominate me
  */
 BitVector dominators(IR ir) {
   // Currently, this set is computed on demand,
   // but we cache it for the next time.
   if (dominators == null) {
     dominators = new BitVector(ir.getMaxBasicBlockNumber() + 1);
     dominators.set(block.getNumber());
     DominatorTreeNode node = this;
     while ((node = (DominatorTreeNode) getParent()) != null) {
       dominators.set(node.getBlock().getNumber());
     }
   }
   return dominators;
 }