Search in sources :

Example 6 with IntegerStamp

use of org.graalvm.compiler.core.common.type.IntegerStamp in project graal by oracle.

the class IntegerAddExactSplitNode method simplify.

@Override
public void simplify(SimplifierTool tool) {
    NodeView view = NodeView.from(tool);
    if (!IntegerStamp.addCanOverflow((IntegerStamp) x.stamp(view), (IntegerStamp) y.stamp(view))) {
        tool.deleteBranch(overflowSuccessor);
        tool.addToWorkList(next);
        AddNode replacement = graph().unique(new AddNode(x, y));
        graph().replaceSplitWithFloating(this, replacement, next);
        tool.addToWorkList(replacement);
    }
}
Also used : IntegerStamp(org.graalvm.compiler.core.common.type.IntegerStamp) NodeView(org.graalvm.compiler.nodes.NodeView) AddNode(org.graalvm.compiler.nodes.calc.AddNode)

Example 7 with IntegerStamp

use of org.graalvm.compiler.core.common.type.IntegerStamp in project graal by oracle.

the class IntegerMulExactSplitNode method simplify.

@Override
public void simplify(SimplifierTool tool) {
    NodeView view = NodeView.from(tool);
    if (!IntegerStamp.multiplicationCanOverflow((IntegerStamp) x.stamp(view), (IntegerStamp) y.stamp(view))) {
        tool.deleteBranch(overflowSuccessor);
        tool.addToWorkList(next);
        MulNode replacement = graph().unique(new MulNode(x, y));
        graph().replaceSplitWithFloating(this, replacement, next);
        tool.addToWorkList(replacement);
    }
}
Also used : IntegerStamp(org.graalvm.compiler.core.common.type.IntegerStamp) MulNode(org.graalvm.compiler.nodes.calc.MulNode) NodeView(org.graalvm.compiler.nodes.NodeView)

Example 8 with IntegerStamp

use of org.graalvm.compiler.core.common.type.IntegerStamp in project graal by oracle.

the class IntegerSubExactSplitNode method simplify.

@Override
public void simplify(SimplifierTool tool) {
    NodeView view = NodeView.from(tool);
    if (!IntegerStamp.subtractionCanOverflow((IntegerStamp) x.stamp(view), (IntegerStamp) y.stamp(view))) {
        tool.deleteBranch(overflowSuccessor);
        tool.addToWorkList(next);
        SubNode replacement = graph().unique(new SubNode(x, y));
        graph().replaceSplitWithFloating(this, replacement, next);
        tool.addToWorkList(replacement);
    }
}
Also used : SubNode(org.graalvm.compiler.nodes.calc.SubNode) IntegerStamp(org.graalvm.compiler.core.common.type.IntegerStamp) NodeView(org.graalvm.compiler.nodes.NodeView)

Example 9 with IntegerStamp

use of org.graalvm.compiler.core.common.type.IntegerStamp in project graal by oracle.

the class IntegerTestNode method tryFold.

@Override
public TriState tryFold(Stamp xStampGeneric, Stamp yStampGeneric) {
    if (xStampGeneric instanceof IntegerStamp && yStampGeneric instanceof IntegerStamp) {
        IntegerStamp xStamp = (IntegerStamp) xStampGeneric;
        IntegerStamp yStamp = (IntegerStamp) yStampGeneric;
        if ((xStamp.upMask() & yStamp.upMask()) == 0) {
            return TriState.TRUE;
        } else if ((xStamp.downMask() & yStamp.downMask()) != 0) {
            return TriState.FALSE;
        }
    }
    return TriState.UNKNOWN;
}
Also used : IntegerStamp(org.graalvm.compiler.core.common.type.IntegerStamp)

Example 10 with IntegerStamp

use of org.graalvm.compiler.core.common.type.IntegerStamp 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);
}
Also used : ArithmeticOpTable(org.graalvm.compiler.core.common.type.ArithmeticOpTable) Stamp(org.graalvm.compiler.core.common.type.Stamp) IntegerStamp(org.graalvm.compiler.core.common.type.IntegerStamp) Shl(org.graalvm.compiler.core.common.type.ArithmeticOpTable.ShiftOp.Shl) ValueNode(org.graalvm.compiler.nodes.ValueNode)

Aggregations

IntegerStamp (org.graalvm.compiler.core.common.type.IntegerStamp)65 Test (org.junit.Test)21 ValueNode (org.graalvm.compiler.nodes.ValueNode)19 Stamp (org.graalvm.compiler.core.common.type.Stamp)13 NodeView (org.graalvm.compiler.nodes.NodeView)8 AddNode (org.graalvm.compiler.nodes.calc.AddNode)6 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)5 JavaConstant (jdk.vm.ci.meta.JavaConstant)4 Node (org.graalvm.compiler.graph.Node)4 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)4 SignExtendNode (org.graalvm.compiler.nodes.calc.SignExtendNode)4 ArrayList (java.util.ArrayList)3 Constant (jdk.vm.ci.meta.Constant)3 PrimitiveConstant (jdk.vm.ci.meta.PrimitiveConstant)3 ArithmeticOpTable (org.graalvm.compiler.core.common.type.ArithmeticOpTable)3 GraphTest (org.graalvm.compiler.graph.test.GraphTest)3 FixedGuardNode (org.graalvm.compiler.nodes.FixedGuardNode)3 LoopBeginNode (org.graalvm.compiler.nodes.LoopBeginNode)3 ParameterNode (org.graalvm.compiler.nodes.ParameterNode)3 IntegerBelowNode (org.graalvm.compiler.nodes.calc.IntegerBelowNode)3