diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-04 20:37:38 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-04 20:37:38 +0000 |
commit | deb78f9eeb94962225a93b18c8e0527622601c7e (patch) | |
tree | 23b173bffe56f19ee8231be3aae5255ddc05cbc8 /gcc/tree-ssanames.c | |
parent | 3c5c992fb35721740819b519e532b3f3e244e323 (diff) | |
download | gcc-deb78f9eeb94962225a93b18c8e0527622601c7e.tar.gz |
* tree-cfg.c (tree_duplicate_bb): Mark duplicated definitions.
* tree-flow.h (rewrite_ssa_into_ssa): Declaration changed.
* tree-into-ssa.c (rewrite_ssa_into_ssa): Use new interface to
manipulate the duplicated ssa names.
* tree-ssanames.c (ssa_names_to_rewrite): New variable.
(marked_for_rewrite_p, any_marked_for_rewrite_p, mark_for_rewrite,
unmark_all_for_rewrite, marked_ssa_names, release_ssa_name_force):
New functions.
(release_ssa_name): Do not release ssa names that may have multiple
definitions.
* tree.h (release_ssa_name_force, mark_for_rewrite,
unmark_all_for_rewrite, marked_for_rewrite_p, any_marked_for_rewrite_p,
marked_ssa_names): Declare.
* tree-ssa-loop-ch.c (mark_defs_for_rewrite): Remove.
(duplicate_blocks): Remove call to mark_defs_for_rewrite.
Update call to rewrite_ssa_into_ssa.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85572 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssanames.c')
-rw-r--r-- | gcc/tree-ssanames.c | 69 |
1 files changed, 68 insertions, 1 deletions
diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c index 4e8985a4b21..94c14538b16 100644 --- a/gcc/tree-ssanames.c +++ b/gcc/tree-ssanames.c @@ -60,7 +60,10 @@ Boston, MA 02111-1307, USA. */ /* Array of all SSA_NAMEs used in the function. */ varray_type ssa_names; - + +/* Bitmap of ssa names marked for rewriting. */ +bitmap ssa_names_to_rewrite; + /* Free list of SSA_NAMEs. This list is wiped at the end of each function after we leave SSA form. */ static GTY (()) tree free_ssanames; @@ -74,6 +77,64 @@ unsigned int ssa_name_nodes_reused; unsigned int ssa_name_nodes_created; #endif +/* Returns true if ssa name VAR is marked for rewrite. */ + +bool +marked_for_rewrite_p (tree var) +{ + if (ssa_names_to_rewrite + && bitmap_bit_p (ssa_names_to_rewrite, SSA_NAME_VERSION (var))) + return true; + + return false; +} + +/* Returns true if any ssa name is marked for rewrite. */ + +bool +any_marked_for_rewrite_p (void) +{ + if (!ssa_names_to_rewrite) + return false; + + return bitmap_first_set_bit (ssa_names_to_rewrite) != -1; +} + +/* Mark ssa name VAR for rewriting. */ + +void +mark_for_rewrite (tree var) +{ + if (!ssa_names_to_rewrite) + ssa_names_to_rewrite = BITMAP_XMALLOC (); + + bitmap_set_bit (ssa_names_to_rewrite, SSA_NAME_VERSION (var)); +} + +/* Unmark all ssa names marked for rewrite. */ + +void +unmark_all_for_rewrite (void) +{ + if (!ssa_names_to_rewrite) + return; + + bitmap_clear (ssa_names_to_rewrite); +} + +/* Return the bitmap of ssa names to rewrite. Copy the bitmap, + so that the optimizers cannot access internals directly */ + +bitmap +marked_ssa_names (void) +{ + bitmap ret = BITMAP_XMALLOC (); + if (ssa_names_to_rewrite) + bitmap_copy (ret, ssa_names_to_rewrite); + + return ret; +} + /* Initialize management of SSA_NAMEs. */ void @@ -182,6 +243,12 @@ release_ssa_name (tree var) if (var == var_ann (SSA_NAME_VAR (var))->default_def) return; + /* If the ssa name is marked for rewriting, it may have multiple definitions, + but we may happen to remove just one of them. So do not remove the + ssa name now. */ + if (marked_for_rewrite_p (var)) + return; + /* release_ssa_name can be called multiple times on a single SSA_NAME. However, it should only end up on our free list one time. We keep a status bit in the SSA_NAME node itself to indicate it has |