summaryrefslogtreecommitdiff
path: root/gcc/predict.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2006-11-11 17:54:57 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2006-11-11 16:54:57 +0000
commitef950eba664843fe4cb27c6d85809e84189b1381 (patch)
tree9d45a239029f3b75636cf09bd64a3c4a7e6031d7 /gcc/predict.c
parent89fa98d6b981d00d1f753f010e0747c8024a0441 (diff)
downloadgcc-ef950eba664843fe4cb27c6d85809e84189b1381.tar.gz
extended.texi (__builtin_expect): We no longer require second argument to be constant.
* extended.texi (__builtin_expect): We no longer require second argument to be constant. * gengtype.c (adjust_field_rtx_def): Drop NOTE_INSN_EXPECTED_VALUE. * builtins.c (expand_builtin_expect): Simplify. (expand_builtin_expect_jump): Kill. * final.c (final_scan_insn): Do not skip the removed notes. * insn-notes.def (LOOP_BEG, LOOP_END, REPEATED_LINE_NUMBER, EXPECTED_VALUE): Remove. * dojump.c (do_jump): Do not care about __builtin_expect. * predict.c (expected_value_to_br_prob): Kill. * function.c (expand_function_end): Do not expand NOTE_INSN_REPEATED_LINE_NUMBER. * print-rtl.c (print_rtx): Do not pretty print the removed notes. * expect.c (sjlj_emit_function_enter): Emit directly branch probability. * cfgexpand.c (add_reg_br_prob_note): Export. * cfgcleanup.c (rest_of_handle_jump2): Do not call expected_value_to_br_prob. * cfglayout.c (duplicate_insn_chain): Do not deal with removed notes. * rtl.h (add_reg_br_prob_note): Declare. From-SVN: r118696
Diffstat (limited to 'gcc/predict.c')
-rw-r--r--gcc/predict.c73
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