+/* Remove ELT and all following elements from bitmap HEAD. */
+
+void
+bitmap_elt_clear_from (bitmap head, bitmap_element *elt)
+{
+ bitmap_element *next;
+
+ while (elt)
+ {
+ next = elt->next;
+ bitmap_element_free (head, elt);
+ elt = next;
+ }
+}
+
+/* Clear a bitmap by freeing the linked list. */
+
+inline void
+bitmap_clear (bitmap head)
+{
+ bitmap_element *element, *next;
+
+ for (element = head->first; element != 0; element = next)
+ {
+ next = element->next;
+ bitmap_elem_to_freelist (head, element);
+ }
+
+ head->first = head->current = 0;
+}
+\f
+/* Initialize a bitmap obstack. If BIT_OBSTACK is NULL, initialize
+ the default bitmap obstack. */
+
+void
+bitmap_obstack_initialize (bitmap_obstack *bit_obstack)
+{
+ if (!bit_obstack)
+ bit_obstack = &bitmap_default_obstack;
+
+#if !defined(__GNUC__) || (__GNUC__ < 2)
+#define __alignof__(type) 0
+#endif
+
+ bit_obstack->elements = NULL;
+ bit_obstack->heads = NULL;
+ obstack_specify_allocation (&bit_obstack->obstack, OBSTACK_CHUNK_SIZE,
+ __alignof__ (bitmap_element),
+ obstack_chunk_alloc,
+ obstack_chunk_free);
+}
+
+/* Release the memory from a bitmap obstack. If BIT_OBSTACK is NULL,
+ release the default bitmap obstack. */
+
+void
+bitmap_obstack_release (bitmap_obstack *bit_obstack)
+{
+ if (!bit_obstack)
+ bit_obstack = &bitmap_default_obstack;
+
+ bit_obstack->elements = NULL;
+ bit_obstack->heads = NULL;
+ obstack_free (&bit_obstack->obstack, NULL);
+}
+
+/* Create a new bitmap on an obstack. If BIT_OBSTACK is NULL, create
+ it on the default bitmap obstack. */
+
+bitmap
+bitmap_obstack_alloc (bitmap_obstack *bit_obstack)
+{
+ bitmap map;
+
+ if (!bit_obstack)
+ bit_obstack = &bitmap_default_obstack;
+ map = bit_obstack->heads;
+ if (map)
+ bit_obstack->heads = (void *)map->first;
+ else
+ map = XOBNEW (&bit_obstack->obstack, bitmap_head);
+ bitmap_initialize (map, bit_obstack);
+
+ return map;
+}
+
+/* Create a new GCd bitmap. */
+
+bitmap
+bitmap_gc_alloc (void)
+{
+ bitmap map;
+
+ map = GGC_NEW (struct bitmap_head_def);
+ bitmap_initialize (map, NULL);
+
+ return map;
+}
+
+/* Release an obstack allocated bitmap. */