Search in sources :

Example 71 with Variable

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

the class AArch64HotSpotLIRGenerator method emitUncompress.

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

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

the class AMD64ArithmeticLIRGenerator method emitBinaryMemory.

public Value emitBinaryMemory(AMD64RMOp op, OperandSize size, AllocatableValue a, AMD64AddressValue location, LIRFrameState state) {
    Variable result = getLIRGen().newVariable(LIRKind.combine(a));
    getLIRGen().append(new AMD64Binary.MemoryTwoOp(op, size, result, a, location, state));
    return result;
}
Also used : Variable(org.graalvm.compiler.lir.Variable) AMD64Binary(org.graalvm.compiler.lir.amd64.AMD64Binary)

Example 73 with Variable

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

the class AMD64ArithmeticLIRGenerator method emitMathSin.

@Override
public Value emitMathSin(Value input) {
    LIRGenerator gen = getLIRGen();
    Variable result = maths.emitSin(gen, input);
    if (result == null) {
        result = gen.newVariable(LIRKind.combine(input));
        AllocatableValue stackSlot = gen.getResult().getFrameMapBuilder().allocateSpillSlot(LIRKind.value(AMD64Kind.QWORD));
        gen.append(new AMD64MathIntrinsicUnaryOp(getAMD64LIRGen(), SIN, 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 74 with Variable

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

the class AMD64ArithmeticLIRGenerator method emitNot.

@Override
public Variable emitNot(Value inputVal) {
    AllocatableValue input = getLIRGen().asAllocatable(inputVal);
    Variable result = getLIRGen().newVariable(LIRKind.combine(input));
    switch((AMD64Kind) input.getPlatformKind()) {
        case DWORD:
            getLIRGen().append(new AMD64Unary.MOp(NOT, DWORD, result, input));
            break;
        case QWORD:
            getLIRGen().append(new AMD64Unary.MOp(NOT, QWORD, result, input));
            break;
        default:
            throw GraalError.shouldNotReachHere();
    }
    return result;
}
Also used : AMD64Unary(org.graalvm.compiler.lir.amd64.AMD64Unary) AMD64Kind(jdk.vm.ci.amd64.AMD64Kind) Variable(org.graalvm.compiler.lir.Variable) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 75 with Variable

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

the class AMD64ArithmeticLIRGenerator method emitNegate.

@Override
public Variable emitNegate(Value inputVal) {
    AllocatableValue input = getLIRGen().asAllocatable(inputVal);
    Variable result = getLIRGen().newVariable(LIRKind.combine(input));
    TargetDescription target = getLIRGen().target();
    boolean isAvx = ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX);
    switch((AMD64Kind) input.getPlatformKind()) {
        case DWORD:
            getLIRGen().append(new AMD64Unary.MOp(NEG, DWORD, result, input));
            break;
        case QWORD:
            getLIRGen().append(new AMD64Unary.MOp(NEG, QWORD, result, input));
            break;
        case SINGLE:
            if (isAvx) {
                getLIRGen().append(new AMD64Binary.DataThreeOp(AVXOp.XOR, PS, result, input, JavaConstant.forFloat(Float.intBitsToFloat(0x80000000)), 16));
            } else {
                getLIRGen().append(new AMD64Binary.DataTwoOp(SSEOp.XOR, PS, result, input, JavaConstant.forFloat(Float.intBitsToFloat(0x80000000)), 16));
            }
            break;
        case DOUBLE:
            if (isAvx) {
                getLIRGen().append(new AMD64Binary.DataThreeOp(AVXOp.XOR, PD, result, input, JavaConstant.forDouble(Double.longBitsToDouble(0x8000000000000000L)), 16));
            } else {
                getLIRGen().append(new AMD64Binary.DataTwoOp(SSEOp.XOR, PD, result, input, JavaConstant.forDouble(Double.longBitsToDouble(0x8000000000000000L)), 16));
            }
            break;
        default:
            throw GraalError.shouldNotReachHere(input.getPlatformKind().toString());
    }
    return result;
}
Also used : AMD64Unary(org.graalvm.compiler.lir.amd64.AMD64Unary) AMD64Kind(jdk.vm.ci.amd64.AMD64Kind) Variable(org.graalvm.compiler.lir.Variable) AMD64Binary(org.graalvm.compiler.lir.amd64.AMD64Binary) TargetDescription(jdk.vm.ci.code.TargetDescription) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

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