{
struct sourcefile *s_ptr = NULL;
char *ptr;
- int count;
+ long count;
long line_num;
/* Search the bb_data to find:
struct arcdata **branch_probs;
int last_line_num;
{
- int total;
+ gcov_type total;
struct adj_list *arcptr;
struct arcdata *end_ptr, *a_ptr;
char *source_file_name;
FILE *source_file;
struct bb_info_list *current_graph;
- int count;
+ long count;
char *cptr;
long block_num;
long line_num;
else
{
if (output_branch_counts)
- fnotice (gcov_file,
- "call %d returns = "
- HOST_WIDEST_INT_PRINT_DEC "\n",
- i, a_ptr->total - a_ptr->hits);
+ {
+ char c[20];
+ sprintf (c, HOST_WIDEST_INT_PRINT_DEC,
+ a_ptr->total - a_ptr->hits);
+ fnotice (gcov_file,
+ "call %d returns = %s\n", i, c);
+ }
else
- fnotice (gcov_file,
- "call %d returns = "
- HOST_WIDEST_INT_PRINT_DEC "%%\n",
- i, 100 - ((a_ptr->hits * 100) +
- (a_ptr->total >> 1))/a_ptr->total);
+ {
+ char c[20];
+ sprintf (c, HOST_WIDEST_INT_PRINT_DEC,
+ 100 - ((a_ptr->hits * 100)
+ + (a_ptr->total >> 1))
+ / a_ptr->total);
+ fnotice (gcov_file,
+ "call %d returns = %s%%\n", i, c);
+ }
}
}
else
else
{
if (output_branch_counts)
- fnotice (gcov_file,
- "branch %d taken = "
- HOST_WIDEST_INT_PRINT_DEC "\n",
- i, a_ptr->hits);
+ {
+ char c[20];
+ sprintf (c, HOST_WIDEST_INT_PRINT_DEC,
+ a_ptr->hits);
+ fnotice (gcov_file,
+ "branch %d taken = %s\n", i, c);
+ }
else
+ {
+ char c[20];
+ sprintf (c, HOST_WIDEST_INT_PRINT_DEC,
+ ((a_ptr->hits * 100)
+ + (a_ptr->total >> 1))
+ / a_ptr->total);
fnotice (gcov_file,
- "branch %d taken = "
- HOST_WIDEST_INT_PRINT_DEC "%%\n", i,
- ((a_ptr->hits * 100) +
- (a_ptr->total >> 1))/
- a_ptr->total);
-
+ "branch %d taken = %s%%\n", i, c);
+ }
}
}
}
bb->index);
/* We implement "first match" heuristics and use probability guessed
- by predictor with smallest index. In future we will use better
+ by predictor with smallest index. In the future we will use better
probability combination techniques. */
while (*pnote)
{
{
int header_found = 0;
edge e;
-
- /* Loop branch heruistics - predict as taken an edge back to
+
+ /* Loop branch heuristics - predict as taken an edge back to
a loop's head. */
for (e = BASIC_BLOCK(j)->succ; e; e = e->succ_next)
if (e->dest == loops_info->array[i].header
header_found = 1;
predict_edge_def (e, PRED_LOOP_BRANCH, TAKEN);
}
- /* Loop exit heruistics - predict as not taken an edge exiting
- the loop if the conditinal has no loop header successors */
+ /* Loop exit heuristics - predict as not taken an edge
+ exiting the loop if the conditinal has no loop header
+ successors. */
if (!header_found)
for (e = BASIC_BLOCK(j)->succ; e; e = e->succ_next)
if (e->dest->index <= 0
&& (XEXP (cond, 1) == const0_rtx
|| (GET_CODE (XEXP (cond, 1)) == REG
&& REG_POINTER (XEXP (cond, 1)))))
-
+
predict_insn_def (last_insn, PRED_POINTER, NOT_TAKEN);
break;
case NE:
}
\f
/* __builtin_expect dropped tokens into the insn stream describing
- expected values of registers. Generate branch probabilities
+ expected values of registers. Generate branch probabilities
based off these values. */
void
(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
+ 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 (PATTERN (insn)), 0);
|| GET_CODE (XEXP (cond, 1)) != CONST_INT)
continue;
- /* Substitute and simplify. Given that the expression we're
+ /* 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,
}
}
\f
-/* This is used to carry information about basic blocks. It is
+/* This is used to carry information about basic blocks. It is
attached to the AUX field of the standard CFG block. */
typedef struct block_info_def
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. */
+ /* We haven't proceeded all predecessors of edge e yet.
+ These may be waiting in the queue or we may hit an
+ irreducible region.
+
+ To avoid infinite looping on irrecudible regions, count
+ the number of blocks proceeded at the time the basic
+ block has been queued. In the case the number doesn't
+ change, we've hit an irreducible region and we can forget
+ the backward edge. This can increase the time complexity
+ by the number of irreducible blocks, but in the same way
+ the standard the loop does, so it should not result in a
+ noticeable slowdown.
+
+ Alternatively we may distinguish backward and cross edges
+ in the DFS tree by the preprocessing pass and ignore the
+ existence of non-loop backward edges. */
if (e && BLOCK_INFO (bb)->nvisited != nvisited)
{
if (!nextbb)
* BLOCK_INFO (bb)->frequency
/ REG_BR_PROB_BASE);
- /* Propagate to succesor blocks. */
+ /* Propagate to successor blocks. */
for (e = bb->succ; e; e = e->succ_next)
if (!EDGE_INFO (e)->back_edge
&& !BLOCK_INFO (e->dest)->visited
}
}
-/* Estimate probabilities of the loopback edges in loops at same nest level. */
+/* Estimate probabilities of loopback edges in loops at same nest level. */
static void
estimate_loops_at_level (first_loop)
struct loop *first_loop;
estimate_loops_at_level (loop->inner);
- /* find current loop back edge and mark it. */
+ /* Find current loop back edge and mark it. */
for (e = loop->latch->succ; e->dest != loop->header; e = e->succ_next);
EDGE_INFO (e)->back_edge = 1;
- /* In case loop header is shared, ensure that it is the last one sharing
- same header, so we avoid redundant work. */
+ /* In case the loop header is shared, ensure that it is the last
+ one sharing the same header, so we avoid redundant work. */
if (loop->shared)
{
for (l = loop->next; l; l = l->next)
edge fallthru, branch;
if (GET_CODE (last_insn) != JUMP_INSN || !any_condjump_p (last_insn)
- /* Avoid handling of conditionals jump jumping to fallthru edge. */
+ /* Avoid handling of conditional jumps jumping to fallthru edge. */
|| BASIC_BLOCK (i)->succ->succ_next == NULL)
{
/* We can predict only conditional jumps at the moment.
- Expect each edge to be equall probable.
- ?? In future we want to make abnormal edges improbable. */
+ Expect each edge to be equally probable.
+ ?? In the future we want to make abnormal edges improbable. */
int nedges = 0;
edge e;