Beispiel #1
0
 private void visitForward(NodeBitMap visited, Node node) {
   if (node != null && !visited.isMarked(node)) {
     visited.mark(node);
     if (node.predecessor() != null) {
       visitForward(visited, node.predecessor());
     }
     if (node instanceof MergeNode) {
       // make sure that the cfg predecessors of a MergeNode are processed first
       MergeNode merge = (MergeNode) node;
       for (int i = 0; i < merge.forwardEndCount(); i++) {
         visitForward(visited, merge.forwardEndAt(i));
       }
     }
     for (Node input : node.inputs()) {
       visitForward(visited, input);
     }
     if (node instanceof LoopBeginNode) {
       LoopBeginNode loopBegin = (LoopBeginNode) node;
       for (LoopEndNode loopEnd : loopBegin.loopEnds()) {
         visitForward(visited, loopEnd);
       }
     }
     nodes.add(node);
   }
 }
Beispiel #2
0
 private void visitBackward(NodeBitMap visited, Node node) {
   if (node != null && !visited.isMarked(node)) {
     visited.mark(node);
     for (Node successor : node.successors()) {
       visitBackward(visited, successor);
     }
     for (Node usage : node.usages()) {
       visitBackward(visited, usage);
     }
     nodes.add(node);
   }
 }