Example #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);
   }
 }
Example #2
0
  public static void killWithUnusedFloatingInputs(Node node) {
    List<Node> floatingInputs = node.inputs().filter(isFloatingNode()).snapshot();
    node.safeDelete();

    for (Node in : floatingInputs) {
      if (in.isAlive() && in.usages().isEmpty()) {
        killWithUnusedFloatingInputs(in);
      }
    }
  }