use of org.graalvm.compiler.core.common.type.ArithmeticOpTable.BinaryOp.Mul in project graal by oracle.
the class MulNode method create.
public static ValueNode create(ValueNode x, ValueNode y, NodeView view) {
BinaryOp<Mul> op = ArithmeticOpTable.forStamp(x.stamp(view)).getMul();
Stamp stamp = op.foldStamp(x.stamp(view), y.stamp(view));
ConstantNode tryConstantFold = tryConstantFold(op, x, y, stamp, view);
if (tryConstantFold != null) {
return tryConstantFold;
}
return canonical(null, op, stamp, x, y, view);
}
use of org.graalvm.compiler.core.common.type.ArithmeticOpTable.BinaryOp.Mul in project graal by oracle.
the class MulNode 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 MulNode(forY, forX);
}
BinaryOp<Mul> op = getOp(forX, forY);
NodeView view = NodeView.from(tool);
return canonical(this, op, stamp(view), forX, forY, view);
}
Aggregations