summaryrefslogtreecommitdiff
path: root/gcc/predict.c
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-21 18:57:09 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-21 18:57:09 +0000
commit24049db97c735788356e1e84cd572237e3242bec (patch)
treed4da6fa4c9e5c2b532917701f2d280cf5b10c01a /gcc/predict.c
parentcd45159c7ce27cd0eb6412c0cbbc6c2450bd95bf (diff)
downloadgcc-24049db97c735788356e1e84cd572237e3242bec.tar.gz
* rtl.h (insn_note): Remove NOTE_INSN_PREDICTION.
* rtl.c (note_insn_name): Likewise. * print-rtl.c (print_rtx): Don't print it. * cfgrtl.h (can_delete_note_p): Don't handle it. (rtl_delete_block): Likewise. * passes.c (rest_of_handle_guess_branch_prob): Remove. (rest_of_compilation): Don't call it. * predict.c (process_note_predictions, process_note_prediction, note_prediction_to_br_prob): Remove. * basic-block.c (note_prediction_to_br_prob): Remove prototype. * stmt.c (return_prediction): Remove. (expand_value_return): Don't call it. Don't add prediction notes for return statements. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85016 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/predict.c')
-rw-r--r--gcc/predict.c146
1 files changed, 0 insertions, 146 deletions
diff --git a/gcc/predict.c b/gcc/predict.c
index 49d2c612063..c92b27f8bdf 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -76,8 +76,6 @@ static void estimate_loops_at_level (struct loop *loop);
static void propagate_freq (struct loop *);
static void estimate_bb_frequencies (struct loops *);
static int counts_to_freqs (void);
-static void process_note_predictions (basic_block, int *);
-static void process_note_prediction (basic_block, int *, int, int);
static bool last_basic_block_p (basic_block);
static void compute_function_frequency (void);
static void choose_function_section (void);
@@ -1078,150 +1076,6 @@ last_basic_block_p (basic_block bb)
&& bb->succ && !bb->succ->succ_next
&& bb->succ->dest->next_bb == EXIT_BLOCK_PTR));
}
-
-/* Sets branch probabilities according to PREDiction and
- FLAGS. HEADS[bb->index] should be index of basic block in that we
- need to alter branch predictions (i.e. the first of our dominators
- such that we do not post-dominate it) (but we fill this information
- on demand, so -1 may be there in case this was not needed yet). */
-
-static void
-process_note_prediction (basic_block bb, int *heads, int pred, int flags)
-{
- edge e;
- int y;
- bool taken;
-
- taken = flags & IS_TAKEN;
-
- if (heads[bb->index] < 0)
- {
- /* This is first time we need this field in heads array; so
- find first dominator that we do not post-dominate (we are
- using already known members of heads array). */
- basic_block ai = bb;
- basic_block next_ai = get_immediate_dominator (CDI_DOMINATORS, bb);
- int head;
-
- while (heads[next_ai->index] < 0)
- {
- if (!dominated_by_p (CDI_POST_DOMINATORS, next_ai, bb))
- break;
- heads[next_ai->index] = ai->index;
- ai = next_ai;
- next_ai = get_immediate_dominator (CDI_DOMINATORS, next_ai);
- }
- if (!dominated_by_p (CDI_POST_DOMINATORS, next_ai, bb))
- head = next_ai->index;
- else
- head = heads[next_ai->index];
- while (next_ai != bb)
- {
- next_ai = ai;
- if (heads[ai->index] == ENTRY_BLOCK)
- ai = ENTRY_BLOCK_PTR;
- else
- ai = BASIC_BLOCK (heads[ai->index]);
- heads[next_ai->index] = head;
- }
- }
- y = heads[bb->index];
-
- /* Now find the edge that leads to our branch and aply the prediction. */
-
- if (y == last_basic_block || !can_predict_insn_p (BB_END (BASIC_BLOCK (y))))
- return;
- for (e = BASIC_BLOCK (y)->succ; e; e = e->succ_next)
- if (e->dest->index >= 0
- && dominated_by_p (CDI_POST_DOMINATORS, e->dest, bb))
- predict_edge_def (e, pred, taken);
-}
-
-/* Gathers NOTE_INSN_PREDICTIONs in given basic block and turns them
- into branch probabilities. For description of heads array, see
- process_note_prediction. */
-
-static void
-process_note_predictions (basic_block bb, int *heads)
-{
- rtx insn;
- edge e;
-
- /* Additionally, we check here for blocks with no successors. */
- int contained_noreturn_call = 0;
- int was_bb_head = 0;
- int noreturn_block = 1;
-
- for (insn = BB_END (bb); insn;
- was_bb_head |= (insn == BB_HEAD (bb)), insn = PREV_INSN (insn))
- {
- if (!NOTE_P (insn))
- {
- if (was_bb_head)
- break;
- else
- {
- /* Noreturn calls cause program to exit, therefore they are
- always predicted as not taken. */
- if (CALL_P (insn)
- && find_reg_note (insn, REG_NORETURN, NULL))
- contained_noreturn_call = 1;
- continue;
- }
- }
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_PREDICTION)
- {
- int alg = (int) NOTE_PREDICTION_ALG (insn);
- /* Process single prediction note. */
- process_note_prediction (bb,
- heads,
- alg, (int) NOTE_PREDICTION_FLAGS (insn));
- delete_insn (insn);
- }
- }
- for (e = bb->succ; e; e = e->succ_next)
- if (!(e->flags & EDGE_FAKE))
- noreturn_block = 0;
- if (contained_noreturn_call)
- {
- /* This block ended from other reasons than because of return.
- If it is because of noreturn call, this should certainly not
- be taken. Otherwise it is probably some error recovery. */
- process_note_prediction (bb, heads, PRED_NORETURN, NOT_TAKEN);
- }
-}
-
-/* Gathers NOTE_INSN_PREDICTIONs and turns them into
- branch probabilities. */
-
-void
-note_prediction_to_br_prob (void)
-{
- basic_block bb;
- int *heads;
-
- /* To enable handling of noreturn blocks. */
- add_noreturn_fake_exit_edges ();
- connect_infinite_loops_to_exit ();
-
- calculate_dominance_info (CDI_POST_DOMINATORS);
- calculate_dominance_info (CDI_DOMINATORS);
-
- heads = xmalloc (sizeof (int) * last_basic_block);
- memset (heads, -1, sizeof (int) * last_basic_block);
- heads[ENTRY_BLOCK_PTR->next_bb->index] = last_basic_block;
-
- /* Process all prediction notes. */
-
- FOR_EACH_BB (bb)
- process_note_predictions (bb, heads);
-
- free_dominance_info (CDI_POST_DOMINATORS);
- free_dominance_info (CDI_DOMINATORS);
- free (heads);
-
- remove_fake_exit_edges ();
-}
/* This is used to carry information about basic blocks. It is
attached to the AUX field of the standard CFG block. */