Search in sources :

Example 76 with ValueNode

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()));
    }
}
Also used : ValueNode(org.graalvm.compiler.nodes.ValueNode) TriState(jdk.vm.ci.meta.TriState)

Example 77 with ValueNode

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);
}
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)

Example 78 with ValueNode

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

Example 79 with ValueNode

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);
    }
}
Also used : ValueNode(org.graalvm.compiler.nodes.ValueNode) Narrow(org.graalvm.compiler.core.common.type.ArithmeticOpTable.IntegerConvertOp.Narrow)

Example 80 with ValueNode

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

Aggregations

ValueNode (org.graalvm.compiler.nodes.ValueNode)482 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)104 GraphBuilderContext (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext)77 InvocationPlugin (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin)76 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)69 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)67 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)66 Registration (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration)60 Receiver (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver)52 Node (org.graalvm.compiler.graph.Node)50 JavaKind (jdk.vm.ci.meta.JavaKind)48 Stamp (org.graalvm.compiler.core.common.type.Stamp)48 LogicNode (org.graalvm.compiler.nodes.LogicNode)48 VirtualObjectNode (org.graalvm.compiler.nodes.virtual.VirtualObjectNode)42 FixedWithNextNode (org.graalvm.compiler.nodes.FixedWithNextNode)38 FixedNode (org.graalvm.compiler.nodes.FixedNode)37 AddressNode (org.graalvm.compiler.nodes.memory.address.AddressNode)37 NodeView (org.graalvm.compiler.nodes.NodeView)36 PhiNode (org.graalvm.compiler.nodes.PhiNode)36 Test (org.junit.Test)36