use of org.graalvm.compiler.nodes.ValueNode in project graal by oracle.
the class IsNullNode method virtualize.
@Override
public void virtualize(VirtualizerTool tool) {
ValueNode alias = tool.getAlias(getValue());
TriState fold = tryFold(alias.stamp(NodeView.DEFAULT));
if (fold != TriState.UNKNOWN) {
tool.replaceWithValue(LogicConstantNode.forBoolean(fold.isTrue(), graph()));
}
}
use of org.graalvm.compiler.nodes.ValueNode in project graal by oracle.
the class LeftShiftNode method create.
public static ValueNode create(ValueNode x, ValueNode y, NodeView view) {
ArithmeticOpTable.ShiftOp<Shl> op = ArithmeticOpTable.forStamp(x.stamp(view)).getShl();
Stamp stamp = op.foldStamp(x.stamp(view), (IntegerStamp) y.stamp(view));
ValueNode value = ShiftNode.canonical(op, stamp, x, y, view);
if (value != null) {
return value;
}
return canonical(null, op, stamp, x, y);
}
use of org.graalvm.compiler.nodes.ValueNode 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);
}
use of org.graalvm.compiler.nodes.ValueNode in project graal by oracle.
the class NarrowNode method create.
public static ValueNode create(ValueNode input, int inputBits, int resultBits, NodeView view) {
IntegerConvertOp<Narrow> signExtend = ArithmeticOpTable.forStamp(input.stamp(view)).getNarrow();
ValueNode synonym = findSynonym(signExtend, input, inputBits, resultBits, signExtend.foldStamp(inputBits, resultBits, input.stamp(view)));
if (synonym != null) {
return synonym;
} else {
return new NarrowNode(input, inputBits, resultBits);
}
}
use of org.graalvm.compiler.nodes.ValueNode in project graal by oracle.
the class NormalizeCompareNode method canonical.
@Override
public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) {
NodeView view = NodeView.from(tool);
ValueNode result = tryConstantFold(x, y, isUnorderedLess, stamp(view).getStackKind(), tool.getConstantReflection());
if (result != null) {
return result;
}
return this;
}
Aggregations