Search in sources :

Example 6 with ComplexMatchResult

use of org.graalvm.compiler.core.match.ComplexMatchResult in project graal by oracle.

the class SPARCNodeMatchRules method emitZeroExtendMemory.

private ComplexMatchResult emitZeroExtendMemory(Access access, int fromBits, int toBits) {
    assert fromBits <= toBits && toBits <= 64;
    SPARCKind toKind = null;
    SPARCKind fromKind = null;
    if (fromBits == toBits) {
        return null;
    }
    toKind = toBits > 32 ? XWORD : WORD;
    switch(fromBits) {
        case 8:
            fromKind = BYTE;
            break;
        case 16:
            fromKind = HWORD;
            break;
        case 32:
            fromKind = WORD;
            break;
        default:
            throw GraalError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
    }
    SPARCKind localFromKind = fromKind;
    SPARCKind localToKind = toKind;
    return builder -> {
        // Loads are always zero extending load
        return getLIRGeneratorTool().emitZeroExtendLoad(LIRKind.value(localFromKind), LIRKind.value(localToKind), operand(access.getAddress()), getState(access));
    };
}
Also used : CompareNode(org.graalvm.compiler.nodes.calc.CompareNode) LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) XWORD(jdk.vm.ci.sparc.SPARCKind.XWORD) LabelRef(org.graalvm.compiler.lir.LabelRef) SPARCKind(jdk.vm.ci.sparc.SPARCKind) WORD(jdk.vm.ci.sparc.SPARCKind.WORD) SignExtendNode(org.graalvm.compiler.nodes.calc.SignExtendNode) ZeroExtendNode(org.graalvm.compiler.nodes.calc.ZeroExtendNode) Condition(org.graalvm.compiler.core.common.calc.Condition) HWORD(jdk.vm.ci.sparc.SPARCKind.HWORD) IfNode(org.graalvm.compiler.nodes.IfNode) LIRKind(org.graalvm.compiler.core.common.LIRKind) LIRLowerableAccess(org.graalvm.compiler.nodes.memory.LIRLowerableAccess) BYTE(jdk.vm.ci.sparc.SPARCKind.BYTE) DeoptimizingNode(org.graalvm.compiler.nodes.DeoptimizingNode) CanonicalCondition(org.graalvm.compiler.core.common.calc.CanonicalCondition) JavaConstant(jdk.vm.ci.meta.JavaConstant) ValueNode(org.graalvm.compiler.nodes.ValueNode) Value(jdk.vm.ci.meta.Value) ComplexMatchResult(org.graalvm.compiler.core.match.ComplexMatchResult) Access(org.graalvm.compiler.nodes.memory.Access) NodeMatchRules(org.graalvm.compiler.core.gen.NodeMatchRules) GraalError(org.graalvm.compiler.debug.GraalError) LIRGeneratorTool(org.graalvm.compiler.lir.gen.LIRGeneratorTool) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) MatchRule(org.graalvm.compiler.core.match.MatchRule) LogicCompareAndSwapNode(org.graalvm.compiler.nodes.java.LogicCompareAndSwapNode) SPARCKind(jdk.vm.ci.sparc.SPARCKind)

Example 7 with ComplexMatchResult

use of org.graalvm.compiler.core.match.ComplexMatchResult in project graal by oracle.

the class SPARCNodeMatchRules method emitSignExtendMemory.

