+Sat Jun 23 01:16:42 CEST 2001 Jan Hubicka <jh@suse.cz>
+
+ * predict.c (block_info_def): Add nvisited.
+ (propagate_freq): Count nvisited; re-queue delayed blocks; handle
+ irreducible regions.
+
+ * flow.c (dump_edge_info): Dump the probability of edge.
+ (combine_predictions_for_insn): Dump the basic block.
+
2001-06-22 Joseph S. Myers <jsm28@cam.ac.uk>
* doc/gcc.texi: Update documentation of source files of C
int best_predictor = END_PREDICTORS;
if (rtl_dump_file)
- fprintf (rtl_dump_file, "Predictions for insn %i\n", INSN_UID (insn));
+ fprintf (rtl_dump_file, "Predictions for insn %i bb %i\n", INSN_UID (insn),
+ bb->index);
/* We implement "first match" heuristics and use probability guessed
by predictor with smallest index. In future we will use better
/* True if block already converted. */
int visited:1;
+
+ /* Number of block proceeded before adding basic block to the queue. Used
+ to recognize irregular regions. */
+ int nvisited;
} *block_info;
/* Similar information for edges. */
basic_block last = bb;
edge e;
basic_block nextbb;
+ int nvisited = 0;
BLOCK_INFO (head)->frequency = 1;
for (; bb; bb = nextbb)
{
for (e = bb->pred; e; e = e->pred_next)
if (!BLOCK_INFO (e->src)->visited && !EDGE_INFO (e)->back_edge)
+ break;
+
+ /* We didn't proceeded all predecesors of edge e yet. These may
+ be waiting in the queue or we may hit irreducible region.
+
+ To avoid infinite looping on irrecudible regions, count number
+ of block proceeded at the time basic block has been queued. In the
+ case number didn't changed, we've hit irreducible region and we
+ forget the backward edge. This can increase time complexity
+ by the number of irreducible blocks, but in same way standard the
+ loop does, so it should not result in noticeable slowodwn.
+
+ Alternativly we may distinquish backward and cross edges in the
+ DFS tree by preprocesing pass and ignore existence of non-loop
+ backward edges. */
+ if (e && BLOCK_INFO (bb)->nvisited != nvisited)
+ {
+ if (!nextbb)
+ nextbb = e->dest;
+ else
+ BLOCK_INFO (last)->next = e->dest;
+ BLOCK_INFO (last)->nvisited = nvisited;
+ last = e->dest;
continue;
+ }
+ else if (e && rtl_dump_file)
+ fprintf (rtl_dump_file, "Irreducible region hit, ignoring edge to bb %i\n",
+ bb->index);
for (e = bb->pred; e; e = e->pred_next)
if (EDGE_INFO (e)->back_edge)
cyclic_probability += EDGE_INFO (e)->back_edge_prob;
- else
+ else if (BLOCK_INFO (e->src)->visited)
frequency += (e->probability
* BLOCK_INFO (e->src)->frequency /
REG_BR_PROB_BASE);
nextbb = e->dest;
else
BLOCK_INFO (last)->next = e->dest;
+ BLOCK_INFO (last)->nvisited = nvisited;
last = e->dest;
}
+ nvisited ++;
}
}