22 */ |
22 */ |
23 |
23 |
24 |
24 |
25 package org.graalvm.compiler.nodes.calc; |
25 package org.graalvm.compiler.nodes.calc; |
26 |
26 |
27 import jdk.vm.ci.code.CodeUtil; |
27 import static org.graalvm.compiler.nodes.calc.BinaryArithmeticNode.getArithmeticOpTable; |
|
28 |
28 import org.graalvm.compiler.core.common.type.ArithmeticOpTable; |
29 import org.graalvm.compiler.core.common.type.ArithmeticOpTable; |
|
30 import org.graalvm.compiler.core.common.type.ArithmeticOpTable.ShiftOp; |
29 import org.graalvm.compiler.core.common.type.ArithmeticOpTable.ShiftOp.UShr; |
31 import org.graalvm.compiler.core.common.type.ArithmeticOpTable.ShiftOp.UShr; |
30 import org.graalvm.compiler.core.common.type.IntegerStamp; |
32 import org.graalvm.compiler.core.common.type.IntegerStamp; |
31 import org.graalvm.compiler.core.common.type.Stamp; |
33 import org.graalvm.compiler.core.common.type.Stamp; |
32 import org.graalvm.compiler.graph.NodeClass; |
34 import org.graalvm.compiler.graph.NodeClass; |
33 import org.graalvm.compiler.graph.spi.CanonicalizerTool; |
35 import org.graalvm.compiler.graph.spi.CanonicalizerTool; |
36 import org.graalvm.compiler.nodes.ConstantNode; |
38 import org.graalvm.compiler.nodes.ConstantNode; |
37 import org.graalvm.compiler.nodes.NodeView; |
39 import org.graalvm.compiler.nodes.NodeView; |
38 import org.graalvm.compiler.nodes.ValueNode; |
40 import org.graalvm.compiler.nodes.ValueNode; |
39 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool; |
41 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool; |
40 |
42 |
|
43 import jdk.vm.ci.code.CodeUtil; |
41 import jdk.vm.ci.meta.JavaKind; |
44 import jdk.vm.ci.meta.JavaKind; |
42 |
45 |
43 @NodeInfo(shortName = ">>>") |
46 @NodeInfo(shortName = ">>>") |
44 public final class UnsignedRightShiftNode extends ShiftNode<UShr> { |
47 public final class UnsignedRightShiftNode extends ShiftNode<UShr> { |
45 |
48 |
46 public static final NodeClass<UnsignedRightShiftNode> TYPE = NodeClass.create(UnsignedRightShiftNode.class); |
49 public static final NodeClass<UnsignedRightShiftNode> TYPE = NodeClass.create(UnsignedRightShiftNode.class); |
47 |
50 |
48 public UnsignedRightShiftNode(ValueNode x, ValueNode y) { |
51 public UnsignedRightShiftNode(ValueNode x, ValueNode y) { |
49 super(TYPE, ArithmeticOpTable::getUShr, x, y); |
52 super(TYPE, getArithmeticOpTable(x).getUShr(), x, y); |
50 } |
53 } |
51 |
54 |
52 public static ValueNode create(ValueNode x, ValueNode y, NodeView view) { |
55 public static ValueNode create(ValueNode x, ValueNode y, NodeView view) { |
53 ArithmeticOpTable.ShiftOp<UShr> op = ArithmeticOpTable.forStamp(x.stamp(view)).getUShr(); |
56 ArithmeticOpTable.ShiftOp<UShr> op = ArithmeticOpTable.forStamp(x.stamp(view)).getUShr(); |
54 Stamp stamp = op.foldStamp(x.stamp(view), (IntegerStamp) y.stamp(view)); |
57 Stamp stamp = op.foldStamp(x.stamp(view), (IntegerStamp) y.stamp(view)); |
56 if (value != null) { |
59 if (value != null) { |
57 return value; |
60 return value; |
58 } |
61 } |
59 |
62 |
60 return canonical(null, op, stamp, x, y, view); |
63 return canonical(null, op, stamp, x, y, view); |
|
64 } |
|
65 |
|
66 @Override |
|
67 protected ShiftOp<UShr> getOp(ArithmeticOpTable table) { |
|
68 return table.getUShr(); |
61 } |
69 } |
62 |
70 |
63 @Override |
71 @Override |
64 public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { |
72 public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { |
65 NodeView view = NodeView.from(tool); |
73 NodeView view = NodeView.from(tool); |