comparison graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java @ 13911:3e0cc5cc5dc0

Simplify IntegerArithmeticNode.add/mul/sub
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 07 Feb 2014 17:31:48 +0100
parents 4aec62c32a82
children 34c07ef28bc9
comparison
equal deleted inserted replaced
13910:d25c52a893d9 13911:3e0cc5cc5dc0
33 assert kind.isNumericInteger(); 33 assert kind.isNumericInteger();
34 } 34 }
35 35
36 public static IntegerAddNode add(StructuredGraph graph, ValueNode v1, ValueNode v2) { 36 public static IntegerAddNode add(StructuredGraph graph, ValueNode v1, ValueNode v2) {
37 assert v1.kind() == v2.kind(); 37 assert v1.kind() == v2.kind();
38 switch (v1.kind()) { 38 return graph.unique(new IntegerAddNode(v1.kind(), v1, v2));
39 case Int:
40 return graph.unique(new IntegerAddNode(Kind.Int, v1, v2));
41 case Long:
42 return graph.unique(new IntegerAddNode(Kind.Long, v1, v2));
43 default:
44 throw ValueNodeUtil.shouldNotReachHere();
45 }
46 } 39 }
47 40
48 public static IntegerMulNode mul(StructuredGraph graph, ValueNode v1, ValueNode v2) { 41 public static IntegerMulNode mul(StructuredGraph graph, ValueNode v1, ValueNode v2) {
49 assert v1.kind() == v2.kind(); 42 assert v1.kind() == v2.kind();
50 switch (v1.kind()) { 43 return graph.unique(new IntegerMulNode(v1.kind(), v1, v2));
51 case Int:
52 return graph.unique(new IntegerMulNode(Kind.Int, v1, v2));
53 case Long:
54 return graph.unique(new IntegerMulNode(Kind.Long, v1, v2));
55 default:
56 throw ValueNodeUtil.shouldNotReachHere();
57 }
58 } 44 }
59 45
60 public static IntegerSubNode sub(StructuredGraph graph, ValueNode v1, ValueNode v2) { 46 public static IntegerSubNode sub(StructuredGraph graph, ValueNode v1, ValueNode v2) {
61 assert v1.kind() == v2.kind(); 47 assert v1.kind() == v2.kind();
62 switch (v1.kind()) { 48 return graph.unique(new IntegerSubNode(v1.kind(), v1, v2));
63 case Int:
64 return graph.unique(new IntegerSubNode(Kind.Int, v1, v2));
65 case Long:
66 return graph.unique(new IntegerSubNode(Kind.Long, v1, v2));
67 default:
68 throw ValueNodeUtil.shouldNotReachHere();
69 }
70 } 49 }
71 } 50 }