aboutsummaryrefslogtreecommitdiff
path: root/gcc/jump.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2001-06-10 00:39:25 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2001-06-09 22:39:25 +0000
commit4db384c950ec85ca96e4bcaf7b00c36f2f6ccbd5 (patch)
treec28f4818b4bed04584e0f35d196aab217d30a449 /gcc/jump.c
parent5bb8dd28b87e7894d3dd5e03eacb09b975bbf0ca (diff)
downloadgcc-4db384c950ec85ca96e4bcaf7b00c36f2f6ccbd5.zip
gcc-4db384c950ec85ca96e4bcaf7b00c36f2f6ccbd5.tar.gz
gcc-4db384c950ec85ca96e4bcaf7b00c36f2f6ccbd5.tar.bz2
predict.def: New file.
* 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. From-SVN: r43115
Diffstat (limited to 'gcc/jump.c')
-rw-r--r--gcc/jump.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/gcc/jump.c b/gcc/jump.c
index feb7b4d..067b7aa 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;
}