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