summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/bitmap.c
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2004-07-28 03:11:36 +0000
committerkan <kan@FreeBSD.org>2004-07-28 03:11:36 +0000
commit5e00ec74d8ce58f99801200d4d3d0412c7cc1b28 (patch)
tree052f4bb635f2bea2c5e350bd60c902be100a0d1e /contrib/gcc/bitmap.c
parent87b8398a7d9f9bf0e28bbcd54a4fc27db2125f38 (diff)
downloadFreeBSD-src-5e00ec74d8ce58f99801200d4d3d0412c7cc1b28.zip
FreeBSD-src-5e00ec74d8ce58f99801200d4d3d0412c7cc1b28.tar.gz
Gcc 3.4.2 20040728.
Diffstat (limited to 'contrib/gcc/bitmap.c')
-rw-r--r--contrib/gcc/bitmap.c153
1 files changed, 47 insertions, 106 deletions
diff --git a/contrib/gcc/bitmap.c b/contrib/gcc/bitmap.c
index 917e87b..bffd915 100644
--- a/contrib/gcc/bitmap.c
+++ b/contrib/gcc/bitmap.c
@@ -21,6 +21,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "rtl.h"
#include "flags.h"
#include "obstack.h"
@@ -44,18 +46,16 @@ bitmap_element bitmap_zero_bits; /* An element of all zero bits. */
static bitmap_element *bitmap_free; /* Freelist of bitmap elements. */
static GTY((deletable (""))) bitmap_element *bitmap_ggc_free;
-static void bitmap_elem_to_freelist PARAMS ((bitmap, bitmap_element *));
-static void bitmap_element_free PARAMS ((bitmap, bitmap_element *));
-static bitmap_element *bitmap_element_allocate PARAMS ((bitmap));
-static int bitmap_element_zerop PARAMS ((bitmap_element *));
-static void bitmap_element_link PARAMS ((bitmap, bitmap_element *));
-static bitmap_element *bitmap_find_bit PARAMS ((bitmap, unsigned int));
+static void bitmap_elem_to_freelist (bitmap, bitmap_element *);
+static void bitmap_element_free (bitmap, bitmap_element *);
+static bitmap_element *bitmap_element_allocate (bitmap);
+static int bitmap_element_zerop (bitmap_element *);
+static void bitmap_element_link (bitmap, bitmap_element *);
+static bitmap_element *bitmap_find_bit (bitmap, unsigned int);
/* Add ELEM to the appropriate freelist. */
static INLINE void
-bitmap_elem_to_freelist (head, elt)
- bitmap head;
- bitmap_element *elt;
+bitmap_elem_to_freelist (bitmap head, bitmap_element *elt)
{
if (head->using_obstack)
{
@@ -73,9 +73,7 @@ bitmap_elem_to_freelist (head, elt)
bitmap_obstack, "free" actually means "put onto the freelist". */
static INLINE void
-bitmap_element_free (head, elt)
- bitmap head;
- bitmap_element *elt;
+bitmap_element_free (bitmap head, bitmap_element *elt)
{
bitmap_element *next = elt->next;
bitmap_element *prev = elt->prev;
@@ -103,8 +101,7 @@ bitmap_element_free (head, elt)
/* Allocate a bitmap element. The bits are cleared, but nothing else is. */
static INLINE bitmap_element *
-bitmap_element_allocate (head)
- bitmap head;
+bitmap_element_allocate (bitmap head)
{
bitmap_element *element;
@@ -123,31 +120,18 @@ bitmap_element_allocate (head)
if (!bitmap_obstack_init)
{
bitmap_obstack_init = TRUE;
-
- /* Let particular systems override the size of a chunk. */
-#ifndef OBSTACK_CHUNK_SIZE
-#define OBSTACK_CHUNK_SIZE 0
-#endif
- /* Let them override the alloc and free routines too. */
-#ifndef OBSTACK_CHUNK_ALLOC
-#define OBSTACK_CHUNK_ALLOC xmalloc
-#endif
-#ifndef OBSTACK_CHUNK_FREE
-#define OBSTACK_CHUNK_FREE free
-#endif
-
+
#if !defined(__GNUC__) || (__GNUC__ < 2)
#define __alignof__(type) 0
#endif
-
+
obstack_specify_allocation (&bitmap_obstack, OBSTACK_CHUNK_SIZE,
__alignof__ (bitmap_element),
- (void *(*) PARAMS ((long))) OBSTACK_CHUNK_ALLOC,
- (void (*) PARAMS ((void *))) OBSTACK_CHUNK_FREE);
+ obstack_chunk_alloc,
+ obstack_chunk_free);
}
-
- element = (bitmap_element *) obstack_alloc (&bitmap_obstack,
- sizeof (bitmap_element));
+
+ element = obstack_alloc (&bitmap_obstack, sizeof (bitmap_element));
}
}
else
@@ -169,7 +153,7 @@ bitmap_element_allocate (head)
/* Release any memory allocated by bitmaps. */
void
-bitmap_release_memory ()
+bitmap_release_memory (void)
{
bitmap_free = 0;
if (bitmap_obstack_init)
@@ -182,8 +166,7 @@ bitmap_release_memory ()
/* Return nonzero if all bits in an element are zero. */
static INLINE int
-bitmap_element_zerop (element)
- bitmap_element *element;
+bitmap_element_zerop (bitmap_element *element)
{
#if BITMAP_ELEMENT_WORDS == 2
return (element->bits[0] | element->bits[1]) == 0;
@@ -201,9 +184,7 @@ bitmap_element_zerop (element)
/* Link the bitmap element into the current bitmap linked list. */
static INLINE void
-bitmap_element_link (head, element)
- bitmap head;
- bitmap_element *element;
+bitmap_element_link (bitmap head, bitmap_element *element)
{
unsigned int indx = element->indx;
bitmap_element *ptr;
@@ -258,8 +239,7 @@ bitmap_element_link (head, element)
/* Clear a bitmap by freeing the linked list. */
INLINE void
-bitmap_clear (head)
- bitmap head;
+bitmap_clear (bitmap head)
{
bitmap_element *element, *next;
@@ -275,9 +255,7 @@ bitmap_clear (head)
/* Copy a bitmap to another bitmap. */
void
-bitmap_copy (to, from)
- bitmap to;
- bitmap from;
+bitmap_copy (bitmap to, bitmap from)
{
bitmap_element *from_ptr, *to_ptr = 0;
#if BITMAP_ELEMENT_WORDS != 2
@@ -286,7 +264,7 @@ bitmap_copy (to, from)
bitmap_clear (to);
- /* Copy elements in forward direction one at a time */
+ /* Copy elements in forward direction one at a time. */
for (from_ptr = from->first; from_ptr; from_ptr = from_ptr->next)
{
bitmap_element *to_elt = bitmap_element_allocate (to);
@@ -326,9 +304,7 @@ bitmap_copy (to, from)
faster. */
static INLINE bitmap_element *
-bitmap_find_bit (head, bit)
- bitmap head;
- unsigned int bit;
+bitmap_find_bit (bitmap head, unsigned int bit)
{
bitmap_element *element;
unsigned int indx = bit / BITMAP_ELEMENT_ALL_BITS;
@@ -362,9 +338,7 @@ bitmap_find_bit (head, bit)
/* Clear a single bit in a bitmap. */
void
-bitmap_clear_bit (head, bit)
- bitmap head;
- int bit;
+bitmap_clear_bit (bitmap head, int bit)
{
bitmap_element *ptr = bitmap_find_bit (head, bit);
@@ -374,7 +348,7 @@ bitmap_clear_bit (head, bit)
unsigned word_num = bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS;
ptr->bits[word_num] &= ~ (((BITMAP_WORD) 1) << bit_num);
- /* If we cleared the entire word, free up the element */
+ /* If we cleared the entire word, free up the element. */
if (bitmap_element_zerop (ptr))
bitmap_element_free (head, ptr);
}
@@ -383,9 +357,7 @@ bitmap_clear_bit (head, bit)
/* Set a single bit in a bitmap. */
void
-bitmap_set_bit (head, bit)
- bitmap head;
- int bit;
+bitmap_set_bit (bitmap head, int bit)
{
bitmap_element *ptr = bitmap_find_bit (head, bit);
unsigned word_num = bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS;
@@ -406,9 +378,7 @@ bitmap_set_bit (head, bit)
/* Return whether a bit is set within a bitmap. */
int
-bitmap_bit_p (head, bit)
- bitmap head;
- int bit;
+bitmap_bit_p (bitmap head, int bit)
{
bitmap_element *ptr;
unsigned bit_num;
@@ -428,8 +398,7 @@ bitmap_bit_p (head, bit)
if the bitmap is empty. */
int
-bitmap_first_set_bit (a)
- bitmap a;
+bitmap_first_set_bit (bitmap a)
{
bitmap_element *ptr = a->first;
BITMAP_WORD word;
@@ -481,8 +450,7 @@ bitmap_first_set_bit (a)
if the bitmap is empty. */
int
-bitmap_last_set_bit (a)
- bitmap a;
+bitmap_last_set_bit (bitmap a)
{
bitmap_element *ptr = a->first;
BITMAP_WORD word;
@@ -534,11 +502,8 @@ bitmap_last_set_bit (a)
a specific bit manipulation. Return true if TO changes. */
int
-bitmap_operation (to, from1, from2, operation)
- bitmap to;
- bitmap from1;
- bitmap from2;
- enum bitmap_bits operation;
+bitmap_operation (bitmap to, bitmap from1, bitmap from2,
+ enum bitmap_bits operation)
{
#define HIGHEST_INDEX (unsigned int) ~0
@@ -697,14 +662,12 @@ bitmap_operation (to, from1, from2, operation)
/* Return true if two bitmaps are identical. */
int
-bitmap_equal_p (a, b)
- bitmap a;
- bitmap b;
+bitmap_equal_p (bitmap a, bitmap b)
{
bitmap_head c;
int ret;
- memset (&c, 0, sizeof (c));
+ memset (&c, 0, sizeof (c));
ret = ! bitmap_operation (&c, a, b, BITMAP_XOR);
bitmap_clear (&c);
@@ -715,10 +678,7 @@ bitmap_equal_p (a, b)
bitmap FROM2. */
void
-bitmap_ior_and_compl (to, from1, from2)
- bitmap to;
- bitmap from1;
- bitmap from2;
+bitmap_ior_and_compl (bitmap to, bitmap from1, bitmap from2)
{
bitmap_head tmp;
@@ -731,11 +691,7 @@ bitmap_ior_and_compl (to, from1, from2)
}
int
-bitmap_union_of_diff (dst, a, b, c)
- bitmap dst;
- bitmap a;
- bitmap b;
- bitmap c;
+bitmap_union_of_diff (bitmap dst, bitmap a, bitmap b, bitmap c)
{
bitmap_head tmp;
int changed;
@@ -753,13 +709,11 @@ bitmap_union_of_diff (dst, a, b, c)
/* Initialize a bitmap header. */
bitmap
-bitmap_initialize (head, using_obstack)
- bitmap head;
- int using_obstack;
+bitmap_initialize (bitmap head, int using_obstack)
{
if (head == NULL && ! using_obstack)
head = ggc_alloc (sizeof (*head));
-
+
head->first = head->current = 0;
head->using_obstack = using_obstack;
@@ -769,29 +723,21 @@ bitmap_initialize (head, using_obstack)
/* Debugging function to print out the contents of a bitmap. */
void
-debug_bitmap_file (file, head)
- FILE *file;
- bitmap head;
+debug_bitmap_file (FILE *file, bitmap head)
{
bitmap_element *ptr;
- fprintf (file, "\nfirst = ");
- fprintf (file, HOST_PTR_PRINTF, (PTR) head->first);
- fprintf (file, " current = ");
- fprintf (file, HOST_PTR_PRINTF, (PTR) head->current);
- fprintf (file, " indx = %u\n", head->indx);
+ fprintf (file, "\nfirst = " HOST_PTR_PRINTF
+ " current = " HOST_PTR_PRINTF " indx = %u\n",
+ (void *) head->first, (void *) head->current, head->indx);
for (ptr = head->first; ptr; ptr = ptr->next)
{
unsigned int i, j, col = 26;
- fprintf (file, "\t");
- fprintf (file, HOST_PTR_PRINTF, (PTR) ptr);
- fprintf (file, " next = ");
- fprintf (file, HOST_PTR_PRINTF, (PTR) ptr->next);
- fprintf (file, " prev = ");
- fprintf (file, HOST_PTR_PRINTF, (PTR) ptr->prev);
- fprintf (file, " indx = %u\n\t\tbits = {", ptr->indx);
+ fprintf (file, "\t" HOST_PTR_PRINTF " next = " HOST_PTR_PRINTF
+ " prev = " HOST_PTR_PRINTF " indx = %u\n\t\tbits = {",
+ (void*) ptr, (void*) ptr->next, (void*) ptr->prev, ptr->indx);
for (i = 0; i < BITMAP_ELEMENT_WORDS; i++)
for (j = 0; j < BITMAP_WORD_BITS; j++)
@@ -816,8 +762,7 @@ debug_bitmap_file (file, head)
of a bitmap. */
void
-debug_bitmap (head)
- bitmap head;
+debug_bitmap (bitmap head)
{
debug_bitmap_file (stdout, head);
}
@@ -826,11 +771,7 @@ debug_bitmap (head)
it does not print anything but the bits. */
void
-bitmap_print (file, head, prefix, suffix)
- FILE *file;
- bitmap head;
- const char *prefix;
- const char *suffix;
+bitmap_print (FILE *file, bitmap head, const char *prefix, const char *suffix)
{
const char *comma = "";
int i;
OpenPOWER on IntegriCloud