summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/basic-block.h34
-rw-r--r--gcc/regrename.c21
-rw-r--r--gcc/sched-rgn.c15
4 files changed, 56 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0533ca3f455..94d0dee20ff 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+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>
* config.gcc (mips64*-*-linux*): Set the default abi to n32. Remove
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index bfeac26d7f7..d377fb6362b 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -285,17 +285,47 @@ typedef struct reorder_block_def
#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
+
+/* Only set on blocks that have just been created by create_bb. */
#define BB_NEW 2
+
+/* Set by find_unreachable_blocks. Do not rely on this being set in any
+ pass. */
#define BB_REACHABLE 4
+
+/* Used by dfs_enumerate_from to keep track of visited basic blocks. */
#define BB_VISITED 8
+
+/* Set for blocks in an irreducible loop by loop analysis. */
#define BB_IRREDUCIBLE_LOOP 16
+
+/* Set on blocks that may actually not be single-entry single-exit block. */
#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
+
+/* Set on blocks that should be put in a cold section. */
#define BB_COLD_PARTITION 256
+
+/* Dummy flag for convenience in the hot/cold partitioning code. */
#define BB_UNPARTITIONED 0
/* Partitions, to be used when partitioning hot and cold basic blocks into
diff --git a/gcc/regrename.c b/gcc/regrename.c
index eec594c7647..f2ab1f10338 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -1746,29 +1746,26 @@ copyprop_hardreg_forward (void)
struct value_data *all_vd;
bool need_refresh;
basic_block bb;
+ sbitmap visited;
need_refresh = false;
all_vd = xmalloc (sizeof (struct value_data) * last_basic_block);
- /* Clear all BB_VISITED flags. We use BB_VISITED flags to indicate
- whether we have processed a given basic block or not. Note that
- 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;
+ visited = sbitmap_alloc (last_basic_block - (INVALID_BLOCK + 1));
+ sbitmap_zero (visited);
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
processed, begin with the value data that was live at
the end of the predecessor block. */
/* ??? Ought to use more intelligent queuing of blocks. */
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)))
all_vd[bb->index] = all_vd[EDGE_PRED (bb, 0)->src->index];
else
@@ -1778,11 +1775,7 @@ copyprop_hardreg_forward (void)
need_refresh = true;
}
- /* Clear BB_VISITED flag on each basic block. We do not need to
- clear the one on ENTRY_BLOCK_PTR because it's already cleared
- above. */
- FOR_EACH_BB (bb)
- bb->flags &= ~BB_VISITED;
+ sbitmap_free (visited);
if (need_refresh)
{
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index 2aba7f3b1c1..3fae7904fc0 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -997,6 +997,7 @@ compute_trg_info (int trg)
edgelst el;
int i, j, k, update_idx;
basic_block block;
+ sbitmap visited;
edge_iterator ei;
edge e;
@@ -1006,6 +1007,8 @@ compute_trg_info (int trg)
sp->is_speculative = 0;
sp->src_prob = 100;
+ visited = sbitmap_alloc (last_basic_block - (INVALID_BLOCK + 1));
+
for (i = trg + 1; i < current_nr_blocks; i++)
{
sp = candidate_table + i;
@@ -1043,12 +1046,14 @@ compute_trg_info (int trg)
overrunning the end of the bblst_table. */
update_idx = 0;
+ sbitmap_zero (visited);
for (j = 0; j < el.nr_members; j++)
{
block = el.first_member[j]->src;
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++)
if (e == el.first_member[k])
@@ -1057,7 +1062,8 @@ compute_trg_info (int trg)
if (k >= el.nr_members)
{
bblst_table[bblst_last++] = e->dest;
- e->dest->flags |= BB_VISITED;
+ SET_BIT (visited,
+ e->dest->index - (INVALID_BLOCK + 1));
update_idx++;
}
}
@@ -1065,9 +1071,6 @@ compute_trg_info (int trg)
}
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. */
gcc_assert (bblst_last <= bblst_size);
}
@@ -1079,6 +1082,8 @@ compute_trg_info (int trg)
sp->src_prob = 0;
}
}
+
+ sbitmap_free (visited);
}
/* Print candidates info, for debugging purposes. Callable from debugger. */