Search in sources :

Example 56 with Variable

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

the class SPARCLIRGenerator method emitZeroExtendLoad.

public Value emitZeroExtendLoad(LIRKind kind, LIRKind resultKind, Value address, LIRFrameState state) {
    SPARCAddressValue loadAddress = asAddressValue(address);
    Variable result = newVariable(resultKind);
    append(new LoadOp(kind.getPlatformKind(), result, loadAddress, state));
    return result;
}
Also used : Variable(org.graalvm.compiler.lir.Variable) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) LoadOp(org.graalvm.compiler.lir.sparc.SPARCMove.LoadOp)

Example 57 with Variable

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

the class SPARCLIRGenerator method emitIntegerTestMove.

@Override
public Variable emitIntegerTestMove(Value left, Value right, Value trueValue, Value falseValue) {
    emitIntegerTest(left, right);
    Variable result = newVariable(trueValue.getValueKind());
    ConditionFlag flag = SPARCControlFlow.fromCondition(true, Condition.EQ, false);
    CC cc = CC.forKind(left.getPlatformKind());
    append(new CondMoveOp(MOVicc, cc, flag, loadSimm11(trueValue), loadSimm11(falseValue), result));
    return result;
}
Also used : FMOVSCC(org.graalvm.compiler.asm.sparc.SPARCAssembler.FMOVSCC) CC(org.graalvm.compiler.asm.sparc.SPARCAssembler.CC) FMOVDCC(org.graalvm.compiler.asm.sparc.SPARCAssembler.FMOVDCC) Variable(org.graalvm.compiler.lir.Variable) CondMoveOp(org.graalvm.compiler.lir.sparc.SPARCControlFlow.CondMoveOp) ConditionFlag(org.graalvm.compiler.asm.sparc.SPARCAssembler.ConditionFlag)

Example 58 with Variable

use of org.graalvm.compiler.lir.Variable 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 59 with Variable

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

the class SPARCLIRGenerator method emitConditionalMove.

@Override
public Variable emitConditionalMove(PlatformKind cmpKind, Value left, Value right, Condition cond, boolean unorderedIsTrue, Value trueValue, Value falseValue) {
    // Emit compare
    SPARCKind cmpSPARCKind = (SPARCKind) cmpKind;
    boolean mirrored = emitCompare(cmpSPARCKind, left, right);
    // Emit move
    Value actualTrueValue = trueValue;
    Value actualFalseValue = falseValue;
    SPARCKind valueKind = (SPARCKind) trueValue.getPlatformKind();
    CMOV cmove;
    if (valueKind.isFloat()) {
        // Floats cannot be immediate at all
        actualTrueValue = load(trueValue);
        actualFalseValue = load(falseValue);
        cmove = valueKind.equals(SINGLE) ? FMOVSCC : FMOVDCC;
    } else if (valueKind.isInteger()) {
        actualTrueValue = loadSimm11(trueValue);
        actualFalseValue = loadSimm11(falseValue);
        cmove = MOVicc;
    } else {
        throw GraalError.shouldNotReachHere();
    }
    Variable result = newVariable(trueValue.getValueKind());
    ConditionFlag finalCondition = SPARCControlFlow.fromCondition(cmpSPARCKind.isInteger(), mirrored ? cond.mirror() : cond, unorderedIsTrue);
    CC cc = CC.forKind(cmpSPARCKind);
    append(new CondMoveOp(cmove, cc, finalCondition, actualTrueValue, actualFalseValue, result));
    return result;
}
Also used : FMOVSCC(org.graalvm.compiler.asm.sparc.SPARCAssembler.FMOVSCC) CC(org.graalvm.compiler.asm.sparc.SPARCAssembler.CC) FMOVDCC(org.graalvm.compiler.asm.sparc.SPARCAssembler.FMOVDCC) Variable(org.graalvm.compiler.lir.Variable) 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) CondMoveOp(org.graalvm.compiler.lir.sparc.SPARCControlFlow.CondMoveOp) SPARCKind(jdk.vm.ci.sparc.SPARCKind) CMOV(org.graalvm.compiler.asm.sparc.SPARCAssembler.CMOV) ConditionFlag(org.graalvm.compiler.asm.sparc.SPARCAssembler.ConditionFlag)

Example 60 with Variable

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

the class SPARCLIRGenerator method emitTableSwitch.

@Override
protected void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, Value key) {
    // Making a copy of the switch value is necessary because jump table destroys the input
    // value
    Variable tmp = newVariable(key.getValueKind());
    emitMove(tmp, key);
    append(new TableSwitchOp(lowKey, defaultTarget, targets, tmp, newVariable(LIRKind.value(target().arch.getWordKind()))));
}
Also used : Variable(org.graalvm.compiler.lir.Variable) TableSwitchOp(org.graalvm.compiler.lir.sparc.SPARCControlFlow.TableSwitchOp)

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