Search in sources :

Example 1 with Variable

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

the class AArch64HotSpotLIRGenerator method emitCompress.

@Override
public Value emitCompress(Value pointer, CompressEncoding encoding, boolean nonNull) {
    LIRKind inputKind = pointer.getValueKind(LIRKind.class);
    assert inputKind.getPlatformKind() == AArch64Kind.QWORD;
    if (inputKind.isReference(0)) {
        // oop
        Variable result = newVariable(LIRKind.compressedReference(AArch64Kind.DWORD));
        append(new AArch64HotSpotMove.CompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull));
        return result;
    } else {
        // metaspace pointer
        Variable result = newVariable(LIRKind.value(AArch64Kind.DWORD));
        AllocatableValue base = Value.ILLEGAL;
        if (encoding.hasBase()) {
            base = emitLoadConstant(LIRKind.value(AArch64Kind.QWORD), JavaConstant.forLong(encoding.getBase()));
        }
        append(new AArch64HotSpotMove.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 2 with Variable

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

the class AArch64HotSpotNodeLIRBuilder method visitSafepointNode.

@Override
public void visitSafepointNode(SafepointNode i) {
    LIRFrameState info = state(i);
    Register thread = getGen().getProviders().getRegisters().getThreadRegister();
    Variable scratch = gen.newVariable(LIRKind.value(getGen().target().arch.getWordKind()));
    append(new AArch64HotSpotSafepointOp(info, getGen().config, thread, scratch));
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) Variable(org.graalvm.compiler.lir.Variable) AArch64HotSpotRegisterConfig.inlineCacheRegister(jdk.vm.ci.hotspot.aarch64.AArch64HotSpotRegisterConfig.inlineCacheRegister) Register(jdk.vm.ci.code.Register) AArch64HotSpotRegisterConfig.metaspaceMethodRegister(jdk.vm.ci.hotspot.aarch64.AArch64HotSpotRegisterConfig.metaspaceMethodRegister)

Example 3 with Variable

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

the class AArch64HotSpotNodeLIRBuilder method emitJumpToExceptionHandlerInCaller.

@Override
public void emitJumpToExceptionHandlerInCaller(ValueNode handlerInCallerPc, ValueNode exception, ValueNode exceptionPc) {
    Variable handler = gen.load(operand(handlerInCallerPc));
    ForeignCallLinkage linkage = gen.getForeignCalls().lookupForeignCall(EXCEPTION_HANDLER_IN_CALLER);
    CallingConvention outgoingCc = linkage.getOutgoingCallingConvention();
    assert outgoingCc.getArgumentCount() == 2;
    RegisterValue exceptionFixed = (RegisterValue) outgoingCc.getArgument(0);
    RegisterValue exceptionPcFixed = (RegisterValue) outgoingCc.getArgument(1);
    gen.emitMove(exceptionFixed, operand(exception));
    gen.emitMove(exceptionPcFixed, operand(exceptionPc));
    Register thread = getGen().getProviders().getRegisters().getThreadRegister();
    AArch64HotSpotJumpToExceptionHandlerInCallerOp op = new AArch64HotSpotJumpToExceptionHandlerInCallerOp(handler, exceptionFixed, exceptionPcFixed, getGen().config.threadIsMethodHandleReturnOffset, thread, getGen().config);
    append(op);
}
Also used : CallingConvention(jdk.vm.ci.code.CallingConvention) RegisterValue(jdk.vm.ci.code.RegisterValue) Variable(org.graalvm.compiler.lir.Variable) AArch64HotSpotRegisterConfig.inlineCacheRegister(jdk.vm.ci.hotspot.aarch64.AArch64HotSpotRegisterConfig.inlineCacheRegister) Register(jdk.vm.ci.code.Register) AArch64HotSpotRegisterConfig.metaspaceMethodRegister(jdk.vm.ci.hotspot.aarch64.AArch64HotSpotRegisterConfig.metaspaceMethodRegister) ForeignCallLinkage(org.graalvm.compiler.core.common.spi.ForeignCallLinkage)

Example 4 with Variable

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

the class AMD64HotSpotLIRGenerator method emitUncompress.

@Override
public Value emitUncompress(Value pointer, CompressEncoding encoding, boolean nonNull) {
    LIRKind inputKind = pointer.getValueKind(LIRKind.class);
    LIRKindTool lirKindTool = getLIRKindTool();
    assert inputKind.getPlatformKind() == lirKindTool.getNarrowOopKind().getPlatformKind();
    if (inputKind.isReference(0)) {
        // oop
        Variable result = newVariable(lirKindTool.getObjectKind());
        append(new AMD64Move.UncompressPointerOp(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull, lirKindTool));
        return result;
    } else {
        // metaspace pointer
        LIRKind uncompressedKind = lirKindTool.getWordKind();
        Variable result = newVariable(uncompressedKind);
        AllocatableValue base = Value.ILLEGAL;
        OptionValues options = getResult().getLIR().getOptions();
        if (encoding.hasBase() || GeneratePIC.getValue(options)) {
            if (GeneratePIC.getValue(options)) {
                Variable baseAddress = newVariable(uncompressedKind);
                AMD64HotSpotMove.BaseMove move = new AMD64HotSpotMove.BaseMove(baseAddress, config);
                append(move);
                base = baseAddress;
            } else {
                base = emitLoadConstant(uncompressedKind, JavaConstant.forLong(encoding.getBase()));
            }
        }
        append(new AMD64Move.UncompressPointerOp(result, asAllocatable(pointer), base, encoding, nonNull, lirKindTool));
        return result;
    }
}
Also used : Variable(org.graalvm.compiler.lir.Variable) OptionValues(org.graalvm.compiler.options.OptionValues) LIRKindTool(org.graalvm.compiler.core.common.spi.LIRKindTool) LIRKind(org.graalvm.compiler.core.common.LIRKind) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) AMD64Move(org.graalvm.compiler.lir.amd64.AMD64Move)

Example 5 with Variable

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

the class AMD64HotSpotLIRGenerator method emitCompress.

@Override
public Value emitCompress(Value pointer, CompressEncoding encoding, boolean nonNull) {
    LIRKind inputKind = pointer.getValueKind(LIRKind.class);
    LIRKindTool lirKindTool = getLIRKindTool();
    assert inputKind.getPlatformKind() == lirKindTool.getObjectKind().getPlatformKind();
    if (inputKind.isReference(0)) {
        // oop
        Variable result = newVariable(lirKindTool.getNarrowOopKind());
        append(new AMD64Move.CompressPointerOp(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull, getLIRKindTool()));
        return result;
    } else {
        // metaspace pointer
        Variable result = newVariable(lirKindTool.getNarrowPointerKind());
        AllocatableValue base = Value.ILLEGAL;
        OptionValues options = getResult().getLIR().getOptions();
        if (encoding.hasBase() || GeneratePIC.getValue(options)) {
            if (GeneratePIC.getValue(options)) {
                Variable baseAddress = newVariable(lirKindTool.getWordKind());
                AMD64HotSpotMove.BaseMove move = new AMD64HotSpotMove.BaseMove(baseAddress, config);
                append(move);
                base = baseAddress;
            } else {
                base = emitLoadConstant(lirKindTool.getWordKind(), JavaConstant.forLong(encoding.getBase()));
            }
        }
        append(new AMD64Move.CompressPointerOp(result, asAllocatable(pointer), base, encoding, nonNull, getLIRKindTool()));
        return result;
    }
}
Also used : Variable(org.graalvm.compiler.lir.Variable) OptionValues(org.graalvm.compiler.options.OptionValues) LIRKindTool(org.graalvm.compiler.core.common.spi.LIRKindTool) LIRKind(org.graalvm.compiler.core.common.LIRKind) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) AMD64Move(org.graalvm.compiler.lir.amd64.AMD64Move)

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