diff options
author | Lawrence Crowl <crowl@google.com> | 2012-10-30 00:02:55 +0000 |
---|---|---|
committer | Lawrence Crowl <crowl@gcc.gnu.org> | 2012-10-30 00:02:55 +0000 |
commit | f61e445a74b138a2071a0af9f55c2d6e45fe2d5d (patch) | |
tree | 1ab800d2373b19aaee52a26a91b2c67b2657101e /gcc/ebitmap.h | |
parent | 880661a48b6e2f3f4b3c05860d3c9737b2a1dcc8 (diff) | |
download | gcc-f61e445a74b138a2071a0af9f55c2d6e45fe2d5d.zip gcc-f61e445a74b138a2071a0af9f55c2d6e45fe2d5d.tar.gz gcc-f61e445a74b138a2071a0af9f55c2d6e45fe2d5d.tar.bz2 |
This patch implements the unification of the *bitmap interfaces as discussed.
Essentially, we rename ebitmap and sbitmap functions to use the same names
as the bitmap functions. This rename works because we can now overload
on the bitmap type. Some macros now become inline functions to enable
that overloading.
The sbitmap non-bool returning bitwise operations have been merged with
the bool versions. Sometimes this merge involved modifying the non-bool
version to compute the bool value, and sometimes modifying bool version to
add additional work from the non-bool version. The redundant routines have
been removed.
The allocation functions have not been renamed, because we often do not
have an argument on which to overload. The cardinality functions have not
been renamed, because they have different parameters, and are thus not
interchangable. The iteration functions have not been renamed, because
they are functionally different.
Tested on x86_64, contrib/config-list.mk testing passed.
Index: gcc/ChangeLog
2012-10-29 Lawrence Crowl <crowl@google.com>
* sbitmap.h (sbitmap_copy): Rename bitmap_copy.
(sbitmap_copy_n): Rename bitmap_copy_n.
(sbitmap_equal): Rename bitmap_equal_p.
(sbitmap_empty_p): Rename bitmap_empty_p.
(sbitmap_range_empty_p): Rename bitmap_range_empty_p.
(sbitmap_zero): Rename bitmap_clear.
(sbitmap_ones): Rename bitmap_ones.
(sbitmap_vector_zero): Rename bitmap_vector_clear.
(sbitmap_vector_ones): Rename bitmap_vector_ones.
(sbitmap_not): Rename bitmap_not.
(sbitmap_a_and_b_cg): Commented out.
(sbitmap_a_and_b): Rename bitmap_and. Add bool return.
(sbitmap_difference): Rename bitmap_and_compl.
(sbitmap_a_or_b_cg): Commented out.
(sbitmap_a_or_b): Rename bitmap_xor. Add bool return.
(sbitmap_a_xor_b_cg): Commented out.
(sbitmap_a_xor_b): Rename bitmap_xor. Add bool return.
(sbitmap_a_and_b_or_c_cg): Rename bitmap_and_or.
(sbitmap_a_and_b_or_c): Commented out.
(sbitmap_a_or_b_and_c_cg): Rename bitmap_or_and.
(sbitmap_a_or_b_and_c): Commented out.
(sbitmap_union_of_diff_cg): Rename bitmap_ior_and_compl.
(sbitmap_union_of_diff): Commented out.
(dump_sbitmap): Rename dump_bitmap.
(dump_sbitmap_file): Rename dump_bitmap_file.
(debug_sbitmap): Rename debug_bitmap.
(dump_sbitmap_vector): Rename dump_bitmap_vector.
(sbitmap_first_set_bit): Rename bitmap_first_set_bit.
(sbitmap_last_set_bit): Rename bitmap_last_set_bit.
(sbitmap_a_subset_b_p): Rename bitmap_subset_p.
(sbitmap_any_common_bits): Rename bitmap_intersect_p.
(#define sbitmap_free): Reimplement as inline function.
(#define sbitmap_vector_free): Reimplement as inline function.
* bitmap.h (#define bitmap_zero): Remove as redundant.
(#define bitmap_empty_p): Reimplement as inline function.
(#define dump_bitmap): Reimplement as inline function.
From-SVN: r192969
Diffstat (limited to 'gcc/ebitmap.h')
-rw-r--r-- | gcc/ebitmap.h | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/gcc/ebitmap.h b/gcc/ebitmap.h index b067ddb..a755312 100644 --- a/gcc/ebitmap.h +++ b/gcc/ebitmap.h @@ -37,34 +37,38 @@ typedef struct ebitmap_def } *ebitmap; -#define ebitmap_empty_p(MAP) ((MAP)->numwords == 0) +inline bool bitmap_empty_p (ebitmap map) +{ + return map->numwords == 0; +} + #define ebitmap_free(MAP) (free((MAP)->elts), \ sbitmap_free ((MAP)->wordmask), \ free((MAP))) -extern void ebitmap_set_bit (ebitmap, unsigned int); -extern void ebitmap_clear_bit (ebitmap, unsigned int); -extern bool ebitmap_bit_p (ebitmap, unsigned int); -extern void dump_ebitmap (FILE *, ebitmap); -extern void dump_ebitmap_file (FILE *, ebitmap); -extern void dump_ebitmap_vector (FILE *, const char *, const char *, ebitmap *, - int); +extern void bitmap_set_bit (ebitmap, unsigned int); +extern void bitmap_clear_bit (ebitmap, unsigned int); +extern bool bitmap_bit_p (ebitmap, unsigned int); +extern void dump_bitmap (FILE *, ebitmap); +extern void dump_bitmap_file (FILE *, ebitmap); +extern void dump_bitmap_vector (FILE *, const char *, const char *, ebitmap *, + int); extern ebitmap ebitmap_alloc (unsigned int); extern ebitmap *ebitmap_vector_alloc (unsigned int, unsigned int); -extern void ebitmap_copy (ebitmap, ebitmap); -extern void ebitmap_and (ebitmap, ebitmap, ebitmap); -extern void ebitmap_and_into (ebitmap, ebitmap); -extern bool ebitmap_and_compl (ebitmap, ebitmap, ebitmap); -extern bool ebitmap_and_compl_into (ebitmap, ebitmap); -extern bool ebitmap_ior_into (ebitmap, ebitmap); -extern bool ebitmap_ior (ebitmap, ebitmap, ebitmap); -extern bool ebitmap_ior_and_compl (ebitmap, ebitmap, ebitmap, ebitmap); -extern bool ebitmap_ior_and_compl_into (ebitmap, ebitmap, ebitmap); -extern bool ebitmap_equal_p (ebitmap, ebitmap); -extern void ebitmap_clear (ebitmap); -extern int ebitmap_last_set_bit (ebitmap); -extern void debug_ebitmap (ebitmap); -extern unsigned long ebitmap_popcount(ebitmap, unsigned long); +extern void bitmap_copy (ebitmap, ebitmap); +extern void bitmap_and (ebitmap, ebitmap, ebitmap); +extern void bitmap_and_into (ebitmap, ebitmap); +extern bool bitmap_and_compl (ebitmap, ebitmap, ebitmap); +extern bool bitmap_and_compl_into (ebitmap, ebitmap); +extern bool bitmap_ior_into (ebitmap, ebitmap); +extern bool bitmap_ior (ebitmap, ebitmap, ebitmap); +extern bool bitmap_ior_and_compl (ebitmap, ebitmap, ebitmap, ebitmap); +extern bool bitmap_ior_and_compl_into (ebitmap, ebitmap, ebitmap); +extern bool bitmap_equal_p (ebitmap, ebitmap); +extern void bitmap_clear (ebitmap); +extern int bitmap_last_set_bit (ebitmap); +extern void debug_bitmap (ebitmap); +extern unsigned long bitmap_popcount(ebitmap, unsigned long); /* The iterator for ebitmap. */ typedef struct { |