src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/XorNode.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
48 public final class XorNode extends BinaryArithmeticNode<Xor> implements BinaryCommutative<ValueNode>, NarrowableArithmeticNode { |
48 public final class XorNode extends BinaryArithmeticNode<Xor> implements BinaryCommutative<ValueNode>, NarrowableArithmeticNode { |
49 |
49 |
50 public static final NodeClass<XorNode> TYPE = NodeClass.create(XorNode.class); |
50 public static final NodeClass<XorNode> TYPE = NodeClass.create(XorNode.class); |
51 |
51 |
52 public XorNode(ValueNode x, ValueNode y) { |
52 public XorNode(ValueNode x, ValueNode y) { |
53 super(TYPE, ArithmeticOpTable::getXor, x, y); |
53 super(TYPE, getArithmeticOpTable(x).getXor(), x, y); |
54 assert x.stamp(NodeView.DEFAULT).isCompatible(y.stamp(NodeView.DEFAULT)); |
54 assert x.stamp(NodeView.DEFAULT).isCompatible(y.stamp(NodeView.DEFAULT)); |
55 } |
55 } |
56 |
56 |
57 public static ValueNode create(ValueNode x, ValueNode y, NodeView view) { |
57 public static ValueNode create(ValueNode x, ValueNode y, NodeView view) { |
58 BinaryOp<Xor> op = ArithmeticOpTable.forStamp(x.stamp(view)).getXor(); |
58 BinaryOp<Xor> op = ArithmeticOpTable.forStamp(x.stamp(view)).getXor(); |
60 ConstantNode tryConstantFold = tryConstantFold(op, x, y, stamp, view); |
60 ConstantNode tryConstantFold = tryConstantFold(op, x, y, stamp, view); |
61 if (tryConstantFold != null) { |
61 if (tryConstantFold != null) { |
62 return tryConstantFold; |
62 return tryConstantFold; |
63 } |
63 } |
64 return canonical(null, op, stamp, x, y, view); |
64 return canonical(null, op, stamp, x, y, view); |
|
65 } |
|
66 |
|
67 @Override |
|
68 protected BinaryOp<Xor> getOp(ArithmeticOpTable table) { |
|
69 return table.getXor(); |
65 } |
70 } |
66 |
71 |
67 @Override |
72 @Override |
68 public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { |
73 public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { |
69 ValueNode ret = super.canonical(tool, forX, forY); |
74 ValueNode ret = super.canonical(tool, forX, forY); |