Search in sources :

Example 6 with SubNode

use of org.graalvm.compiler.nodes.calc.SubNode in project graal by oracle.

the class BasicInductionVariable method direction.

@Override
public Direction direction() {
    Stamp stamp = rawStride.stamp(NodeView.DEFAULT);
    if (stamp instanceof IntegerStamp) {
        IntegerStamp integerStamp = (IntegerStamp) stamp;
        Direction dir = null;
        if (integerStamp.isStrictlyPositive()) {
            dir = Direction.Up;
        } else if (integerStamp.isStrictlyNegative()) {
            dir = Direction.Down;
        }
        if (dir != null) {
            if (op instanceof AddNode) {
                return dir;
            } else {
                assert op instanceof SubNode;
                return dir.opposite();
            }
        }
    }
    return null;
}
Also used : Stamp(org.graalvm.compiler.core.common.type.Stamp) IntegerStamp(org.graalvm.compiler.core.common.type.IntegerStamp) SubNode(org.graalvm.compiler.nodes.calc.SubNode) IntegerStamp(org.graalvm.compiler.core.common.type.IntegerStamp) AddNode(org.graalvm.compiler.nodes.calc.AddNode)

Aggregations

SubNode (org.graalvm.compiler.nodes.calc.SubNode)6 ValueNode (org.graalvm.compiler.nodes.ValueNode)3 ArrayList (java.util.ArrayList)2 ResolvedJavaField (jdk.vm.ci.meta.ResolvedJavaField)2 IntegerStamp (org.graalvm.compiler.core.common.type.IntegerStamp)2 Invoke (org.graalvm.compiler.nodes.Invoke)2 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)2 AddNode (org.graalvm.compiler.nodes.calc.AddNode)2 MethodCallTargetNode (org.graalvm.compiler.nodes.java.MethodCallTargetNode)2 Stamp (org.graalvm.compiler.core.common.type.Stamp)1 Node (org.graalvm.compiler.graph.Node)1 NodeIterable (org.graalvm.compiler.graph.iterators.NodeIterable)1 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)1 GuardPhiNode (org.graalvm.compiler.nodes.GuardPhiNode)1 LoopBeginNode (org.graalvm.compiler.nodes.LoopBeginNode)1 NodeView (org.graalvm.compiler.nodes.NodeView)1 PhiNode (org.graalvm.compiler.nodes.PhiNode)1 SafepointNode (org.graalvm.compiler.nodes.SafepointNode)1 ValuePhiNode (org.graalvm.compiler.nodes.ValuePhiNode)1 CompareNode (org.graalvm.compiler.nodes.calc.CompareNode)1