Commit 740ce53d by Steven Bosscher Committed by Steven Bosscher

basic-block.h: Document BB_* flags.

        * basic-block.h: Document BB_* flags.
        * regrename.c (copyprop_hardreg_forward): Don't use BB_VISITED,
        use an sbitmap instead.
        * sched-rgn.c (compute_trg_info): Likewise.

From-SVN: r93779
parent 2184a120
2005-01-17 Steven Bosscher <stevenb@suse.de>
* basic-block.h: Document BB_* flags.
* regrename.c (copyprop_hardreg_forward): Don't use BB_VISITED,
use an sbitmap instead.
* sched-rgn.c (compute_trg_info): Likewise.
2005-01-17 Richard Sandiford <rsandifo@redhat.com> 2005-01-17 Richard Sandiford <rsandifo@redhat.com>
* config.gcc (mips64*-*-linux*): Set the default abi to n32. Remove * config.gcc (mips64*-*-linux*): Set the default abi to n32. Remove
......
...@@ -285,17 +285,47 @@ typedef struct reorder_block_def ...@@ -285,17 +285,47 @@ typedef struct reorder_block_def
#define BB_FREQ_MAX 10000 #define BB_FREQ_MAX 10000
/* Masks for basic_block.flags. */ /* Masks for basic_block.flags.
BB_VISITED should not be used by passes, it is used internally by
dfs_enumerate_from.
BB_HOT_PARTITION and BB_COLD_PARTITION should be preserved throughout
the compilation, so they are never cleared.
All other flags may be cleared by clear_bb_flags(). It is generally
a bad idea to rely on any flags being up-to-date. */
/* Set if insns in BB have are modified. Used for updating liveness info. */
#define BB_DIRTY 1 #define BB_DIRTY 1
/* Only set on blocks that have just been created by create_bb. */
#define BB_NEW 2 #define BB_NEW 2
/* Set by find_unreachable_blocks. Do not rely on this being set in any
pass. */
#define BB_REACHABLE 4 #define BB_REACHABLE 4
/* Used by dfs_enumerate_from to keep track of visited basic blocks. */
#define BB_VISITED 8 #define BB_VISITED 8
/* Set for blocks in an irreducible loop by loop analysis. */
#define BB_IRREDUCIBLE_LOOP 16 #define BB_IRREDUCIBLE_LOOP 16
/* Set on blocks that may actually not be single-entry single-exit block. */
#define BB_SUPERBLOCK 32 #define BB_SUPERBLOCK 32
#define BB_DISABLE_SCHEDULE 64
/* Set on basic blocks that the scheduler should not touch. This is used
by SMS to prevent other schedulers from messing with the loop schedule. */
#define BB_DISABLE_SCHEDULE 64
/* Set on blocks that should be put in a hot section. */
#define BB_HOT_PARTITION 128 #define BB_HOT_PARTITION 128
/* Set on blocks that should be put in a cold section. */
#define BB_COLD_PARTITION 256 #define BB_COLD_PARTITION 256
/* Dummy flag for convenience in the hot/cold partitioning code. */
#define BB_UNPARTITIONED 0 #define BB_UNPARTITIONED 0
/* Partitions, to be used when partitioning hot and cold basic blocks into /* Partitions, to be used when partitioning hot and cold basic blocks into
......
...@@ -1746,29 +1746,26 @@ copyprop_hardreg_forward (void) ...@@ -1746,29 +1746,26 @@ copyprop_hardreg_forward (void)
struct value_data *all_vd; struct value_data *all_vd;
bool need_refresh; bool need_refresh;
basic_block bb; basic_block bb;
sbitmap visited;
need_refresh = false; need_refresh = false;
all_vd = xmalloc (sizeof (struct value_data) * last_basic_block); all_vd = xmalloc (sizeof (struct value_data) * last_basic_block);
/* Clear all BB_VISITED flags. We use BB_VISITED flags to indicate visited = sbitmap_alloc (last_basic_block - (INVALID_BLOCK + 1));
whether we have processed a given basic block or not. Note that sbitmap_zero (visited);
we never put BB_VISITED flag on ENTRY_BLOCK_PTR throughout this
function because we want to call init_value_data for all
successors of ENTRY_BLOCK_PTR. */
FOR_ALL_BB (bb)
bb->flags &= ~BB_VISITED;
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
{ {
bb->flags |= BB_VISITED; SET_BIT (visited, bb->index - (INVALID_BLOCK + 1));
/* If a block has a single predecessor, that we've already /* If a block has a single predecessor, that we've already
processed, begin with the value data that was live at processed, begin with the value data that was live at
the end of the predecessor block. */ the end of the predecessor block. */
/* ??? Ought to use more intelligent queuing of blocks. */ /* ??? Ought to use more intelligent queuing of blocks. */
if (EDGE_COUNT (bb->preds) == 1 if (EDGE_COUNT (bb->preds) == 1
&& ((EDGE_PRED (bb, 0)->src->flags & BB_VISITED) != 0) && TEST_BIT (visited,
EDGE_PRED (bb, 0)->src->index - (INVALID_BLOCK + 1))
&& ! (EDGE_PRED (bb, 0)->flags & (EDGE_ABNORMAL_CALL | EDGE_EH))) && ! (EDGE_PRED (bb, 0)->flags & (EDGE_ABNORMAL_CALL | EDGE_EH)))
all_vd[bb->index] = all_vd[EDGE_PRED (bb, 0)->src->index]; all_vd[bb->index] = all_vd[EDGE_PRED (bb, 0)->src->index];
else else
...@@ -1778,11 +1775,7 @@ copyprop_hardreg_forward (void) ...@@ -1778,11 +1775,7 @@ copyprop_hardreg_forward (void)
need_refresh = true; need_refresh = true;
} }
/* Clear BB_VISITED flag on each basic block. We do not need to sbitmap_free (visited);
clear the one on ENTRY_BLOCK_PTR because it's already cleared
above. */
FOR_EACH_BB (bb)
bb->flags &= ~BB_VISITED;
if (need_refresh) if (need_refresh)
{ {
......
...@@ -997,6 +997,7 @@ compute_trg_info (int trg) ...@@ -997,6 +997,7 @@ compute_trg_info (int trg)
edgelst el; edgelst el;
int i, j, k, update_idx; int i, j, k, update_idx;
basic_block block; basic_block block;
sbitmap visited;
edge_iterator ei; edge_iterator ei;
edge e; edge e;
...@@ -1006,6 +1007,8 @@ compute_trg_info (int trg) ...@@ -1006,6 +1007,8 @@ compute_trg_info (int trg)
sp->is_speculative = 0; sp->is_speculative = 0;
sp->src_prob = 100; sp->src_prob = 100;
visited = sbitmap_alloc (last_basic_block - (INVALID_BLOCK + 1));
for (i = trg + 1; i < current_nr_blocks; i++) for (i = trg + 1; i < current_nr_blocks; i++)
{ {
sp = candidate_table + i; sp = candidate_table + i;
...@@ -1043,12 +1046,14 @@ compute_trg_info (int trg) ...@@ -1043,12 +1046,14 @@ compute_trg_info (int trg)
overrunning the end of the bblst_table. */ overrunning the end of the bblst_table. */
update_idx = 0; update_idx = 0;
sbitmap_zero (visited);
for (j = 0; j < el.nr_members; j++) for (j = 0; j < el.nr_members; j++)
{ {
block = el.first_member[j]->src; block = el.first_member[j]->src;
FOR_EACH_EDGE (e, ei, block->succs) FOR_EACH_EDGE (e, ei, block->succs)
{ {
if (!(e->dest->flags & BB_VISITED)) if (!TEST_BIT (visited,
e->dest->index - (INVALID_BLOCK + 1)))
{ {
for (k = 0; k < el.nr_members; k++) for (k = 0; k < el.nr_members; k++)
if (e == el.first_member[k]) if (e == el.first_member[k])
...@@ -1057,7 +1062,8 @@ compute_trg_info (int trg) ...@@ -1057,7 +1062,8 @@ compute_trg_info (int trg)
if (k >= el.nr_members) if (k >= el.nr_members)
{ {
bblst_table[bblst_last++] = e->dest; bblst_table[bblst_last++] = e->dest;
e->dest->flags |= BB_VISITED; SET_BIT (visited,
e->dest->index - (INVALID_BLOCK + 1));
update_idx++; update_idx++;
} }
} }
...@@ -1065,9 +1071,6 @@ compute_trg_info (int trg) ...@@ -1065,9 +1071,6 @@ compute_trg_info (int trg)
} }
sp->update_bbs.nr_members = update_idx; sp->update_bbs.nr_members = update_idx;
FOR_ALL_BB (block)
block->flags &= ~BB_VISITED;
/* Make sure we didn't overrun the end of bblst_table. */ /* Make sure we didn't overrun the end of bblst_table. */
gcc_assert (bblst_last <= bblst_size); gcc_assert (bblst_last <= bblst_size);
} }
...@@ -1079,6 +1082,8 @@ compute_trg_info (int trg) ...@@ -1079,6 +1082,8 @@ compute_trg_info (int trg)
sp->src_prob = 0; sp->src_prob = 0;
} }
} }
sbitmap_free (visited);
} }
/* Print candidates info, for debugging purposes. Callable from debugger. */ /* Print candidates info, for debugging purposes. Callable from debugger. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment