diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-09 22:39:25 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-09 22:39:25 +0000 |
commit | 13488c51ead5a1730406328e101a31c7d4e7f38d (patch) | |
tree | c28f4818b4bed04584e0f35d196aab217d30a449 /gcc/jump.c | |
parent | 6d817618ed0cf9f607120db62f90ac8e9ec3146e (diff) | |
download | gcc-13488c51ead5a1730406328e101a31c7d4e7f38d.tar.gz |
* predict.def: New file.
* predict.h: New file.
* predict.c: Include predict.h.
(predictor_info): New structure and array.
(predict_edge, predict_insn): Rewrite; make global.
(predict_edge_def, predict_insn_def): New global functions.
(dump_prediction, combine_predictions_for_insns): New
static functions.
(estimate_probability): Change calls to predict_edge
to predict_edge_def and calls to predict_insn to predict_insn_def;
combine probabilities.
(expected_value_to_br_prob): Behave as predictor.
* rtl.h (REG_BR_PRED): Update coment.
(invert_br_probabilities): New.
* jump.c: Include predict.h
(duplicate_loop_exit_test): Drop branch prediction notes.
(invert_jump): Use invert_br_probabilities.
* Makefile.in: Add dependancy on predict.h for jump and predict pass.
* ifcvt.c (dead_or_predicable): Use invert_br_probabilities.
* combine.c (distribute_notes): Handle BR_PRED.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43115 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/jump.c')
-rw-r--r-- | gcc/jump.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/gcc/jump.c b/gcc/jump.c index feb7b4d8ca3..067b7aafcdc 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -67,6 +67,7 @@ Boston, MA 02111-1307, USA. */ #include "except.h" #include "toplev.h" #include "reload.h" +#include "predict.h" /* ??? Eventually must record somehow the labels used by jumps from nested functions. */ @@ -1248,6 +1249,23 @@ duplicate_loop_exit_test (loop_start) replace_regs (REG_NOTES (copy), reg_map, max_reg, 1); } + /* Predict conditional jump that do make loop looping as taken. + Other jumps are probably exit conditions, so predict + them as untaken. */ + if (any_condjump_p (copy)) + { + rtx label = JUMP_LABEL (copy); + if (label) + { + if (PREV_INSN (label) + && GET_CODE (PREV_INSN (label)) == NOTE + && (NOTE_LINE_NUMBER (PREV_INSN (label)) + == NOTE_INSN_LOOP_CONT)) + predict_insn_def (copy, PRED_LOOP_HEADER, TAKEN); + else + predict_insn_def (copy, PRED_LOOP_HEADER, NOT_TAKEN); + } + } /* If this is a simple jump, add it to the jump chain. */ if (INSN_UID (copy) < max_jump_chain && JUMP_LABEL (copy) @@ -3351,13 +3369,7 @@ invert_jump (jump, nlabel, delete_unused) if (redirect_jump (jump, nlabel, delete_unused)) { - /* An inverted jump means that a probability taken becomes a - probability not taken. Subtract the branch probability from the - probability base to convert it back to a taken probability. */ - - rtx note = find_reg_note (jump, REG_BR_PROB, NULL_RTX); - if (note) - XEXP (note, 0) = GEN_INT (REG_BR_PROB_BASE - INTVAL (XEXP (note, 0))); + invert_br_probabilities (jump); return 1; } |