use of jdk.vm.ci.meta.Value in project graal by oracle.
the class CFGPrinter method stateValueToString.
private String stateValueToString(ValueNode value) {
String result = nodeToString(value);
if (nodeLirGenerator != null && value != null && nodeLirGenerator.hasOperand(value)) {
Value operand = nodeLirGenerator.operand(value);
assert operand != null;
result += ": " + operand;
}
return result;
}
use of jdk.vm.ci.meta.Value in project graal by oracle.
the class SPARCArithmeticLIRGenerator method emitZeroExtend.
@Override
public Value emitZeroExtend(Value inputValue, int fromBits, int toBits) {
assert fromBits <= toBits && toBits <= 64;
if (fromBits == toBits) {
return inputValue;
}
Variable result = getLIRGen().newVariable(LIRKind.combine(inputValue).changeType(toBits > WORD.getSizeInBits() ? XWORD : WORD));
AllocatableValue inputAllocatable = getLIRGen().asAllocatable(inputValue);
if (fromBits == 32) {
getLIRGen().append(new SPARCOP3Op(Srl, inputAllocatable, g0.asValue(), result));
} else {
Value mask = getLIRGen().emitConstant(LIRKind.value(XWORD), forLong(mask(fromBits)));
getLIRGen().append(new SPARCOP3Op(And, inputAllocatable, mask, result));
}
return result;
}
use of jdk.vm.ci.meta.Value in project graal by oracle.
the class SPARCArithmeticLIRGenerator method emitRem.
@Override
public Value emitRem(Value a, Value b, LIRFrameState state) {
Variable result = getLIRGen().newVariable(LIRKind.combine(a, b));
// Intermediate values
Variable q1;
Variable q2;
switch((SPARCKind) a.getPlatformKind()) {
case WORD:
// Sign extend a and b
Value as = emitSignExtend(a);
Value bs = emitSignExtend(b);
q1 = emitBinary(as.getValueKind(), Sdivx, as, bs, state);
q2 = emitBinary(as.getValueKind(), Mulx, q1, bs);
result = emitSub(as, q2, false);
break;
case XWORD:
q1 = emitBinary(result.getValueKind(), Sdivx, a, b, state);
q2 = emitBinary(result.getValueKind(), Mulx, q1, b);
result = emitSub(a, q2, false);
break;
case SINGLE:
ForeignCallLinkage fremCall = getLIRGen().getForeignCalls().lookupForeignCall(ARITHMETIC_FREM);
result = getLIRGen().emitForeignCall(fremCall, state, a, b);
break;
case DOUBLE:
ForeignCallLinkage dremCall = getLIRGen().getForeignCalls().lookupForeignCall(ARITHMETIC_DREM);
result = getLIRGen().emitForeignCall(dremCall, state, a, b);
break;
default:
throw GraalError.shouldNotReachHere("missing: " + a.getPlatformKind());
}
return result;
}
use of jdk.vm.ci.meta.Value 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 jdk.vm.ci.meta.Value 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;
}
Aggregations