aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@redhat.com>2001-08-21 03:22:26 +0000
committerDiego Novillo <dnovillo@gcc.gnu.org>2001-08-20 23:22:26 -0400
commit006844a3928510acdacc3bded90136175c85d47f (patch)
tree33b8ea537a032be49f69d7e8203822fe994bd812 /gcc
parent0760faf99d289f21028e54654257433b4f28526b (diff)
downloadgcc-006844a3928510acdacc3bded90136175c85d47f.zip
gcc-006844a3928510acdacc3bded90136175c85d47f.tar.gz
gcc-006844a3928510acdacc3bded90136175c85d47f.tar.bz2
basic-block.h (basic_block): Add new field 'flags'.
* basic-block.h (basic_block): Add new field 'flags'. (BB_REACHABLE): Define. (expunge_block): Declare. * flow.c (ENTRY_BLOCK_PTR): Initialize field 'flags'. (EXIT_BLOCK_PTR): Ditto. (expunge_block): Remove static declaration. (cleanup_cfg): Clear bb->aux on every basic block. (find_unreachable_blocks): Set BB_REACHABLE bit in bb->flags when computing reachability. (delete_unreachable_blocks): Delete block b if b->flags has BB_REACHABLE unset. From-SVN: r45068
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/basic-block.h7
-rw-r--r--gcc/flow.c37
3 files changed, 42 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1779829..5886158 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,19 @@
2001-08-20 Diego Novillo <dnovillo@redhat.com>
+ * basic-block.h (basic_block): Add new field 'flags'.
+ (BB_REACHABLE): Define.
+ (expunge_block): Declare.
+ * flow.c (ENTRY_BLOCK_PTR): Initialize field 'flags'.
+ (EXIT_BLOCK_PTR): Ditto.
+ (expunge_block): Remove static declaration.
+ (cleanup_cfg): Clear bb->aux on every basic block.
+ (find_unreachable_blocks): Set BB_REACHABLE bit in bb->flags when
+ computing reachability.
+ (delete_unreachable_blocks): Delete block b if b->flags has
+ BB_REACHABLE unset.
+
+2001-08-20 Diego Novillo <dnovillo@redhat.com>
+
* doc/invoke.texi: Replace references to -fdump-tree with -fdump-ast.
2001-08-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index dc2d190..83c4eb4 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -218,10 +218,16 @@ typedef struct basic_block_def {
/* Expected frequency. Normalized to be in range 0 to BB_FREQ_MAX. */
int frequency;
+
+ /* Various flags. See BB_* below. */
+ int flags;
} *basic_block;
#define BB_FREQ_MAX 10000
+/* Masks for basic_block.flags. */
+#define BB_REACHABLE 1
+
/* Number of basic blocks in the current function. */
extern int n_basic_blocks;
@@ -609,6 +615,7 @@ extern void debug_regset PARAMS ((regset));
extern void allocate_reg_life_data PARAMS ((void));
extern void allocate_bb_life_data PARAMS ((void));
extern void find_unreachable_blocks PARAMS ((void));
+extern void expunge_block PARAMS ((basic_block));
extern void delete_noop_moves PARAMS ((rtx));
extern rtx last_loop_beg_note PARAMS ((rtx));
extern basic_block redirect_edge_and_branch_force PARAMS ((edge, basic_block));
diff --git a/gcc/flow.c b/gcc/flow.c
index 6a316e2..8e0b813 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -208,7 +208,8 @@ struct basic_block_def entry_exit_blocks[2]
ENTRY_BLOCK, /* index */
0, /* loop_depth */
0, /* count */
- 0 /* frequency */
+ 0, /* frequency */
+ 0 /* flags */
},
{
NULL, /* head */
@@ -225,7 +226,8 @@ struct basic_block_def entry_exit_blocks[2]
EXIT_BLOCK, /* index */
0, /* loop_depth */
0, /* count */
- 0 /* frequency */
+ 0, /* frequency */
+ 0 /* flags */
}
};
@@ -383,7 +385,6 @@ static void commit_one_edge_insertion PARAMS ((edge));
static void delete_unreachable_blocks PARAMS ((void));
static int can_delete_note_p PARAMS ((rtx));
-static void expunge_block PARAMS ((basic_block));
static int can_delete_label_p PARAMS ((rtx));
static int tail_recursion_label_p PARAMS ((rtx));
static int merge_blocks_move_predecessor_nojumps PARAMS ((basic_block,
@@ -1030,6 +1031,8 @@ void
cleanup_cfg (mode)
int mode;
{
+ int i;
+
timevar_push (TV_CLEANUP_CFG);
delete_unreachable_blocks ();
if (try_optimize_cfg (mode))
@@ -1040,6 +1043,10 @@ cleanup_cfg (mode)
free_EXPR_LIST_list (&label_value_list);
free_EXPR_LIST_list (&tail_recursion_label_list);
timevar_pop (TV_CLEANUP_CFG);
+
+ /* Clear bb->aux on all basic blocks. */
+ for (i = 0; i < n_basic_blocks; ++i)
+ BASIC_BLOCK (i)->aux = NULL;
}
/* Create a new basic block consisting of the instructions between
@@ -2643,8 +2650,9 @@ flow_call_edges_add (blocks)
return blocks_split;
}
-/* Find unreachable blocks. An unreachable block will have NULL in
- block->aux, a non-NULL value indicates the block is reachable. */
+/* Find unreachable blocks. An unreachable block will have 0 in
+ the reachable bit in block->flags. A non-zero value indicates the
+ block is reachable. */
void
find_unreachable_blocks ()
@@ -2656,10 +2664,10 @@ find_unreachable_blocks ()
n = n_basic_blocks;
tos = worklist = (basic_block *) xmalloc (sizeof (basic_block) * n);
- /* Use basic_block->aux as a marker. Clear them all. */
+ /* Clear all the reachability flags. */
for (i = 0; i < n; ++i)
- BASIC_BLOCK (i)->aux = NULL;
+ BASIC_BLOCK (i)->flags &= ~BB_REACHABLE;
/* Add our starting points to the worklist. Almost always there will
be only one. It isn't inconcievable that we might one day directly
@@ -2669,8 +2677,8 @@ find_unreachable_blocks ()
{
*tos++ = e->dest;
- /* Mark the block with a handy non-null value. */
- e->dest->aux = e;
+ /* Mark the block reachable. */
+ e->dest->flags |= BB_REACHABLE;
}
/* Iterate: find everything reachable from what we've already seen. */
@@ -2680,10 +2688,10 @@ find_unreachable_blocks ()
basic_block b = *--tos;
for (e = b->succ; e; e = e->succ_next)
- if (!e->dest->aux)
+ if (!(e->dest->flags & BB_REACHABLE))
{
*tos++ = e->dest;
- e->dest->aux = e;
+ e->dest->flags |= BB_REACHABLE;
}
}
@@ -2706,10 +2714,7 @@ delete_unreachable_blocks ()
{
basic_block b = BASIC_BLOCK (i);
- if (b->aux != NULL)
- /* This block was found. Tidy up the mark. */
- b->aux = NULL;
- else
+ if (!(b->flags & BB_REACHABLE))
flow_delete_block (b);
}
@@ -2845,7 +2850,7 @@ flow_delete_block (b)
/* Remove block B from the basic block array and compact behind it. */
-static void
+void
expunge_block (b)
basic_block b;
{