package org.graalvm.compiler.nodes;
import static org.graalvm.compiler.nodeinfo.InputType.Association;
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_0;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_0;
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.graph.IterableNodeType;
import org.graalvm.compiler.graph.Node.ValueNumberable;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.nodeinfo.NodeInfo;
import org.graalvm.compiler.nodes.calc.FloatingNode;
import org.graalvm.compiler.nodes.extended.GuardingNode;
@NodeInfo(cycles = CYCLES_0, size = SIZE_0)
public abstract class ProxyNode extends FloatingNode implements IterableNodeType, ValueNumberable {
public static final NodeClass<ProxyNode> TYPE = NodeClass.create(ProxyNode.class);
@Input(Association) LoopExitNode loopExit;
protected ProxyNode(NodeClass<? extends ProxyNode> c, Stamp stamp, LoopExitNode proxyPoint) {
super(c, stamp);
assert proxyPoint != null;
this.loopExit = proxyPoint;
}
public abstract ValueNode value();
public LoopExitNode proxyPoint() {
return loopExit;
}
@Override
public boolean verify() {
assert !(value() instanceof ProxyNode) || ((ProxyNode) value()).loopExit != loopExit;
return super.verify();
}
public static ValueProxyNode forValue(ValueNode value, LoopExitNode exit, StructuredGraph graph) {
return graph.unique(new ValueProxyNode(value, exit));
}
public static GuardProxyNode forGuard(GuardingNode value, LoopExitNode exit, StructuredGraph graph) {
return graph.unique(new GuardProxyNode(value, exit));
}
}