Search in sources :

Example 41 with AllocatableValue

use of jdk.vm.ci.meta.AllocatableValue in project graal by oracle.

the class SPARCArithmeticLIRGenerator method emitReinterpret.

@Override
public AllocatableValue emitReinterpret(LIRKind to, Value inputVal) {
    SPARCKind fromKind = (SPARCKind) inputVal.getPlatformKind();
    SPARCKind toKind = (SPARCKind) to.getPlatformKind();
    AllocatableValue input = getLIRGen().asAllocatable(inputVal);
    Variable result = getLIRGen().newVariable(to);
    // These cases require a move between CPU and FPU registers:
    if (fromKind.isFloat() != toKind.isFloat()) {
        moveBetweenFpGp(result, input);
        return result;
    } else {
        // Consequently, there is no need for a special zero-extension move.
        return emitConvertMove(to, input);
    }
}
Also used : Variable(org.graalvm.compiler.lir.Variable) SPARCKind(jdk.vm.ci.sparc.SPARCKind) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 42 with AllocatableValue

use of jdk.vm.ci.meta.AllocatableValue in project graal by oracle.

the class SPARCLIRGenerator method emitStrategySwitch.

@Override
public void emitStrategySwitch(SwitchStrategy strategy, Variable key, LabelRef[] keyTargets, LabelRef defaultTarget) {
    Variable scratchValue = newVariable(key.getValueKind());
    AllocatableValue base = AllocatableValue.ILLEGAL;
    for (Constant c : strategy.getKeyConstants()) {
        if (!getMoveFactory().canInlineConstant(c)) {
            base = constantTableBaseProvider.getConstantTableBase();
            break;
        }
    }
    append(createStrategySwitchOp(base, strategy, keyTargets, defaultTarget, key, scratchValue));
}
Also used : Variable(org.graalvm.compiler.lir.Variable) Constant(jdk.vm.ci.meta.Constant) 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 43 with AllocatableValue

use of jdk.vm.ci.meta.AllocatableValue in project graal by oracle.

the class SPARCLIRGenerator method emitIntegerCompare.

private boolean emitIntegerCompare(SPARCKind cmpKind, Value a, Value b) {
    boolean mirrored;
    assert cmpKind.isInteger();
    AllocatableValue left;
    Value right;
    if (LIRValueUtil.isVariable(b)) {
        left = load(b);
        right = loadSimm13(a);
        mirrored = true;
    } else {
        left = load(a);
        right = loadSimm13(b);
        mirrored = false;
    }
    int compareBytes = cmpKind.getSizeInBytes();
    // SPARC compares 32 or 64 bits
    if (compareBytes < left.getPlatformKind().getSizeInBytes()) {
        left = asAllocatable(arithmeticLIRGen.emitSignExtend(left, cmpKind.getSizeInBits(), XWORD.getSizeInBits()));
    }
    if (compareBytes < right.getPlatformKind().getSizeInBytes()) {
        right = arithmeticLIRGen.emitSignExtend(right, cmpKind.getSizeInBits(), XWORD.getSizeInBits());
    }
    append(SPARCOP3Op.newBinaryVoid(Subcc, left, right));
    return mirrored;
}
Also used : Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) SPARCImmediateAddressValue(org.graalvm.compiler.lir.sparc.SPARCImmediateAddressValue) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 44 with AllocatableValue

use of jdk.vm.ci.meta.AllocatableValue in project graal by oracle.

the class SPARCLIRGenerator method emitCompareBranch.

