Search in sources :

Example 66 with Variable

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

the class AMD64HotSpotLIRGenerator method emitLoadObjectAddress.

@Override
public Value emitLoadObjectAddress(Constant constant) {
    HotSpotObjectConstant objectConstant = (HotSpotObjectConstant) constant;
    LIRKind kind = objectConstant.isCompressed() ? getLIRKindTool().getNarrowOopKind() : getLIRKindTool().getObjectKind();
    Variable result = newVariable(kind);
    append(new AMD64HotSpotLoadAddressOp(result, constant, HotSpotConstantLoadAction.RESOLVE));
    return result;
}
Also used : Variable(org.graalvm.compiler.lir.Variable) LIRKind(org.graalvm.compiler.core.common.LIRKind) HotSpotObjectConstant(jdk.vm.ci.hotspot.HotSpotObjectConstant)

Example 67 with Variable

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

the class AMD64HotSpotLIRGenerator method emitForeignCall.

@Override
public Variable emitForeignCall(ForeignCallLinkage linkage, LIRFrameState state, Value... args) {
    HotSpotForeignCallLinkage hotspotLinkage = (HotSpotForeignCallLinkage) linkage;
    boolean destroysRegisters = hotspotLinkage.destroysRegisters();
    AMD64SaveRegistersOp save = null;
    Stub stub = getStub();
    if (destroysRegisters) {
        if (stub != null && stub.preservesRegisters()) {
            Register[] savedRegisters = getRegisterConfig().getAllocatableRegisters().toArray();
            save = emitSaveAllRegisters(savedRegisters, true);
        }
    }
    Variable result;
    LIRFrameState debugInfo = null;
    if (hotspotLinkage.needsDebugInfo()) {
        debugInfo = state;
        assert debugInfo != null || stub != null;
    }
    if (hotspotLinkage.needsJavaFrameAnchor()) {
        Register thread = getProviders().getRegisters().getThreadRegister();
        append(new AMD64HotSpotCRuntimeCallPrologueOp(config.threadLastJavaSpOffset(), thread));
        result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
        append(new AMD64HotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaFpOffset(), config.threadLastJavaPcOffset(), thread));
    } else {
        result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
    }
    if (destroysRegisters) {
        if (stub != null) {
            if (stub.preservesRegisters()) {
                HotSpotLIRGenerationResult generationResult = getResult();
                LIRFrameState key = currentRuntimeCallInfo;
                if (key == null) {
                    key = LIRFrameState.NO_STATE;
                }
                assert !generationResult.getCalleeSaveInfo().containsKey(key);
                generationResult.getCalleeSaveInfo().put(key, save);
                emitRestoreRegisters(save);
            }
        }
    }
    return result;
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) Variable(org.graalvm.compiler.lir.Variable) Register(jdk.vm.ci.code.Register) HotSpotLIRGenerationResult(org.graalvm.compiler.hotspot.HotSpotLIRGenerationResult) HotSpotForeignCallLinkage(org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage) AMD64SaveRegistersOp(org.graalvm.compiler.lir.amd64.AMD64SaveRegistersOp) Stub(org.graalvm.compiler.hotspot.stubs.Stub)

Example 68 with Variable

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

the class AMD64HotSpotMaths method emitCos.

@Override
public Variable emitCos(LIRGenerator gen, Value input) {
    if (GraalArithmeticStubs.getValue(gen.getResult().getLIR().getOptions())) {
        return null;
    }
    Variable result = gen.newVariable(LIRKind.combine(input));
    gen.append(new AMD64HotSpotMathIntrinsicOp(COS, result, gen.asAllocatable(input)));
    return result;
}
Also used : Variable(org.graalvm.compiler.lir.Variable)

Example 69 with Variable

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

the class AMD64HotSpotMaths method emitTan.

@Override
public Variable emitTan(LIRGenerator gen, Value input) {
    if (GraalArithmeticStubs.getValue(gen.getResult().getLIR().getOptions())) {
        return null;
    }
    Variable result = gen.newVariable(LIRKind.combine(input));
    gen.append(new AMD64HotSpotMathIntrinsicOp(TAN, result, gen.asAllocatable(input)));
    return result;
}
Also used : Variable(org.graalvm.compiler.lir.Variable)

Example 70 with Variable

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

the class AArch64HotSpotLIRGenerator method emitForeignCall.

@Override
public Variable emitForeignCall(ForeignCallLinkage linkage, LIRFrameState state, Value... args) {
    HotSpotForeignCallLinkage hotspotLinkage = (HotSpotForeignCallLinkage) linkage;
    Variable result;
    LIRFrameState debugInfo = null;
    if (hotspotLinkage.needsDebugInfo()) {
        debugInfo = state;
        assert debugInfo != null || getStub() != null;
    }
    if (linkage.destroysRegisters() || hotspotLinkage.needsJavaFrameAnchor()) {
        HotSpotRegistersProvider registers = getProviders().getRegisters();
        Register thread = registers.getThreadRegister();
        Variable scratch = newVariable(LIRKind.value(target().arch.getWordKind()));
        // We need a label for the return address.
        label = new Label();
        append(new AArch64HotSpotCRuntimeCallPrologueOp(config.threadLastJavaSpOffset(), config.threadLastJavaPcOffset(), config.threadLastJavaFpOffset(), thread, scratch, label));
        result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
        append(new AArch64HotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaFpOffset(), thread));
        // Clear it out so it's not being reused later.
        label = null;
    } else {
        result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
    }
    return result;
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) Variable(org.graalvm.compiler.lir.Variable) Register(jdk.vm.ci.code.Register) HotSpotRegistersProvider(org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider) Label(org.graalvm.compiler.asm.Label) HotSpotForeignCallLinkage(org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage)

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