Search in sources :

Example 41 with Variable

use of org.graalvm.compiler.lir.Variable in project graal by oracle.

the class JVMCIInfopointErrorTest method testUnexpectedTypeInRegister.

@Test(expected = JVMCIError.class)
public void testUnexpectedTypeInRegister() {
    test((tool, state, safepoint) -> {
        Variable var = tool.newVariable(LIRKind.fromJavaKind(tool.target().arch, JavaKind.Int));
        tool.append(new ValueDef(var));
        LIRFrameState newState = modifyTopFrame(state, new JavaValue[] { var }, new JavaKind[] { JavaKind.Illegal }, 1, 0, 0);
        safepoint.accept(newState);
    });
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) Variable(org.graalvm.compiler.lir.Variable) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest) Test(org.junit.Test)

Example 42 with Variable

use of org.graalvm.compiler.lir.Variable in project graal by oracle.

the class SPARCHotSpotLIRGenerator method emitLogicCompareAndSwap.

@Override
public Variable emitLogicCompareAndSwap(Value address, Value expectedValue, Value newValue, Value trueValue, Value falseValue) {
    ValueKind<?> kind = newValue.getValueKind();
    assert kind.equals(expectedValue.getValueKind());
    SPARCKind memKind = (SPARCKind) kind.getPlatformKind();
    Variable result = newVariable(newValue.getValueKind());
    append(new CompareAndSwapOp(result, asAllocatable(address), asAllocatable(expectedValue), asAllocatable(newValue)));
    return emitConditionalMove(memKind, expectedValue, result, Condition.EQ, true, trueValue, falseValue);
}
Also used : Variable(org.graalvm.compiler.lir.Variable) CompareAndSwapOp(org.graalvm.compiler.lir.sparc.SPARCMove.CompareAndSwapOp) SPARCKind(jdk.vm.ci.sparc.SPARCKind)

Example 43 with Variable

use of org.graalvm.compiler.lir.Variable in project graal by oracle.

the class SPARCHotSpotLIRGenerator method emitCompress.

@Override
public Value emitCompress(Value pointer, CompressEncoding encoding, boolean nonNull) {
    LIRKind inputKind = pointer.getValueKind(LIRKind.class);
    assert inputKind.getPlatformKind() == XWORD : inputKind;
    if (inputKind.isReference(0)) {
        // oop
        Variable result = newVariable(LIRKind.compressedReference(WORD));
        append(new SPARCHotSpotMove.CompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull));
        return result;
    } else {
        // metaspace pointer
        Variable result = newVariable(LIRKind.value(WORD));
        AllocatableValue base = Value.ILLEGAL;
        if (encoding.hasBase()) {
            base = emitLoadConstant(LIRKind.value(XWORD), JavaConstant.forLong(encoding.getBase()));
        }
        append(new SPARCHotSpotMove.CompressPointer(result, asAllocatable(pointer), base, encoding, nonNull));
        return result;
    }
}
Also used : Variable(org.graalvm.compiler.lir.Variable) LIRKind(org.graalvm.compiler.core.common.LIRKind) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 44 with Variable

use of org.graalvm.compiler.lir.Variable in project graal by oracle.

the class SPARCHotSpotLIRGenerator method emitValueCompareAndSwap.

@Override
public Variable emitValueCompareAndSwap(Value address, Value expectedValue, Value newValue) {
    ValueKind<?> kind = newValue.getValueKind();
    assert kind.equals(expectedValue.getValueKind());
    Variable result = newVariable(newValue.getValueKind());
    append(new CompareAndSwapOp(result, asAllocatable(address), asAllocatable(expectedValue), asAllocatable(newValue)));
    return result;
}
Also used : Variable(org.graalvm.compiler.lir.Variable) CompareAndSwapOp(org.graalvm.compiler.lir.sparc.SPARCMove.CompareAndSwapOp)

Example 45 with Variable

use of org.graalvm.compiler.lir.Variable in project graal by oracle.

the class SPARCArithmeticLIRGenerator method emitMathAbs.

@Override
public Value emitMathAbs(Value inputValue) {
    Variable result = getLIRGen().newVariable(LIRKind.combine(inputValue));
    SPARCKind kind = (SPARCKind) inputValue.getPlatformKind();
    Opfs opf;
    switch(kind) {
        case SINGLE:
            opf = Opfs.Fabss;
            break;
        case DOUBLE:
            opf = Opfs.Fabsd;
            break;
        default:
            throw GraalError.shouldNotReachHere("Input kind: " + kind);
    }
    getLIRGen().append(new SPARCOPFOp(opf, g0.asValue(), getLIRGen().asAllocatable(inputValue), result));
    return result;
}
Also used : SPARCOPFOp(org.graalvm.compiler.lir.sparc.SPARCOPFOp) Variable(org.graalvm.compiler.lir.Variable) Opfs(org.graalvm.compiler.asm.sparc.SPARCAssembler.Opfs) SPARCKind(jdk.vm.ci.sparc.SPARCKind)

Aggregations

Variable (org.graalvm.compiler.lir.Variable)113 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)27 LIRKind (org.graalvm.compiler.core.common.LIRKind)19 RegisterValue (jdk.vm.ci.code.RegisterValue)11 Value (jdk.vm.ci.meta.Value)11 Register (jdk.vm.ci.code.Register)10 AMD64Unary (org.graalvm.compiler.lir.amd64.AMD64Unary)9 AMD64Binary (org.graalvm.compiler.lir.amd64.AMD64Binary)8 SPARCAddressValue (org.graalvm.compiler.lir.sparc.SPARCAddressValue)8 AMD64Kind (jdk.vm.ci.amd64.AMD64Kind)7 AMD64AddressValue (org.graalvm.compiler.lir.amd64.AMD64AddressValue)7 SPARCKind (jdk.vm.ci.sparc.SPARCKind)6 ConstantValue (org.graalvm.compiler.lir.ConstantValue)6 JavaConstant (jdk.vm.ci.meta.JavaConstant)5 PlatformKind (jdk.vm.ci.meta.PlatformKind)5 LIRFrameState (org.graalvm.compiler.lir.LIRFrameState)5 LIRValueUtil.asJavaConstant (org.graalvm.compiler.lir.LIRValueUtil.asJavaConstant)5 LIRValueUtil.isJavaConstant (org.graalvm.compiler.lir.LIRValueUtil.isJavaConstant)5 AMD64MathIntrinsicUnaryOp (org.graalvm.compiler.lir.amd64.AMD64MathIntrinsicUnaryOp)5 AMD64Move (org.graalvm.compiler.lir.amd64.AMD64Move)5