This patch removes the unused ebitmap, and then removes some sbitmap functions
only used by ebitmap. The functions removed are:
SET_BIT_WITH_POPCOUNT
RESET_BIT_WITH_POPCOUNT
bitmap_copy_n
bitmap_range_empty_p
sbitmap_popcount
In addition, two functions have been made private to the implementation file:
SBITMAP_SIZE_BYTES
sbitmap_verify_popcount
Tested on x86-64.
Okay for trunk?
Index: gcc/ChangeLog
2012-10-31 Lawrence Crowl cr...@google.com
* ebitmap.h: Remove unused.
* ebitmap.c: Remove unused.
* Makefile.in: Remove ebitmap.h and ebitmap.c.
* sbitmap.h (SBITMAP_SIZE_BYTES): Move to source file.
(SET_BIT_WITH_POPCOUNT): Remove unused.
(RESET_BIT_WITH_POPCOUNT): Remove unused.
(bitmap_copy_n): Remove unused.
(bitmap_range_empty_p): Remove unused.
(sbitmap_popcount): Remove unused.
(sbitmap_verify_popcount): Make private to source file.
* sbitmap.c (SBITMAP_SIZE_BYTES): Move here from header.
(bitmap_copy_n): Remove unused.
(bitmap_range_empty_p): Remove unused.
(sbitmap_popcount): Remove unused.
(sbitmap_verify_popcount): Make private to source file.
Index: gcc/sbitmap.c
===
--- gcc/sbitmap.c (revision 193049)
+++ gcc/sbitmap.c (working copy)
@@ -22,6 +22,9 @@ along with GCC; see the file COPYING3.
#include coretypes.h
#include sbitmap.h
+/* Return the set size needed for N elements. */
+#define SBITMAP_SIZE_BYTES(BITMAP) ((BITMAP)-size * sizeof (SBITMAP_ELT_TYPE))
+
/* This suffices for roughly 99% of the hosts we run on, and the rest
don't have 256 bit integers. */
#if SBITMAP_ELT_BITS 255
@@ -53,7 +56,7 @@ typedef const SBITMAP_ELT_TYPE *const_sb
/* Verify the population count of sbitmap A matches the cached value,
if there is a cached value. */
-void
+static void
sbitmap_verify_popcount (const_sbitmap a)
{
unsigned ix;
@@ -245,16 +248,6 @@ bitmap_copy (sbitmap dst, const_sbitmap
memcpy (dst-popcount, src-popcount, sizeof (unsigned char) * dst-size);
}
-/* Copy the first N elements of sbitmap SRC to DST. */
-
-void
-bitmap_copy_n (sbitmap dst, const_sbitmap src, unsigned int n)
-{
- memcpy (dst-elms, src-elms, sizeof (SBITMAP_ELT_TYPE) * n);
- if (dst-popcount)
-memcpy (dst-popcount, src-popcount, sizeof (unsigned char) * n);
-}
-
/* Determine if a == b. */
int
bitmap_equal_p (const_sbitmap a, const_sbitmap b)
@@ -275,56 +268,6 @@ bitmap_empty_p (const_sbitmap bmap)
return true;
}
-/* Return false if any of the N bits are set in MAP starting at
- START. */
-
-bool
-bitmap_range_empty_p (const_sbitmap bmap, unsigned int start, unsigned int n)
-{
- unsigned int i = start / SBITMAP_ELT_BITS;
- SBITMAP_ELT_TYPE elm;
- unsigned int shift = start % SBITMAP_ELT_BITS;
-
- gcc_assert (bmap-n_bits = start + n);
-
- elm = bmap-elms[i];
- elm = elm shift;
-
- if (shift + n = SBITMAP_ELT_BITS)
-{
- /* The bits are totally contained in a single element. */
- if (shift + n SBITMAP_ELT_BITS)
-elm = ((1 n) - 1);
- return (elm == 0);
-}
-
- if (elm)
-return false;
-
- n -= SBITMAP_ELT_BITS - shift;
- i++;
-
- /* Deal with full elts. */
- while (n = SBITMAP_ELT_BITS)
-{
- if (bmap-elms[i])
- return false;
- i++;
- n -= SBITMAP_ELT_BITS;
-}
-
- /* The leftover bits. */
- if (n)
-{
- elm = bmap-elms[i];
- elm = ((1 n) - 1);
- return (elm == 0);
-}
-
- return true;
-}
-
-
/* Zero all elements in a bitmap. */
@@ -790,50 +733,3 @@ sbitmap_elt_popcount (SBITMAP_ELT_TYPE a
return ret;
}
#endif
-
-/* Count the number of bits in SBITMAP a, up to bit MAXBIT. */
-
-unsigned long
-sbitmap_popcount (const_sbitmap a, unsigned long maxbit)
-{
- unsigned long count = 0;
- unsigned ix;
- unsigned int lastword;
-
- if (maxbit == 0)
-return 0;
-
- if (maxbit = a-n_bits)
-maxbit = a-n_bits;
-
- /* Count the bits in the full word. */
- lastword = MIN (a-size, SBITMAP_SET_SIZE (maxbit + 1) - 1);
- for (ix = 0; ix lastword; ix++)
-{
- if (a-popcount)
- {
- count += a-popcount[ix];
-#ifdef BITMAP_DEBUGGING
- gcc_assert (a-popcount[ix] == do_popcount (a-elms[ix]));
-#endif
- }
- else
- count += do_popcount (a-elms[ix]);
-}
-
- /* Count the remaining bits. */
- if (lastword a-size)
-{
- unsigned int bitindex;
- SBITMAP_ELT_TYPE theword = a-elms[lastword];
-
- bitindex = maxbit % SBITMAP_ELT_BITS;
- if (bitindex != 0)
- {
- theword = (SBITMAP_ELT_TYPE)-1 (SBITMAP_ELT_BITS - bitindex);
- count += do_popcount (theword);
- }
-}
- return count;
-}
-
Index: gcc/sbitmap.h
===
--- gcc/sbitmap.h (revision 193049)
+++ gcc/sbitmap.h (working copy)
@@ -42,11 +42,10 @@ along with GCC;