Search in sources :

Example 6 with Variable

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

the class AMD64HotSpotMaths method emitLog.

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

Example 7 with Variable

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

the class AMD64HotSpotMaths method emitSin.

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

Example 8 with Variable

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

the class AMD64HotSpotNodeLIRBuilder 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();
    AMD64HotSpotJumpToExceptionHandlerInCallerOp op = new AMD64HotSpotJumpToExceptionHandlerInCallerOp(handler, exceptionFixed, exceptionPcFixed, getGen().config.threadIsMethodHandleReturnOffset, thread);
    append(op);
}
Also used : CallingConvention(jdk.vm.ci.code.CallingConvention) RegisterValue(jdk.vm.ci.code.RegisterValue) Variable(org.graalvm.compiler.lir.Variable) Register(jdk.vm.ci.code.Register) ForeignCallLinkage(org.graalvm.compiler.core.common.spi.ForeignCallLinkage)

Example 9 with Variable

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

the class AMD64ArithmeticLIRGenerator method emitShift.

private Variable emitShift(AMD64Shift op, OperandSize size, Value a, Value b) {
    Variable result = getLIRGen().newVariable(LIRKind.combine(a, b).changeType(a.getPlatformKind()));
    AllocatableValue input = getLIRGen().asAllocatable(a);
    if (isJavaConstant(b)) {
        JavaConstant c = asJavaConstant(b);
        if (c.asLong() == 1) {
            getLIRGen().append(new AMD64Unary.MOp(op.m1Op, size, result, input));
        } else {
            /*
                 * c is implicitly masked to 5 or 6 bits by the CPU, so casting it to (int) is
                 * always correct, even without the NumUtil.is32bit() test.
                 */
            getLIRGen().append(new AMD64Binary.ConstOp(op.miOp, size, result, input, (int) c.asLong()));
        }
    } else {
        getLIRGen().emitMove(RCX_I, b);
        getLIRGen().append(new AMD64ShiftOp(op.mcOp, size, result, input, RCX_I));
    }
    return result;
}
Also used : AMD64Unary(org.graalvm.compiler.lir.amd64.AMD64Unary) Variable(org.graalvm.compiler.lir.Variable) AMD64Binary(org.graalvm.compiler.lir.amd64.AMD64Binary) AMD64ShiftOp(org.graalvm.compiler.lir.amd64.AMD64ShiftOp) JavaConstant(jdk.vm.ci.meta.JavaConstant) LIRValueUtil.asJavaConstant(org.graalvm.compiler.lir.LIRValueUtil.asJavaConstant) LIRValueUtil.isJavaConstant(org.graalvm.compiler.lir.LIRValueUtil.isJavaConstant) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 10 with Variable

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

the class AMD64ArithmeticLIRGenerator method emitBaseOffsetLea.

private Variable emitBaseOffsetLea(LIRKind resultKind, Value base, int offset, OperandSize size) {
    Variable result = getLIRGen().newVariable(resultKind);
    AMD64AddressValue address = new AMD64AddressValue(resultKind, getLIRGen().asAllocatable(base), offset);
    getLIRGen().append(new AMD64Move.LeaOp(result, address, size));
    return result;
}
Also used : AMD64AddressValue(org.graalvm.compiler.lir.amd64.AMD64AddressValue) Variable(org.graalvm.compiler.lir.Variable) 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