Search in sources :

Example 76 with Variable

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

the class AMD64ArithmeticLIRGenerator method emitIMULConst.

private Variable emitIMULConst(OperandSize size, AllocatableValue a, ConstantValue b) {
    long value = b.getJavaConstant().asLong();
    if (NumUtil.isInt(value)) {
        int imm = (int) value;
        AMD64RMIOp op;
        if (NumUtil.isByte(imm)) {
            op = AMD64RMIOp.IMUL_SX;
        } else {
            op = AMD64RMIOp.IMUL;
        }
        Variable ret = getLIRGen().newVariable(LIRKind.combine(a, b));
        getLIRGen().append(new AMD64Binary.RMIOp(op, size, ret, a, imm));
        return ret;
    } else {
        return emitBinaryVar(LIRKind.combine(a, b), AMD64RMOp.IMUL, size, true, a, getLIRGen().asAllocatable(b));
    }
}
Also used : Variable(org.graalvm.compiler.lir.Variable) AMD64Binary(org.graalvm.compiler.lir.amd64.AMD64Binary) AMD64RMIOp(org.graalvm.compiler.asm.amd64.AMD64Assembler.AMD64RMIOp)

Example 77 with Variable

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

the class AMD64ArithmeticLIRGenerator method emitConvertMemoryOp.

protected Value emitConvertMemoryOp(PlatformKind kind, AMD64RMOp op, OperandSize size, AMD64AddressValue address, LIRFrameState state) {
    Variable result = getLIRGen().newVariable(LIRKind.value(kind));
    getLIRGen().append(new AMD64Unary.MemoryOp(op, size, result, address, state));
    return result;
}
Also used : AMD64Unary(org.graalvm.compiler.lir.amd64.AMD64Unary) Variable(org.graalvm.compiler.lir.Variable)

Example 78 with Variable

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

the class AMD64ArithmeticLIRGenerator method emitMathExp.

@Override
public Value emitMathExp(Value input) {
    Variable result = getLIRGen().newVariable(LIRKind.combine(input));
    AllocatableValue stackSlot = getLIRGen().getResult().getFrameMapBuilder().allocateSpillSlot(LIRKind.value(AMD64Kind.QWORD));
    getLIRGen().append(new AMD64MathIntrinsicUnaryOp(getAMD64LIRGen(), EXP, result, getLIRGen().asAllocatable(input), stackSlot));
    return result;
}
Also used : AMD64MathIntrinsicUnaryOp(org.graalvm.compiler.lir.amd64.AMD64MathIntrinsicUnaryOp) Variable(org.graalvm.compiler.lir.Variable) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 79 with Variable

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

the class AMD64ArithmeticLIRGenerator method emitMathLog.

@Override
public Value emitMathLog(Value input, boolean base10) {
    LIRGenerator gen = getLIRGen();
    Variable result = maths.emitLog(gen, input, base10);
    if (result == null) {
        result = gen.newVariable(LIRKind.combine(input));
        AllocatableValue stackSlot = gen.getResult().getFrameMapBuilder().allocateSpillSlot(LIRKind.value(AMD64Kind.QWORD));
        gen.append(new AMD64MathIntrinsicUnaryOp(getAMD64LIRGen(), base10 ? LOG10 : LOG, result, gen.asAllocatable(input), stackSlot));
    }
    return result;
}
Also used : AMD64MathIntrinsicUnaryOp(org.graalvm.compiler.lir.amd64.AMD64MathIntrinsicUnaryOp) Variable(org.graalvm.compiler.lir.Variable) ArithmeticLIRGenerator(org.graalvm.compiler.lir.gen.ArithmeticLIRGenerator) LIRGenerator(org.graalvm.compiler.lir.gen.LIRGenerator) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 80 with Variable

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

the class AMD64ArithmeticLIRGenerator method emitBinaryConst.

private Variable emitBinaryConst(LIRKind resultKind, AMD64BinaryArithmetic op, OperandSize size, boolean commutative, AllocatableValue a, ConstantValue b, boolean setFlags) {
    long value = b.getJavaConstant().asLong();
    if (NumUtil.isInt(value)) {
        Variable result = getLIRGen().newVariable(resultKind);
        int constant = (int) value;
        if (!setFlags) {
            AMD64MOp mop = getMOp(op, constant);
            if (mop != null) {
                getLIRGen().append(new AMD64Unary.MOp(mop, size, result, a));
                return result;
            }
        }
        getLIRGen().append(new AMD64Binary.ConstOp(op, size, result, a, constant));
        return result;
    } else {
        return emitBinaryVar(resultKind, op.getRMOpcode(size), size, commutative, a, getLIRGen().asAllocatable(b));
    }
}
Also used : AMD64Unary(org.graalvm.compiler.lir.amd64.AMD64Unary) Variable(org.graalvm.compiler.lir.Variable) AMD64Binary(org.graalvm.compiler.lir.amd64.AMD64Binary) AMD64MOp(org.graalvm.compiler.asm.amd64.AMD64Assembler.AMD64MOp)

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