Search in sources :

Example 91 with ValueNode

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

the class IntegerConvertNode method convert.

public static ValueNode convert(ValueNode input, Stamp stamp, boolean zeroExtend, NodeView view) {
    IntegerStamp fromStamp = (IntegerStamp) input.stamp(view);
    IntegerStamp toStamp = (IntegerStamp) stamp;
    ValueNode result;
    if (toStamp.getBits() == fromStamp.getBits()) {
        result = input;
    } else if (toStamp.getBits() < fromStamp.getBits()) {
        result = new NarrowNode(input, fromStamp.getBits(), toStamp.getBits());
    } else if (zeroExtend) {
        // toStamp.getBits() > fromStamp.getBits()
        result = ZeroExtendNode.create(input, toStamp.getBits(), view);
    } else {
        // toStamp.getBits() > fromStamp.getBits()
        result = SignExtendNode.create(input, toStamp.getBits(), view);
    }
    IntegerStamp resultStamp = (IntegerStamp) result.stamp(view);
    assert toStamp.getBits() == resultStamp.getBits();
    return result;
}
Also used : IntegerStamp(org.graalvm.compiler.core.common.type.IntegerStamp) ValueNode(org.graalvm.compiler.nodes.ValueNode)

Example 92 with ValueNode

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

the class UnpackEndianHalfNode method lower.

public void lower(ByteOrder byteOrder) {
    ValueNode result = value;
    if (value.getStackKind() == JavaKind.Double) {
        result = graph().unique(new ReinterpretNode(JavaKind.Long, value));
    }
    if ((byteOrder == ByteOrder.BIG_ENDIAN) == firstHalf) {
        result = graph().unique(new UnsignedRightShiftNode(result, ConstantNode.forInt(32, graph())));
    }
    result = IntegerConvertNode.convert(result, StampFactory.forKind(JavaKind.Int), graph(), NodeView.DEFAULT);
    replaceAtUsagesAndDelete(result);
}
Also used : ValueNode(org.graalvm.compiler.nodes.ValueNode)

Example 93 with ValueNode

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

the class UnsignedRightShiftNode method canonical.

@Override
public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) {
    NodeView view = NodeView.from(tool);
    ValueNode ret = super.canonical(tool, forX, forY);
    if (ret != this) {
        return ret;
    }
    return canonical(this, this.getArithmeticOp(), this.stamp(view), forX, forY, view);
}
Also used : ValueNode(org.graalvm.compiler.nodes.ValueNode) NodeView(org.graalvm.compiler.nodes.NodeView)

Example 94 with ValueNode

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

the class ZeroExtendNode method canonical.

@Override
public ValueNode canonical(CanonicalizerTool tool, ValueNode forValue) {
    NodeView view = NodeView.from(tool);
    ValueNode ret = super.canonical(tool, forValue);
    if (ret != this) {
        return ret;
    }
    return canonical(this, forValue, getInputBits(), getResultBits(), view, inputAlwaysPositive);
}
Also used : ValueNode(org.graalvm.compiler.nodes.ValueNode) NodeView(org.graalvm.compiler.nodes.NodeView)

Example 95 with ValueNode

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

the class ZeroExtendNode method create.

public static ValueNode create(ValueNode input, int inputBits, int resultBits, NodeView view, boolean alwaysPositive) {
    IntegerConvertOp<ZeroExtend> signExtend = ArithmeticOpTable.forStamp(input.stamp(view)).getZeroExtend();
    ValueNode synonym = findSynonym(signExtend, input, inputBits, resultBits, signExtend.foldStamp(inputBits, resultBits, input.stamp(view)));
    if (synonym != null) {
        return synonym;
    }
    return canonical(null, input, inputBits, resultBits, view, alwaysPositive);
}
Also used : ZeroExtend(org.graalvm.compiler.core.common.type.ArithmeticOpTable.IntegerConvertOp.ZeroExtend) ValueNode(org.graalvm.compiler.nodes.ValueNode)

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