Mercurial > hg > graal-compiler
changeset 23165:b322b2eec825
Change phi nodes from simplifiable to canonicalizable.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sun, 13 Dec 2015 12:47:57 +0100 |
parents | 721b6e8d10a6 |
children | 16e7baf4fd2d |
files | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java |
diffstat | 1 files changed, 6 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java Sun Dec 13 12:33:10 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java Sun Dec 13 12:47:57 2015 +0100 @@ -27,11 +27,10 @@ import jdk.vm.ci.meta.JavaKind; import com.oracle.graal.compiler.common.type.Stamp; -import com.oracle.graal.graph.Node; import com.oracle.graal.graph.NodeClass; import com.oracle.graal.graph.NodeInputList; -import com.oracle.graal.graph.spi.Simplifiable; -import com.oracle.graal.graph.spi.SimplifierTool; +import com.oracle.graal.graph.spi.Canonicalizable; +import com.oracle.graal.graph.spi.CanonicalizerTool; import com.oracle.graal.nodeinfo.InputType; import com.oracle.graal.nodeinfo.NodeInfo; import com.oracle.graal.nodeinfo.Verbosity; @@ -45,7 +44,7 @@ * {@link LoopEndNode}s. */ @NodeInfo -public abstract class PhiNode extends FloatingNode implements Simplifiable { +public abstract class PhiNode extends FloatingNode implements Canonicalizable { public static final NodeClass<PhiNode> TYPE = NodeClass.create(PhiNode.class); @Input(InputType.Association) protected AbstractMergeNode merge; @@ -199,7 +198,7 @@ } @Override - public void simplify(SimplifierTool tool) { + public ValueNode canonical(CanonicalizerTool tool) { ValueNode singleValue; if (isLoopPhi() && singleBackValue() == this) { @@ -209,20 +208,9 @@ } if (singleValue != MULTIPLE_VALUES) { - for (Node node : usages().snapshot()) { - if (node instanceof ProxyNode && ((ProxyNode) node).proxyPoint() instanceof LoopExitNode && ((LoopExitNode) ((ProxyNode) node).proxyPoint()).loopBegin() == merge) { - tool.addToWorkList(node.usages()); - graph().replaceFloating((FloatingNode) node, singleValue); - } - } - for (Node usage : usages().snapshot()) { - if (usage != this) { - usage.replaceFirstInput(this, singleValue); - } - } - clearInputs(); - safeDelete(); + return singleValue; } + return this; } public ValueNode firstValue() {