Commit 32ace6e2 by Andrew MacLeod Committed by Andrew Macleod

Switch live on entry to a per block basis from per variable.

	* tree-outof-ssa.c (coalesce_ssa_name): Use calculate_live_ranges.
	* tree-ssa-live.c (new_tree_live_info, delete_tree_live_info): Update.
	(add_livein_if_notdef): Delete.
	(loe_visit_block): New.  Propogate live on entry info for a block into
	each predecessor.  If it changes, make sure it is visited again.
	(live_worklist): Visit every block and update the live on entry info 
	for preds.  Iterate over any that changed.
	(set_var_live_on_entry): Populate the live on entry blocks with bits
	based on the immediate uses of a var.
	(calculate_live_on_entry): Remove.
	(calculate_live_on_exit): Calculate live on exit based on the newly
	oriented live on entry bits.
	(calculate_live_ranges): Build live on entry and exit vectors.
	(dump_live_info): Use new orientation of live on entry bitmaps.
	(verify_live_on_entry): New.  Split out verification code from old
	calculate_live_on_entry routine.
	* tree-ssa-live.h (struct tree_live_info_d): Add Working stack.
	(live_entry_blocks): Rename to live_on_entry and return bitmap for a
	basic_block instead of for a partition.
	(live_merge_and_clear): Add asserts.
	(make_live_on_entry): Set partition bit in basic block vector.

