use of org.graalvm.compiler.core.common.type.ArithmeticOpTable.BinaryOp.Add in project graal by oracle.
the class AddNode method canonical.
@Override
public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) {
ValueNode ret = super.canonical(tool, forX, forY);
if (ret != this) {
return ret;
}
if (forX.isConstant() && !forY.isConstant()) {
// we try to swap and canonicalize
ValueNode improvement = canonical(tool, forY, forX);
if (improvement != this) {
return improvement;
}
// if this fails we only swap
return new AddNode(forY, forX);
}
BinaryOp<Add> op = getOp(forX, forY);
NodeView view = NodeView.from(tool);
return canonical(this, op, forX, forY, view);
}
use of org.graalvm.compiler.core.common.type.ArithmeticOpTable.BinaryOp.Add in project graal by oracle.
the class AddNode method create.
public static ValueNode create(ValueNode x, ValueNode y, NodeView view) {
BinaryOp<Add> op = ArithmeticOpTable.forStamp(x.stamp(view)).getAdd();
Stamp stamp = op.foldStamp(x.stamp(view), y.stamp(view));
ConstantNode tryConstantFold = tryConstantFold(op, x, y, stamp, view);
if (tryConstantFold != null) {
return tryConstantFold;
}
if (x.isConstant() && !y.isConstant()) {
return canonical(null, op, y, x, view);
} else {
return canonical(null, op, x, y, view);
}
}
Aggregations