@Override
public void emitCompareBranch(PlatformKind cmpKind, Value x, Value y, Condition cond, boolean unorderedIsTrue, LabelRef trueDestination, LabelRef falseDestination, double trueDestinationProbability) {
    AllocatableValue left;
    Value right;
    Condition actualCondition;
    if (isJavaConstant(x)) {
        left = load(y);
        right = loadSimm13(x);
        actualCondition = cond.mirror();
    } else {
        left = load(x);
        right = loadSimm13(y);
        actualCondition = cond;
    }
    SPARCKind actualCmpKind = (SPARCKind) cmpKind;
    if (actualCmpKind.isInteger()) {
        assert actualCmpKind.equals(XWORD) || actualCmpKind.equals(WORD) : "SPARC does not support compare of: " + actualCmpKind;
        append(new SPARCControlFlow.CompareBranchOp(left, right, actualCondition, trueDestination, falseDestination, actualCmpKind, unorderedIsTrue, trueDestinationProbability));
    } else if (actualCmpKind.isFloat()) {
        emitFloatCompare(actualCmpKind, x, y, Fcc0);
        ConditionFlag cf = SPARCControlFlow.fromCondition(false, cond, unorderedIsTrue);
        append(new SPARCControlFlow.BranchOp(cf, trueDestination, falseDestination, actualCmpKind, trueDestinationProbability));
    } else {
        throw GraalError.shouldNotReachHere();
    }
}
Also used : Condition(org.graalvm.compiler.core.common.calc.Condition) BranchOp(org.graalvm.compiler.lir.sparc.SPARCControlFlow.BranchOp) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) SPARCImmediateAddressValue(org.graalvm.compiler.lir.sparc.SPARCImmediateAddressValue) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) SPARCKind(jdk.vm.ci.sparc.SPARCKind) SPARCControlFlow(org.graalvm.compiler.lir.sparc.SPARCControlFlow) ConditionFlag(org.graalvm.compiler.asm.sparc.SPARCAssembler.ConditionFlag)

Example 45 with AllocatableValue

use of jdk.vm.ci.meta.AllocatableValue in project graal by oracle.

the class SPARCMoveFactory method createMove.

@Override
public LIRInstruction createMove(AllocatableValue dst, Value src) {
    boolean srcIsSlot = isStackSlotValue(src);
    boolean dstIsSlot = isStackSlotValue(dst);
    if (isConstantValue(src)) {
        return createLoad(dst, asConstant(src));
    } else if (src instanceof SPARCAddressValue) {
        return new LoadAddressOp(dst, (SPARCAddressValue) src);
    } else {
        assert src instanceof AllocatableValue;
        if (srcIsSlot && dstIsSlot) {
            throw GraalError.shouldNotReachHere(src.getClass() + " " + dst.getClass());
        } else {
            return new Move(dst, (AllocatableValue) src);
        }
    }
}
Also used : Move(org.graalvm.compiler.lir.sparc.SPARCMove.Move) SPARCMove(org.graalvm.compiler.lir.sparc.SPARCMove) LoadAddressOp(org.graalvm.compiler.lir.sparc.SPARCMove.LoadAddressOp) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Aggregations

AllocatableValue (jdk.vm.ci.meta.AllocatableValue)87 Value (jdk.vm.ci.meta.Value)22 Variable (org.graalvm.compiler.lir.Variable)20 LIRKind (org.graalvm.compiler.core.common.LIRKind)13 LIRInstruction (org.graalvm.compiler.lir.LIRInstruction)11 Indent (org.graalvm.compiler.debug.Indent)10 RegisterValue (jdk.vm.ci.code.RegisterValue)9 ValueUtil.asAllocatableValue (jdk.vm.ci.code.ValueUtil.asAllocatableValue)8 DebugContext (org.graalvm.compiler.debug.DebugContext)8 Register (jdk.vm.ci.code.Register)6 JavaConstant (jdk.vm.ci.meta.JavaConstant)6 AMD64MathIntrinsicUnaryOp (org.graalvm.compiler.lir.amd64.AMD64MathIntrinsicUnaryOp)5 LIRValueUtil.asJavaConstant (org.graalvm.compiler.lir.LIRValueUtil.asJavaConstant)4 LIRValueUtil.isJavaConstant (org.graalvm.compiler.lir.LIRValueUtil.isJavaConstant)4 ValueMoveOp (org.graalvm.compiler.lir.StandardOp.ValueMoveOp)4 ArithmeticLIRGenerator (org.graalvm.compiler.lir.gen.ArithmeticLIRGenerator)4 LIRGenerator (org.graalvm.compiler.lir.gen.LIRGenerator)4 SPARCAddressValue (org.graalvm.compiler.lir.sparc.SPARCAddressValue)4 AMD64Kind (jdk.vm.ci.amd64.AMD64Kind)3 ValueUtil.isAllocatableValue (jdk.vm.ci.code.ValueUtil.isAllocatableValue)3