OSDN Git Service

* config/alpha/alpha.c (alpha_emit_floatuns): Ensure we pass a REG
[pf3gnuchains/gcc-fork.git] / gcc / bitmap.c
index 37815e6..99b5f5a 100644 (file)
@@ -1,5 +1,5 @@
 /* Functions to support general ended bitmaps.
-   Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -42,11 +42,11 @@ static int bitmap_obstack_init = FALSE;
 bitmap_element bitmap_zero;            /* An element of all zero bits. */
 bitmap_element *bitmap_free;           /* Freelist of bitmap elements. */
 
-static void bitmap_element_free                PROTO((bitmap, bitmap_element *));
-static bitmap_element *bitmap_element_allocate PROTO((void));
-static int bitmap_element_zerop                PROTO((bitmap_element *));
-static void bitmap_element_link                PROTO((bitmap, bitmap_element *));
-static bitmap_element *bitmap_find_bit PROTO((bitmap, unsigned int));
+static void bitmap_element_free                PARAMS ((bitmap, bitmap_element *));
+static bitmap_element *bitmap_element_allocate PARAMS ((void));
+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));
 \f
 /* Free a bitmap element */
 
@@ -395,10 +395,12 @@ bitmap_operation (to, from1, from2, operation)
      bitmap from2;
      enum bitmap_bits operation;
 {
+#define HIGHEST_INDEX (unsigned int) ~0
+
   bitmap_element *from1_ptr = from1->first;
   bitmap_element *from2_ptr = from2->first;
-  unsigned int indx1 = (from1_ptr) ? from1_ptr->indx : -1;
-  unsigned int indx2 = (from2_ptr) ? from2_ptr->indx : -1;
+  unsigned int indx1 = (from1_ptr) ? from1_ptr->indx : HIGHEST_INDEX;
+  unsigned int indx2 = (from2_ptr) ? from2_ptr->indx : HIGHEST_INDEX;
   bitmap_element *to_ptr = to->first;
   bitmap_element *from1_tmp;
   bitmap_element *from2_tmp;
@@ -449,9 +451,9 @@ bitmap_operation (to, from1, from2, operation)
          from1_tmp = from1_ptr;
          from2_tmp = from2_ptr;
          from1_ptr = from1_ptr->next;
-         indx1 = (from1_ptr) ? from1_ptr->indx : -1;
+         indx1 = (from1_ptr) ? from1_ptr->indx : HIGHEST_INDEX;
          from2_ptr = from2_ptr->next;
-         indx2 = (from2_ptr) ? from2_ptr->indx : -1;
+         indx2 = (from2_ptr) ? from2_ptr->indx : HIGHEST_INDEX;
        }
       else if (indx1 < indx2)
        {
@@ -459,7 +461,7 @@ bitmap_operation (to, from1, from2, operation)
          from1_tmp = from1_ptr;
          from2_tmp = &bitmap_zero;
          from1_ptr = from1_ptr->next;
-         indx1 = (from1_ptr) ? from1_ptr->indx : -1;
+         indx1 = (from1_ptr) ? from1_ptr->indx : HIGHEST_INDEX;
        }
       else
        {
@@ -467,7 +469,7 @@ bitmap_operation (to, from1, from2, operation)
          from1_tmp = &bitmap_zero;
          from2_tmp = from2_ptr;
          from2_ptr = from2_ptr->next;
-         indx2 = (from2_ptr) ? from2_ptr->indx : -1;
+         indx2 = (from2_ptr) ? from2_ptr->indx : HIGHEST_INDEX;
        }
 
       /* Find the appropriate element from TO.  Begin by discarding
@@ -477,7 +479,7 @@ bitmap_operation (to, from1, from2, operation)
          changed = 1;
          to_tmp = to_ptr;
          to_ptr = to_ptr->next;
-         to_tmp = bitmap_free;
+         to_tmp->next = bitmap_free;
          bitmap_free = to_tmp;
        }
       if (to_ptr && to_ptr->indx == indx)
@@ -517,6 +519,11 @@ bitmap_operation (to, from1, from2, operation)
          to_tmp->indx = indx;
          bitmap_element_link (to, to_tmp);
        }
+      else
+       {
+         to_tmp->next = bitmap_free;
+         bitmap_free = to_tmp;
+       }
     }
 
   /* If we have elements of TO left over, free the lot.  */