[tree-ssa] Fix some fallout from sbitmap -> bitmap transition
Jan Vroonhof
jan.vroonhof@ntlworld.com
Sat Apr 26 21:37:00 GMT 2003
> >2003-04-26 Jan Vroonhof <jan.vroonhof@ntlworld.com>
> >
> > * bitmap.h (EXECUTE_IF_SET_IN_BITMAP_CLEAR): New bitmap walking
> > macro. Clear bit when iterating over it. Primitive initial
> > implementation (does not free data block when it turns out to be
> > empty after walk).
>
> If you are walking the entire bitmap, the whole thing is clear when you
> are done with it, and you can just use bitmap_clear (which will free
> the elements) after the EXECUTE_IF_SET_IN_BITMAP call.
In this particular case the bitmap is freed very soon afterwards
anyway. I wasn't clear what to do for a generic macro. Should we cater
for cases where the body sets bits in the loop that might have
previously been cleared?
Anyway it cannot hurt doing what you suggest for the only current user, so
I have made the change.
Jan
2003-04-26 Jan Vroonhof <jan.vroonhof@ntlworld.com>
* bitmap.h (EXECUTE_IF_SET_IN_BITMAP_CLEAR): New bitmap walking
macro. Clear bit when iterating over it. Primitive initial
implementation (waits till end with freeing empty blocks).
* tree-ssa.c (elim_create): Don't modify bitmap while using
bitmap walking macro, use implicit clearing macro.
Index: bitmap.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/bitmap.h,v
retrieving revision 1.28.2.1
diff -u -r1.28.2.1 bitmap.h
--- bitmap.h 3 Feb 2003 17:08:22 -0000 1.28.2.1
+++ bitmap.h 26 Apr 2003 21:34:18 -0000
@@ -217,6 +217,25 @@
} \
} while (0)
+/* Loop over all bits in BITMAP, starting with MIN, setting BITNUM to
+ the bit number, clearing the bit and executing CODE for all bits
+ that are set.
+
+ #### FIXME?:
+ - This version does not support renabling bits during the walk
+ - A block could be freed as soon as we are done with it
+*/
+
+#define EXECUTE_IF_SET_IN_BITMAP_CLEAR(BITMAP, MIN, BITNUM, CODE) \
+do { \
+ EXECUTE_IF_SET_IN_BITMAP(BITMAP, MIN, BITNUM, \
+ { \
+ ptr_->bits[word_num_] &= ~mask_; \
+ CODE; \
+ }); \
+ bitmap_clear(BITMAP); \
+} while (0)
+
/* Loop over all bits in BITMAP1 and BITMAP2, starting with MIN, setting
BITNUM to the bit number and executing CODE for all bits that are set in
the first bitmap and not set in the second. */
Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa.c,v
retrieving revision 1.1.4.69
diff -u -r1.1.4.69 tree-ssa.c
--- tree-ssa.c 26 Apr 2003 03:04:04 -0000 1.1.4.69
+++ tree-ssa.c 26 Apr 2003 21:34:20 -0000
@@ -1129,10 +1129,9 @@
}
else
{
- EXECUTE_IF_SET_IN_BITMAP (g->succ[T], 0, S,
+ EXECUTE_IF_SET_IN_BITMAP_CLEAR (g->succ[T], 0, S,
{
SET_BIT (g->visited, T);
- bitmap_clear_bit(g->succ[T], S);
insert_copy_on_edge (g->e,
partition_to_var (g->map, T),
partition_to_var (g->map, S));
@@ -2035,7 +2034,7 @@
#if 0
register_new_def (*def_p, cached_lhs, block_defs_p);
ssa_stats.num_re++;
- bsi_remove (si);
+ bsi_remove (&si);
return;
#else
if (var_is_live (cached_lhs, ann->bb))
More information about the Gcc-patches
mailing list