From-SVN: r119495
parent b9ca5811
2006-12-04 Andrew MacLeod <amacleod@redhat.com>
* tree-outof-ssa.c (coalesce_ssa_name): Use calculate_live_ranges.
* tree-ssa-live.c (new_tree_live_info, delete_tree_live_info): Update.
(add_livein_if_notdef): Delete.
(loe_visit_block): New. Propogate live on entry info for a block into
each predecessor. If it changes, make sure it is visited again.
(live_worklist): Visit every block and update the live on entry info
for preds. Iterate over any that changed.
(set_var_live_on_entry): Populate the live on entry blocks with bits
based on the immediate uses of a var.
(calculate_live_on_entry): Remove.
(calculate_live_on_exit): Calculate live on exit based on the newly
oriented live on entry bits.
(calculate_live_ranges): Build live on entry and exit vectors.
(dump_live_info): Use new orientation of live on entry bitmaps.
(verify_live_on_entry): New. Split out verification code from old
calculate_live_on_entry routine.
* tree-ssa-live.h (struct tree_live_info_d): Add Working stack.
(live_entry_blocks): Rename to live_on_entry and return bitmap for a
basic_block instead of for a partition.
(live_merge_and_clear): Add asserts.
(make_live_on_entry): Set partition bit in basic block vector.
2006-12-04 Jakub Jelinek <jakub@redhat.com> 2006-12-04 Jakub Jelinek <jakub@redhat.com>
PR libgomp/29947 PR libgomp/29947
......
...@@ -822,8 +822,7 @@ coalesce_ssa_name (var_map map, int flags) ...@@ -822,8 +822,7 @@ coalesce_ssa_name (var_map map, int flags)
if (num_var_partitions (map) <= 1) if (num_var_partitions (map) <= 1)
return NULL; return NULL;
liveinfo = calculate_live_on_entry (map); liveinfo = calculate_live_ranges (map);
calculate_live_on_exit (liveinfo);
rv = root_var_init (map); rv = root_var_init (map);
/* Remove single element variable from the list. */ /* Remove single element variable from the list. */
......
...@@ -182,11 +182,11 @@ register_ssa_partition (var_map map, tree ssa_var) ...@@ -182,11 +182,11 @@ register_ssa_partition (var_map map, tree ssa_var)
As well, partitions are marked as to whether they are global (live As well, partitions are marked as to whether they are global (live
outside the basic block they are defined in). outside the basic block they are defined in).
The live-on-entry information is per variable. It provide a bitmap for The live-on-entry information is per block. It provide a bitmap for
each variable which has a bit set for each basic block that the variable each block which has a bit set for each partition that is live on entry to
is live on entry to that block. that block.
The live-on-exit information is per block. It provides a bitmap for each The live-on-exit information is per block. It provides a bitmap for each
block indicating which partitions are live on exit from the block. block indicating which partitions are live on exit from the block.
For the purposes of this implementation, we treat the elements of a PHI For the purposes of this implementation, we treat the elements of a PHI
...@@ -218,12 +218,18 @@ typedef struct tree_live_info_d ...@@ -218,12 +218,18 @@ typedef struct tree_live_info_d
/* Number of basic blocks when live on exit calculated. */ /* Number of basic blocks when live on exit calculated. */
int num_blocks; int num_blocks;
/* Vector used when creating live ranges as a visited stack. */
int *work_stack;
/* Top of workstack. */
int *stack_top;
/* Bitmap of what variables are live on exit for a basic blocks. */ /* Bitmap of what variables are live on exit for a basic blocks. */
bitmap *liveout; bitmap *liveout;
} *tree_live_info_p; } *tree_live_info_p;
extern tree_live_info_p calculate_live_on_entry (var_map); extern tree_live_info_p calculate_live_ranges (var_map);
extern void calculate_live_on_exit (tree_live_info_p); extern void calculate_live_on_exit (tree_live_info_p);
extern void delete_tree_live_info (tree_live_info_p); extern void delete_tree_live_info (tree_live_info_p);
...@@ -233,7 +239,7 @@ extern void delete_tree_live_info (tree_live_info_p); ...@@ -233,7 +239,7 @@ extern void delete_tree_live_info (tree_live_info_p);
extern void dump_live_info (FILE *, tree_live_info_p, int); extern void dump_live_info (FILE *, tree_live_info_p, int);
static inline int partition_is_global (tree_live_info_p, int); static inline int partition_is_global (tree_live_info_p, int);
static inline bitmap live_entry_blocks (tree_live_info_p, int); static inline bitmap live_on_entry (tree_live_info_p, basic_block);
static inline bitmap live_on_exit (tree_live_info_p, basic_block); static inline bitmap live_on_exit (tree_live_info_p, basic_block);
static inline var_map live_var_map (tree_live_info_p); static inline var_map live_var_map (tree_live_info_p);
static inline void live_merge_and_clear (tree_live_info_p, int, int); static inline void live_merge_and_clear (tree_live_info_p, int, int);
...@@ -254,10 +260,13 @@ partition_is_global (tree_live_info_p live, int p) ...@@ -254,10 +260,13 @@ partition_is_global (tree_live_info_p live, int p)
partition P. */ partition P. */
static inline bitmap static inline bitmap
live_entry_blocks (tree_live_info_p live, int p) live_on_entry (tree_live_info_p live, basic_block bb)
{ {
gcc_assert (live->livein); gcc_assert (live->livein);
return live->livein[p]; gcc_assert (bb != ENTRY_BLOCK_PTR);
gcc_assert (bb != EXIT_BLOCK_PTR);
return live->livein[bb->index];
} }
...@@ -290,6 +299,8 @@ live_var_map (tree_live_info_p live) ...@@ -290,6 +299,8 @@ live_var_map (tree_live_info_p live)
static inline void static inline void
live_merge_and_clear (tree_live_info_p live, int p1, int p2) live_merge_and_clear (tree_live_info_p live, int p1, int p2)
{ {
gcc_assert (live->livein[p1]);
gcc_assert (live->livein[p2]);
bitmap_ior_into (live->livein[p1], live->livein[p2]); bitmap_ior_into (live->livein[p1], live->livein[p2]);
bitmap_zero (live->livein[p2]); bitmap_zero (live->livein[p2]);
} }
...@@ -300,7 +311,7 @@ live_merge_and_clear (tree_live_info_p live, int p1, int p2) ...@@ -300,7 +311,7 @@ live_merge_and_clear (tree_live_info_p live, int p1, int p2)
static inline void static inline void
make_live_on_entry (tree_live_info_p live, basic_block bb , int p) make_live_on_entry (tree_live_info_p live, basic_block bb , int p)
{ {
bitmap_set_bit (live->livein[p], bb->index); bitmap_set_bit (live->livein[bb->index], p);
bitmap_set_bit (live->global, p); bitmap_set_bit (live->global, p);
} }
......
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