private ComplexMatchResult emitSignExtendMemory(Access access, int fromBits, int toBits) {
    assert fromBits <= toBits && toBits <= 64;
    SPARCKind toKind = null;
    SPARCKind fromKind = null;
    if (fromBits == toBits) {
        return null;
    }
    toKind = toBits > 32 ? XWORD : WORD;
    switch(fromBits) {
        case 8:
            fromKind = BYTE;
            break;
        case 16:
            fromKind = HWORD;
            break;
        case 32:
            fromKind = WORD;
            break;
        default:
            throw GraalError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
    }
    SPARCKind localFromKind = fromKind;
    SPARCKind localToKind = toKind;
    return builder -> {
        return getLIRGeneratorTool().emitSignExtendLoad(LIRKind.value(localFromKind), LIRKind.value(localToKind), operand(access.getAddress()), getState(access));
    };
}
Also used : CompareNode(org.graalvm.compiler.nodes.calc.CompareNode) LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) XWORD(jdk.vm.ci.sparc.SPARCKind.XWORD) LabelRef(org.graalvm.compiler.lir.LabelRef) SPARCKind(jdk.vm.ci.sparc.SPARCKind) WORD(jdk.vm.ci.sparc.SPARCKind.WORD) SignExtendNode(org.graalvm.compiler.nodes.calc.SignExtendNode) ZeroExtendNode(org.graalvm.compiler.nodes.calc.ZeroExtendNode) Condition(org.graalvm.compiler.core.common.calc.Condition) HWORD(jdk.vm.ci.sparc.SPARCKind.HWORD) IfNode(org.graalvm.compiler.nodes.IfNode) LIRKind(org.graalvm.compiler.core.common.LIRKind) LIRLowerableAccess(org.graalvm.compiler.nodes.memory.LIRLowerableAccess) BYTE(jdk.vm.ci.sparc.SPARCKind.BYTE) DeoptimizingNode(org.graalvm.compiler.nodes.DeoptimizingNode) CanonicalCondition(org.graalvm.compiler.core.common.calc.CanonicalCondition) JavaConstant(jdk.vm.ci.meta.JavaConstant) ValueNode(org.graalvm.compiler.nodes.ValueNode) Value(jdk.vm.ci.meta.Value) ComplexMatchResult(org.graalvm.compiler.core.match.ComplexMatchResult) Access(org.graalvm.compiler.nodes.memory.Access) NodeMatchRules(org.graalvm.compiler.core.gen.NodeMatchRules) GraalError(org.graalvm.compiler.debug.GraalError) LIRGeneratorTool(org.graalvm.compiler.lir.gen.LIRGeneratorTool) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) MatchRule(org.graalvm.compiler.core.match.MatchRule) LogicCompareAndSwapNode(org.graalvm.compiler.nodes.java.LogicCompareAndSwapNode) SPARCKind(jdk.vm.ci.sparc.SPARCKind)

Aggregations

ComplexMatchResult (org.graalvm.compiler.core.match.ComplexMatchResult)7 JavaConstant (jdk.vm.ci.meta.JavaConstant)6 Value (jdk.vm.ci.meta.Value)6 LIRKind (org.graalvm.compiler.core.common.LIRKind)6 CanonicalCondition (org.graalvm.compiler.core.common.calc.CanonicalCondition)6 Condition (org.graalvm.compiler.core.common.calc.Condition)6 MatchRule (org.graalvm.compiler.core.match.MatchRule)6 LabelRef (org.graalvm.compiler.lir.LabelRef)6 NodeMatchRules (org.graalvm.compiler.core.gen.NodeMatchRules)5 GraalError (org.graalvm.compiler.debug.GraalError)5 LIRFrameState (org.graalvm.compiler.lir.LIRFrameState)5 LIRGeneratorTool (org.graalvm.compiler.lir.gen.LIRGeneratorTool)5 DeoptimizingNode (org.graalvm.compiler.nodes.DeoptimizingNode)5 IfNode (org.graalvm.compiler.nodes.IfNode)5 ValueNode (org.graalvm.compiler.nodes.ValueNode)5 CompareNode (org.graalvm.compiler.nodes.calc.CompareNode)5 SignExtendNode (org.graalvm.compiler.nodes.calc.SignExtendNode)5 ZeroExtendNode (org.graalvm.compiler.nodes.calc.ZeroExtendNode)5 LogicCompareAndSwapNode (org.graalvm.compiler.nodes.java.LogicCompareAndSwapNode)5 Access (org.graalvm.compiler.nodes.memory.Access)5