コード例 #1
0
 /**
  * The {@link com.oracle.graal.nodes.AbstractEndNode} at the end of the current code path
  * contributes values to {@link com.oracle.graal.nodes.PhiNode}s. Now is a good time to {@link
  * EquationalReasoner#deverbosify(com.oracle.graal.graph.Node) EquationalReasoner#deverbosify}
  * those values.
  *
  * <p>Precondition: inputs haven't been deverbosified yet.
  */
 private void visitAbstractEndNode(AbstractEndNode endNode) {
   MergeNode merge = endNode.merge();
   for (PhiNode phi : merge.phis()) {
     if (phi instanceof ValuePhiNode && phi.getKind() == Kind.Object) {
       assert phi.verify();
       int index = merge.phiPredecessorIndex(endNode);
       ValueNode original = phi.valueAt(index);
       ValueNode reduced = (ValueNode) reasoner.deverbosify(original);
       if (reduced != original) {
         phi.setValueAt(index, reduced);
         // `original` if unused will be removed in finished()
       }
     }
   }
 }
コード例 #2
0
ファイル: GraphUtil.java プロジェクト: rjsingh/graal
  public static void checkRedundantPhi(PhiNode phiNode) {
    if (phiNode.isDeleted() || phiNode.valueCount() == 1) {
      return;
    }

    ValueNode singleValue = phiNode.singleValue();
    if (singleValue != null) {
      Collection<PhiNode> phiUsages = phiNode.usages().filter(PhiNode.class).snapshot();
      Collection<ProxyNode> proxyUsages = phiNode.usages().filter(ProxyNode.class).snapshot();
      phiNode.graph().replaceFloating(phiNode, singleValue);
      for (PhiNode phi : phiUsages) {
        checkRedundantPhi(phi);
      }
      for (ProxyNode proxy : proxyUsages) {
        checkRedundantProxy(proxy);
      }
    }
  }