Mercurial > hg > graal-compiler
comparison graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerSubNode.java @ 5540:a891c53a295b
Renaming RiKind => Kind.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 08 Jun 2012 23:47:42 +0200 |
parents | dc71b06d09f8 |
children | b0f511b40eee |
comparison
equal
deleted
inserted
replaced
5539:bc647d8b0080 | 5540:a891c53a295b |
---|---|
28 import com.oracle.graal.nodes.spi.*; | 28 import com.oracle.graal.nodes.spi.*; |
29 | 29 |
30 @NodeInfo(shortName = "-") | 30 @NodeInfo(shortName = "-") |
31 public final class IntegerSubNode extends IntegerArithmeticNode implements Canonicalizable, LIRLowerable { | 31 public final class IntegerSubNode extends IntegerArithmeticNode implements Canonicalizable, LIRLowerable { |
32 | 32 |
33 public IntegerSubNode(RiKind kind, ValueNode x, ValueNode y) { | 33 public IntegerSubNode(Kind kind, ValueNode x, ValueNode y) { |
34 super(kind, x, y); | 34 super(kind, x, y); |
35 } | 35 } |
36 | 36 |
37 @Override | 37 @Override |
38 public ValueNode canonical(CanonicalizerTool tool) { | 38 public ValueNode canonical(CanonicalizerTool tool) { |
39 if (x() == y()) { | 39 if (x() == y()) { |
40 return ConstantNode.forIntegerKind(kind(), 0, graph()); | 40 return ConstantNode.forIntegerKind(kind(), 0, graph()); |
41 } | 41 } |
42 if (x().isConstant() && y().isConstant()) { | 42 if (x().isConstant() && y().isConstant()) { |
43 if (kind() == RiKind.Int) { | 43 if (kind() == Kind.Int) { |
44 return ConstantNode.forInt(x().asConstant().asInt() - y().asConstant().asInt(), graph()); | 44 return ConstantNode.forInt(x().asConstant().asInt() - y().asConstant().asInt(), graph()); |
45 } else { | 45 } else { |
46 assert kind() == RiKind.Long; | 46 assert kind() == Kind.Long; |
47 return ConstantNode.forLong(x().asConstant().asLong() - y().asConstant().asLong(), graph()); | 47 return ConstantNode.forLong(x().asConstant().asLong() - y().asConstant().asLong(), graph()); |
48 } | 48 } |
49 } else if (y().isConstant()) { | 49 } else if (y().isConstant()) { |
50 long c = y().asConstant().asLong(); | 50 long c = y().asConstant().asLong(); |
51 if (c == 0) { | 51 if (c == 0) { |
52 return x(); | 52 return x(); |
53 } | 53 } |
54 if (kind() == RiKind.Int) { | 54 if (kind() == Kind.Int) { |
55 return graph().unique(new IntegerAddNode(kind(), x(), ConstantNode.forInt((int) -c, graph()))); | 55 return graph().unique(new IntegerAddNode(kind(), x(), ConstantNode.forInt((int) -c, graph()))); |
56 } else { | 56 } else { |
57 assert kind() == RiKind.Long; | 57 assert kind() == Kind.Long; |
58 return graph().unique(new IntegerAddNode(kind(), x(), ConstantNode.forLong(-c, graph()))); | 58 return graph().unique(new IntegerAddNode(kind(), x(), ConstantNode.forLong(-c, graph()))); |
59 } | 59 } |
60 } else if (x().isConstant()) { | 60 } else if (x().isConstant()) { |
61 long c = x().asConstant().asLong(); | 61 long c = x().asConstant().asLong(); |
62 if (c == 0) { | 62 if (c == 0) { |