use of org.graalvm.compiler.asm.sparc.SPARCAssembler.BranchPredict in project graal by oracle.
the class SPARCControlFlow method emitBranch.
private static boolean emitBranch(CompilationResultBuilder crb, SPARCMacroAssembler masm, SPARCKind kind, ConditionFlag conditionFlag, LabelRef trueDestination, LabelRef falseDestination, boolean withDelayedNop, double trueDestinationProbability) {
Label actualTarget;
ConditionFlag actualConditionFlag;
boolean needJump;
BranchPredict predictTaken;
if (falseDestination != null && crb.isSuccessorEdge(trueDestination)) {
actualConditionFlag = conditionFlag != null ? conditionFlag.negate() : null;
actualTarget = falseDestination.label();
needJump = false;
predictTaken = trueDestinationProbability < .5d ? PREDICT_TAKEN : PREDICT_NOT_TAKEN;
} else {
actualConditionFlag = conditionFlag;
actualTarget = trueDestination.label();
needJump = falseDestination != null && !crb.isSuccessorEdge(falseDestination);
predictTaken = trueDestinationProbability > .5d ? PREDICT_TAKEN : PREDICT_NOT_TAKEN;
}
if (!withDelayedNop && needJump) {
// We cannot make use of the delay slot when we jump in true-case and false-case
return false;
}
if (kind.isFloat()) {
FBPCC.emit(masm, Fcc0, actualConditionFlag, NOT_ANNUL, predictTaken, actualTarget);
} else {
assert kind.isInteger();
CC cc = kind.equals(WORD) ? Icc : Xcc;
BPCC.emit(masm, cc, actualConditionFlag, NOT_ANNUL, predictTaken, actualTarget);
}
if (withDelayedNop) {
// delay slot
masm.nop();
}
if (needJump) {
masm.jmp(falseDestination.label());
}
return true;
}
Aggregations