Search in sources :

Example 6 with LogicConstantNode

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

the class NodeLIRBuilder method emitConditional.

public Variable emitConditional(LogicNode node, Value trueValue, Value falseValue) {
    if (node instanceof IsNullNode) {
        IsNullNode isNullNode = (IsNullNode) node;
        LIRKind kind = gen.getLIRKind(isNullNode.getValue().stamp(NodeView.DEFAULT));
        Value nullValue = gen.emitConstant(kind, JavaConstant.NULL_POINTER);
        return gen.emitConditionalMove(kind.getPlatformKind(), operand(isNullNode.getValue()), nullValue, Condition.EQ, false, trueValue, falseValue);
    } else if (node instanceof CompareNode) {
        CompareNode compare = (CompareNode) node;
        PlatformKind kind = gen.getLIRKind(compare.getX().stamp(NodeView.DEFAULT)).getPlatformKind();
        return gen.emitConditionalMove(kind, operand(compare.getX()), operand(compare.getY()), compare.condition().asCondition(), compare.unorderedIsTrue(), trueValue, falseValue);
    } else if (node instanceof LogicConstantNode) {
        return gen.emitMove(((LogicConstantNode) node).getValue() ? trueValue : falseValue);
    } else if (node instanceof IntegerTestNode) {
        IntegerTestNode test = (IntegerTestNode) node;
        return gen.emitIntegerTestMove(operand(test.getX()), operand(test.getY()), trueValue, falseValue);
    } else {
        throw GraalError.unimplemented(node.toString());
    }
}
Also used : CompareNode(org.graalvm.compiler.nodes.calc.CompareNode) IsNullNode(org.graalvm.compiler.nodes.calc.IsNullNode) IntegerTestNode(org.graalvm.compiler.nodes.calc.IntegerTestNode) ComplexMatchValue(org.graalvm.compiler.core.match.ComplexMatchValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) LogicConstantNode(org.graalvm.compiler.nodes.LogicConstantNode) LIRKind(org.graalvm.compiler.core.common.LIRKind) PlatformKind(jdk.vm.ci.meta.PlatformKind)

Aggregations

LogicConstantNode (org.graalvm.compiler.nodes.LogicConstantNode)6 LogicNode (org.graalvm.compiler.nodes.LogicNode)3 RuntimeConstraint (jdk.vm.ci.meta.DeoptimizationReason.RuntimeConstraint)2 Node (org.graalvm.compiler.graph.Node)2 BciBlock (org.graalvm.compiler.java.BciBlockMapping.BciBlock)2 FrameState (org.graalvm.compiler.nodes.FrameState)2 ValueNode (org.graalvm.compiler.nodes.ValueNode)2 ProfilingPlugin (org.graalvm.compiler.nodes.graphbuilderconf.ProfilingPlugin)2 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)1 PlatformKind (jdk.vm.ci.meta.PlatformKind)1 Value (jdk.vm.ci.meta.Value)1 LIRKind (org.graalvm.compiler.core.common.LIRKind)1 ComplexMatchValue (org.graalvm.compiler.core.match.ComplexMatchValue)1 DebugContext (org.graalvm.compiler.debug.DebugContext)1 NodeEventScope (org.graalvm.compiler.graph.Graph.NodeEventScope)1 AbstractMergeNode (org.graalvm.compiler.nodes.AbstractMergeNode)1 FixedGuardNode (org.graalvm.compiler.nodes.FixedGuardNode)1 FixedNode (org.graalvm.compiler.nodes.FixedNode)1 FixedWithNextNode (org.graalvm.compiler.nodes.FixedWithNextNode)1 IfNode (org.graalvm.compiler.nodes.IfNode)1