+2004-08-04 Jan Hubicka <jh@suse.cz>
+
+ * basic-block.h (profile_staus): New global variable.
+ * cfg.c (profile_status): Declare.
+ (check_bb_profile): Break out from ....; use profile_status
+ (dump_flow_info): ... here.
+ * cfgbuild.c (find_basic_blocks): Set profile_status.
+ * cfgexpand.c (tree_expand_cfg): Likewise.
+ * predict.c (estimate_probability): Likewise.
+ * profile.c (branch_prob): Likewise.
+ * tree-cfg.c (build_tree_cfg): Likewise.
+ (dump_function_to_file): Use check_bb_profile.
+ * tree-pretty-print (dump_bb_header): Likewise.
+ * tree-profile.c (do_tree_profiling): Cleanup.
+
2004-08-04 Zack Weinberg <zack@codesourcery.com>
* Makefile.in (RTL_BASE_H, RTL_H): Correct.
void debug_flow_info (void);
static void free_edge (edge);
+
+/* Indicate the presence of the profile. */
+enum profile_status profile_status;
\f
/* Called once at initialization time. */
bb->flags = 0;
}
\f
+/* Check the consistency of profile information. We can't do that
+ in verify_flow_info, as the counts may get invalid for incompletely
+ solved graphs, later eliminating of conditionals or roundoff errors.
+ It is still practical to have them reported for debugging of simple
+ testcases. */
+void
+check_bb_profile (basic_block bb, FILE * file)
+{
+ edge e;
+ int sum = 0;
+ gcov_type lsum;
+
+ if (profile_status == PROFILE_ABSENT)
+ return;
+
+ if (bb != EXIT_BLOCK_PTR)
+ {
+ for (e = bb->succ; e; e = e->succ_next)
+ sum += e->probability;
+ if (bb->succ && abs (sum - REG_BR_PROB_BASE) > 100)
+ fprintf (file, "Invalid sum of outgoing probabilities %.1f%%\n",
+ sum * 100.0 / REG_BR_PROB_BASE);
+ lsum = 0;
+ for (e = bb->succ; e; e = e->succ_next)
+ lsum += e->count;
+ if (bb->succ && (lsum - bb->count > 100 || lsum - bb->count < -100))
+ fprintf (file, "Invalid sum of outgoing counts %i, should be %i\n",
+ (int) lsum, (int) bb->count);
+ }
+ if (bb != ENTRY_BLOCK_PTR)
+ {
+ sum = 0;
+ for (e = bb->pred; e; e = e->pred_next)
+ sum += EDGE_FREQUENCY (e);
+ if (abs (sum - bb->frequency) > 100)
+ fprintf (file,
+ "Invalid sum of incomming frequencies %i, should be %i\n",
+ sum, bb->frequency);
+ lsum = 0;
+ for (e = bb->pred; e; e = e->pred_next)
+ lsum += e->count;
+ if (lsum - bb->count > 100 || lsum - bb->count < -100)
+ fprintf (file, "Invalid sum of incomming counts %i, should be %i\n",
+ (int) lsum, (int) bb->count);
+ }
+}
+\f
void
dump_flow_info (FILE *file)
{
FOR_EACH_BB (bb)
{
edge e;
- int sum;
- gcov_type lsum;
fprintf (file, "\nBasic block %d ", bb->index);
fprintf (file, "prev %d, next %d, ",
fprintf (file, "\nRegisters live at end:");
dump_regset (bb->global_live_at_end, file);
-
+
putc ('\n', file);
- /* Check the consistency of profile information. We can't do that
- in verify_flow_info, as the counts may get invalid for incompletely
- solved graphs, later eliminating of conditionals or roundoff errors.
- It is still practical to have them reported for debugging of simple
- testcases. */
- sum = 0;
- for (e = bb->succ; e; e = e->succ_next)
- sum += e->probability;
- if (bb->succ && abs (sum - REG_BR_PROB_BASE) > 100)
- fprintf (file, "Invalid sum of outgoing probabilities %.1f%%\n",
- sum * 100.0 / REG_BR_PROB_BASE);
- sum = 0;
- for (e = bb->pred; e; e = e->pred_next)
- sum += EDGE_FREQUENCY (e);
- if (abs (sum - bb->frequency) > 100)
- fprintf (file,
- "Invalid sum of incomming frequencies %i, should be %i\n",
- sum, bb->frequency);
- lsum = 0;
- for (e = bb->pred; e; e = e->pred_next)
- lsum += e->count;
- if (lsum - bb->count > 100 || lsum - bb->count < -100)
- fprintf (file, "Invalid sum of incomming counts %i, should be %i\n",
- (int)lsum, (int)bb->count);
- lsum = 0;
- for (e = bb->succ; e; e = e->succ_next)
- lsum += e->count;
- if (bb->succ && (lsum - bb->count > 100 || lsum - bb->count < -100))
- fprintf (file, "Invalid sum of incomming counts %i, should be %i\n",
- (int)lsum, (int)bb->count);
+ if (bb->global_live_at_start)
+ {
+ fprintf (file, "\nRegisters live at start:");
+ dump_regset (bb->global_live_at_start, file);
+ }
+
+ if (bb->global_live_at_end)
+ {
+ fprintf (file, "\nRegisters live at end:");
+ dump_regset (bb->global_live_at_end, file);
+ }
+
+ putc ('\n', file);
+ check_bb_profile (bb, file);
}
putc ('\n', file);