diff options
Diffstat (limited to 'gcc/predict.c')
-rw-r--r-- | gcc/predict.c | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/gcc/predict.c b/gcc/predict.c index 966132293c5..5dd9e60b821 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -1340,79 +1340,6 @@ tree_estimate_probability (void) return 0; } -/* __builtin_expect dropped tokens into the insn stream describing expected - values of registers. Generate branch probabilities based off these - values. */ - -void -expected_value_to_br_prob (void) -{ - rtx insn, cond, ev = NULL_RTX, ev_reg = NULL_RTX; - - for (insn = get_insns (); insn ; insn = NEXT_INSN (insn)) - { - switch (GET_CODE (insn)) - { - case NOTE: - /* Look for expected value notes. */ - if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EXPECTED_VALUE) - { - ev = NOTE_EXPECTED_VALUE (insn); - ev_reg = XEXP (ev, 0); - delete_insn (insn); - } - continue; - - case CODE_LABEL: - /* Never propagate across labels. */ - ev = NULL_RTX; - continue; - - case JUMP_INSN: - /* Look for simple conditional branches. If we haven't got an - expected value yet, no point going further. */ - if (!JUMP_P (insn) || ev == NULL_RTX - || ! any_condjump_p (insn)) - continue; - break; - - default: - /* Look for insns that clobber the EV register. */ - if (ev && reg_set_p (ev_reg, insn)) - ev = NULL_RTX; - continue; - } - - /* Collect the branch condition, hopefully relative to EV_REG. */ - /* ??? At present we'll miss things like - (expected_value (eq r70 0)) - (set r71 -1) - (set r80 (lt r70 r71)) - (set pc (if_then_else (ne r80 0) ...)) - as canonicalize_condition will render this to us as - (lt r70, r71) - Could use cselib to try and reduce this further. */ - cond = XEXP (SET_SRC (pc_set (insn)), 0); - cond = canonicalize_condition (insn, cond, 0, NULL, ev_reg, - false, false); - if (! cond || XEXP (cond, 0) != ev_reg - || GET_CODE (XEXP (cond, 1)) != CONST_INT) - continue; - - /* Substitute and simplify. Given that the expression we're - building involves two constants, we should wind up with either - true or false. */ - cond = gen_rtx_fmt_ee (GET_CODE (cond), VOIDmode, - XEXP (ev, 1), XEXP (cond, 1)); - cond = simplify_rtx (cond); - - /* Turn the condition into a scaled branch probability. */ - gcc_assert (cond == const_true_rtx || cond == const0_rtx); - predict_insn_def (insn, PRED_BUILTIN_EXPECT, - cond == const_true_rtx ? TAKEN : NOT_TAKEN); - } -} - /* Check whether this is the last basic block of function. Commonly there is one extra common cleanup block. */ static bool |