diff graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java @ 16895:06c15e88d383

added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
author Doug Simon <doug.simon@oracle.com>
date Mon, 18 Aug 2014 14:04:21 +0200
parents cbd42807a31f
children 0fe4732e5181
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java	Mon Aug 18 13:49:25 2014 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java	Mon Aug 18 14:04:21 2014 +0200
@@ -47,7 +47,11 @@
      * @param isUnorderedLess true when an unordered floating point comparison is interpreted as
      *            less, false when greater.
      */
-    public NormalizeCompareNode(ValueNode x, ValueNode y, boolean isUnorderedLess) {
+    public static NormalizeCompareNode create(ValueNode x, ValueNode y, boolean isUnorderedLess) {
+        return new NormalizeCompareNodeGen(x, y, isUnorderedLess);
+    }
+
+    protected NormalizeCompareNode(ValueNode x, ValueNode y, boolean isUnorderedLess) {
         super(StampFactory.forKind(Kind.Int), x, y);
         this.isUnorderedLess = isUnorderedLess;
     }
@@ -63,15 +67,15 @@
         LogicNode equalComp;
         LogicNode lessComp;
         if (getX().stamp() instanceof FloatStamp) {
-            equalComp = graph().unique(new FloatEqualsNode(getX(), getY()));
-            lessComp = graph().unique(new FloatLessThanNode(getX(), getY(), isUnorderedLess));
+            equalComp = graph().unique(FloatEqualsNode.create(getX(), getY()));
+            lessComp = graph().unique(FloatLessThanNode.create(getX(), getY(), isUnorderedLess));
         } else {
-            equalComp = graph().unique(new IntegerEqualsNode(getX(), getY()));
-            lessComp = graph().unique(new IntegerLessThanNode(getX(), getY()));
+            equalComp = graph().unique(IntegerEqualsNode.create(getX(), getY()));
+            lessComp = graph().unique(IntegerLessThanNode.create(getX(), getY()));
         }
 
-        ConditionalNode equalValue = graph().unique(new ConditionalNode(equalComp, ConstantNode.forInt(0, graph()), ConstantNode.forInt(1, graph())));
-        ConditionalNode value = graph().unique(new ConditionalNode(lessComp, ConstantNode.forInt(-1, graph()), equalValue));
+        ConditionalNode equalValue = graph().unique(ConditionalNode.create(equalComp, ConstantNode.forInt(0, graph()), ConstantNode.forInt(1, graph())));
+        ConditionalNode value = graph().unique(ConditionalNode.create(lessComp, ConstantNode.forInt(-1, graph()), equalValue));
 
         graph().replaceFloating(this, value);
     }