Mercurial > hg > truffle
comparison graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NegateNode.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 |
comparison
equal
deleted
inserted
replaced
16894:cc7aaa92c27d | 16895:06c15e88d383 |
---|---|
45 /** | 45 /** |
46 * Creates new NegateNode instance. | 46 * Creates new NegateNode instance. |
47 * | 47 * |
48 * @param value the instruction producing the value that is input to this instruction | 48 * @param value the instruction producing the value that is input to this instruction |
49 */ | 49 */ |
50 public NegateNode(ValueNode value) { | 50 public static NegateNode create(ValueNode value) { |
51 return new NegateNodeGen(value); | |
52 } | |
53 | |
54 protected NegateNode(ValueNode value) { | |
51 super(StampTool.negate(value.stamp()), value); | 55 super(StampTool.negate(value.stamp()), value); |
52 } | 56 } |
53 | 57 |
54 public Constant evalConst(Constant... inputs) { | 58 public Constant evalConst(Constant... inputs) { |
55 assert inputs.length == 1; | 59 assert inputs.length == 1; |
76 if (forValue instanceof NegateNode) { | 80 if (forValue instanceof NegateNode) { |
77 return ((NegateNode) forValue).getValue(); | 81 return ((NegateNode) forValue).getValue(); |
78 } | 82 } |
79 if (forValue instanceof IntegerSubNode) { | 83 if (forValue instanceof IntegerSubNode) { |
80 IntegerSubNode sub = (IntegerSubNode) forValue; | 84 IntegerSubNode sub = (IntegerSubNode) forValue; |
81 return new IntegerSubNode(sub.getY(), sub.getX()); | 85 return IntegerSubNode.create(sub.getY(), sub.getX()); |
82 } | 86 } |
83 return this; | 87 return this; |
84 } | 88 } |
85 | 89 |
86 @Override | 90 @Override |