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;
}
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;
}
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));
}
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;
}
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()))));
}
Aggregations