use of org.graalvm.compiler.nodes.NodeView in project graal by oracle.
the class IntegerLessThanNode method canonical.
@Override
public Node canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) {
NodeView view = NodeView.from(tool);
ValueNode value = OP.canonical(tool.getConstantReflection(), tool.getMetaAccess(), tool.getOptions(), tool.smallestCompareWidth(), OP.getCondition(), false, forX, forY, view);
if (value != null) {
return value;
}
return this;
}
use of org.graalvm.compiler.nodes.NodeView in project graal by oracle.
the class IntegerTestNode method canonical.
@Override
public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) {
NodeView view = NodeView.from(tool);
if (forX.isConstant() && forY.isConstant()) {
return LogicConstantNode.forBoolean((forX.asJavaConstant().asLong() & forY.asJavaConstant().asLong()) == 0);
}
if (forX.stamp(view) instanceof IntegerStamp && forY.stamp(view) instanceof IntegerStamp) {
IntegerStamp xStamp = (IntegerStamp) forX.stamp(view);
IntegerStamp yStamp = (IntegerStamp) forY.stamp(view);
if ((xStamp.upMask() & yStamp.upMask()) == 0) {
return LogicConstantNode.tautology();
} else if ((xStamp.downMask() & yStamp.downMask()) != 0) {
return LogicConstantNode.contradiction();
}
}
return this;
}
Aggregations