Search in sources :

Example 1 with ConditionalBranchProfile

use of org.jikesrvm.compilers.baseline.ConditionalBranchProfile in project JikesRVM by JikesRVM.

the class GenerationContext method getConditionalBranchProfileOperand.

// /////////
// Profile data
// /////////
BranchProfileOperand getConditionalBranchProfileOperand(int bcIndex, boolean backwards) {
    float prob;
    BranchProfile bp;
    if (branchProfiles != null && ((bp = branchProfiles.getEntry(bcIndex)) != null)) {
        prob = ((ConditionalBranchProfile) bp).getTakenProbability();
    } else {
        if (branchProfiles != null) {
            VM.sysWrite("Warning: conditional branch profile entry not found");
        }
        if (backwards) {
            prob = 0.9f;
        } else {
            prob = 0.5f;
        }
    }
    // we were completely wrong.
    if (options.inverseFrequencyCounters()) {
        prob = 1f - prob;
    }
    return new BranchProfileOperand(prob);
}
Also used : BranchProfile(org.jikesrvm.compilers.baseline.BranchProfile) ConditionalBranchProfile(org.jikesrvm.compilers.baseline.ConditionalBranchProfile) SwitchBranchProfile(org.jikesrvm.compilers.baseline.SwitchBranchProfile) BranchProfileOperand(org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand)

Aggregations

BranchProfile (org.jikesrvm.compilers.baseline.BranchProfile)1 ConditionalBranchProfile (org.jikesrvm.compilers.baseline.ConditionalBranchProfile)1 SwitchBranchProfile (org.jikesrvm.compilers.baseline.SwitchBranchProfile)1 BranchProfileOperand (org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand)1