+ /* Check bb chain & numbers. */
+ last_bb_seen = ENTRY_BLOCK_PTR;
+ FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR->next_bb, NULL, next_bb)
+ {
+ if (bb != EXIT_BLOCK_PTR
+ && bb != BASIC_BLOCK (bb->index))
+ {
+ error ("bb %d on wrong place", bb->index);
+ err = 1;
+ }
+
+ if (bb->prev_bb != last_bb_seen)
+ {
+ error ("prev_bb of %d should be %d, not %d",
+ bb->index, last_bb_seen->index, bb->prev_bb->index);
+ err = 1;
+ }
+
+ /* For now, also check that we didn't change the order. */
+ if (bb != EXIT_BLOCK_PTR && bb->index != last_bb_seen->index + 1)
+ {
+ error ("Wrong order of blocks %d and %d",
+ last_bb_seen->index, bb->index);
+ err = 1;
+ }
+
+ if (bb == EXIT_BLOCK_PTR && last_bb_seen->index != n_basic_blocks - 1)
+ {
+ error ("Only %d of %d blocks in chain",
+ last_bb_seen->index + 1, n_basic_blocks);
+ err = 1;
+ }
+
+ last_bb_seen = bb;
+ }
+