Search in sources :

Example 36 with NodeView

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;
}
Also used : ValueNode(org.graalvm.compiler.nodes.ValueNode) NodeView(org.graalvm.compiler.nodes.NodeView)

Example 37 with NodeView

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;
}
Also used : IntegerStamp(org.graalvm.compiler.core.common.type.IntegerStamp) NodeView(org.graalvm.compiler.nodes.NodeView)

Aggregations

NodeView (org.graalvm.compiler.nodes.NodeView)37 ValueNode (org.graalvm.compiler.nodes.ValueNode)28 IntegerStamp (org.graalvm.compiler.core.common.type.IntegerStamp)6 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)4 Constant (jdk.vm.ci.meta.Constant)3 MetaAccessProvider (jdk.vm.ci.meta.MetaAccessProvider)2 LogicNode (org.graalvm.compiler.nodes.LogicNode)2 AddNode (org.graalvm.compiler.nodes.calc.AddNode)2 MulNode (org.graalvm.compiler.nodes.calc.MulNode)2 ArrayList (java.util.ArrayList)1 Assumptions (jdk.vm.ci.meta.Assumptions)1 JavaConstant (jdk.vm.ci.meta.JavaConstant)1 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)1 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)1 Add (org.graalvm.compiler.core.common.type.ArithmeticOpTable.BinaryOp.Add)1 Mul (org.graalvm.compiler.core.common.type.ArithmeticOpTable.BinaryOp.Mul)1 Sub (org.graalvm.compiler.core.common.type.ArithmeticOpTable.BinaryOp.Sub)1 FloatStamp (org.graalvm.compiler.core.common.type.FloatStamp)1 ObjectStamp (org.graalvm.compiler.core.common.type.ObjectStamp)1 Stamp (org.graalvm.compiler.core.common.type.Stamp)1