示例#1
0
 public static boolean tryKillUnused(Node node) {
   if (node.isAlive() && isFloatingNode().apply(node) && node.usages().isEmpty()) {
     killWithUnusedFloatingInputs(node);
     return true;
   }
   return false;
 }
示例#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);
      }
    }
  }
示例#3
0
  public static void propagateKill(Node node) {
    if (node != null && node.isAlive()) {
      List<Node> usagesSnapshot = node.usages().filter(isFloatingNode()).snapshot();

      // null out remaining usages
      node.replaceAtUsages(null);
      node.replaceAtPredecessor(null);
      killWithUnusedFloatingInputs(node);

      for (Node usage : usagesSnapshot) {
        if (!usage.isDeleted()) {
          if (usage instanceof PhiNode) {
            usage.replaceFirstInput(node, null);
          } else {
            propagateKill(usage);
          }
        }
      }
    }
  }
示例#4
0
 public static void killCFG(Node node, SimplifierTool tool) {
   assert node.isAlive();
   if (node instanceof AbstractEndNode) {
     // We reached a control flow end.
     AbstractEndNode end = (AbstractEndNode) node;
     killEnd(end, tool);
   } else {
     // Normal control flow node.
     /*
      * We do not take a successor snapshot because this iterator supports concurrent
      * modifications as long as they do not change the size of the successor list. Not
      * taking a snapshot allows us to see modifications to other branches that may happen
      * while processing one branch.
      */
     for (Node successor : node.successors()) {
       killCFG(successor, tool);
     }
   }
   propagateKill(node);
 }