OSDN Git Service

* alloc-pool.c: Convert to ISO C90 prototypes.
[pf3gnuchains/gcc-fork.git] / gcc / bitmap.c
1 /* Functions to support general ended bitmaps.
2    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003
3    Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
11
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING.  If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA.  */
21
22 #include "config.h"
23 #include "system.h"
24 #include "coretypes.h"
25 #include "tm.h"
26 #include "rtl.h"
27 #include "flags.h"
28 #include "obstack.h"
29 #include "ggc.h"
30 #include "bitmap.h"
31
32 /* Obstack to allocate bitmap elements from.  */
33 static struct obstack bitmap_obstack;
34 static int bitmap_obstack_init = FALSE;
35 \f
36 #ifndef INLINE
37 #ifndef __GNUC__
38 #define INLINE
39 #else
40 #define INLINE __inline__
41 #endif
42 #endif
43
44 /* Global data */
45 bitmap_element bitmap_zero_bits;        /* An element of all zero bits.  */
46 static bitmap_element *bitmap_free;     /* Freelist of bitmap elements.  */
47 static GTY((deletable (""))) bitmap_element *bitmap_ggc_free;
48
49 static void bitmap_elem_to_freelist (bitmap, bitmap_element *);
50 static void bitmap_element_free (bitmap, bitmap_element *);
51 static bitmap_element *bitmap_element_allocate (bitmap);
52 static int bitmap_element_zerop (bitmap_element *);
53 static void bitmap_element_link (bitmap, bitmap_element *);
54 static bitmap_element *bitmap_find_bit (bitmap, unsigned int);
55 \f
56 /* Add ELEM to the appropriate freelist.  */
57 static INLINE void
58 bitmap_elem_to_freelist (bitmap head, bitmap_element *elt)
59 {
60   if (head->using_obstack)
61     {
62       elt->next = bitmap_free;
63       bitmap_free = elt;
64     }
65   else
66     {
67       elt->next = bitmap_ggc_free;
68       bitmap_ggc_free = elt;
69     }
70 }
71
72 /* Free a bitmap element.  Since these are allocated off the
73    bitmap_obstack, "free" actually means "put onto the freelist".  */
74
75 static INLINE void
76 bitmap_element_free (bitmap head, bitmap_element *elt)
77 {
78   bitmap_element *next = elt->next;
79   bitmap_element *prev = elt->prev;
80
81   if (prev)
82     prev->next = next;
83
84   if (next)
85     next->prev = prev;
86
87   if (head->first == elt)
88     head->first = next;
89
90   /* Since the first thing we try is to insert before current,
91      make current the next entry in preference to the previous.  */
92   if (head->current == elt)
93     {
94       head->current = next != 0 ? next : prev;
95       if (head->current)
96         head->indx = head->current->indx;
97     }
98   bitmap_elem_to_freelist (head, elt);
99 }
100 \f
101 /* Allocate a bitmap element.  The bits are cleared, but nothing else is.  */
102
103 static INLINE bitmap_element *
104 bitmap_element_allocate (bitmap head)
105 {
106   bitmap_element *element;
107
108   if (head->using_obstack)
109     {
110       if (bitmap_free != 0)
111         {
112           element = bitmap_free;
113           bitmap_free = element->next;
114         }
115       else
116         {
117           /* We can't use gcc_obstack_init to initialize the obstack since
118              print-rtl.c now calls bitmap functions, and bitmap is linked
119              into the gen* functions.  */
120           if (!bitmap_obstack_init)
121             {
122               bitmap_obstack_init = TRUE;
123
124 #if !defined(__GNUC__) || (__GNUC__ < 2)
125 #define __alignof__(type) 0
126 #endif
127
128               obstack_specify_allocation (&bitmap_obstack, OBSTACK_CHUNK_SIZE,
129                                           __alignof__ (bitmap_element),
130                                           obstack_chunk_alloc,
131                                           obstack_chunk_free);
132             }
133
134           element = (bitmap_element *) obstack_alloc (&bitmap_obstack,
135                                                       sizeof (bitmap_element));
136         }
137     }
138   else
139     {
140       if (bitmap_ggc_free != NULL)
141         {
142           element = bitmap_ggc_free;
143           bitmap_ggc_free = element->next;
144         }
145       else
146         element = ggc_alloc (sizeof (bitmap_element));
147     }
148
149   memset (element->bits, 0, sizeof (element->bits));
150
151   return element;
152 }
153
154 /* Release any memory allocated by bitmaps.  */
155
156 void
157 bitmap_release_memory (void)
158 {
159   bitmap_free = 0;
160   if (bitmap_obstack_init)
161     {
162       bitmap_obstack_init = FALSE;
163       obstack_free (&bitmap_obstack, NULL);
164     }
165 }
166
167 /* Return nonzero if all bits in an element are zero.  */
168
169 static INLINE int
170 bitmap_element_zerop (bitmap_element *element)
171 {
172 #if BITMAP_ELEMENT_WORDS == 2
173   return (element->bits[0] | element->bits[1]) == 0;
174 #else
175   int i;
176
177   for (i = 0; i < BITMAP_ELEMENT_WORDS; i++)
178     if (element->bits[i] != 0)
179       return 0;
180
181   return 1;
182 #endif
183 }
184 \f
185 /* Link the bitmap element into the current bitmap linked list.  */
186
187 static INLINE void
188 bitmap_element_link (bitmap head, bitmap_element *element)
189 {
190   unsigned int indx = element->indx;
191   bitmap_element *ptr;
192
193   /* If this is the first and only element, set it in.  */
194   if (head->first == 0)
195     {
196       element->next = element->prev = 0;
197       head->first = element;
198     }
199
200   /* If this index is less than that of the current element, it goes someplace
201      before the current element.  */
202   else if (indx < head->indx)
203     {
204       for (ptr = head->current;
205            ptr->prev != 0 && ptr->prev->indx > indx;
206            ptr = ptr->prev)
207         ;
208
209       if (ptr->prev)
210         ptr->prev->next = element;
211       else
212         head->first = element;
213
214       element->prev = ptr->prev;
215       element->next = ptr;
216       ptr->prev = element;
217     }
218
219   /* Otherwise, it must go someplace after the current element.  */
220   else
221     {
222       for (ptr = head->current;
223            ptr->next != 0 && ptr->next->indx < indx;
224            ptr = ptr->next)
225         ;
226
227       if (ptr->next)
228         ptr->next->prev = element;
229
230       element->next = ptr->next;
231       element->prev = ptr;
232       ptr->next = element;
233     }
234
235   /* Set up so this is the first element searched.  */
236   head->current = element;
237   head->indx = indx;
238 }
239 \f
240 /* Clear a bitmap by freeing the linked list.  */
241
242 INLINE void
243 bitmap_clear (bitmap head)
244 {
245   bitmap_element *element, *next;
246
247   for (element = head->first; element != 0; element = next)
248     {
249       next = element->next;
250       bitmap_elem_to_freelist (head, element);
251     }
252
253   head->first = head->current = 0;
254 }
255 \f
256 /* Copy a bitmap to another bitmap.  */
257
258 void
259 bitmap_copy (bitmap to, bitmap from)
260 {
261   bitmap_element *from_ptr, *to_ptr = 0;
262 #if BITMAP_ELEMENT_WORDS != 2
263   int i;
264 #endif
265
266   bitmap_clear (to);
267
268   /* Copy elements in forward direction one at a time */
269   for (from_ptr = from->first; from_ptr; from_ptr = from_ptr->next)
270     {
271       bitmap_element *to_elt = bitmap_element_allocate (to);
272
273       to_elt->indx = from_ptr->indx;
274
275 #if BITMAP_ELEMENT_WORDS == 2
276       to_elt->bits[0] = from_ptr->bits[0];
277       to_elt->bits[1] = from_ptr->bits[1];
278 #else
279       for (i = 0; i < BITMAP_ELEMENT_WORDS; i++)
280         to_elt->bits[i] = from_ptr->bits[i];
281 #endif
282
283       /* Here we have a special case of bitmap_element_link, for the case
284          where we know the links are being entered in sequence.  */
285       if (to_ptr == 0)
286         {
287           to->first = to->current = to_elt;
288           to->indx = from_ptr->indx;
289           to_elt->next = to_elt->prev = 0;
290         }
291       else
292         {
293           to_elt->prev = to_ptr;
294           to_elt->next = 0;
295           to_ptr->next = to_elt;
296         }
297
298       to_ptr = to_elt;
299     }
300 }
301 \f
302 /* Find a bitmap element that would hold a bitmap's bit.
303    Update the `current' field even if we can't find an element that
304    would hold the bitmap's bit to make eventual allocation
305    faster.  */
306
307 static INLINE bitmap_element *
308 bitmap_find_bit (bitmap head, unsigned int bit)
309 {
310   bitmap_element *element;
311   unsigned int indx = bit / BITMAP_ELEMENT_ALL_BITS;
312
313   if (head->current == 0
314       || head->indx == indx)
315     return head->current;
316
317   if (head->indx > indx)
318     for (element = head->current;
319          element->prev != 0 && element->indx > indx;
320          element = element->prev)
321       ;
322
323   else
324     for (element = head->current;
325          element->next != 0 && element->indx < indx;
326          element = element->next)
327       ;
328
329   /* `element' is the nearest to the one we want.  If it's not the one we
330      want, the one we want doesn't exist.  */
331   head->current = element;
332   head->indx = element->indx;
333   if (element != 0 && element->indx != indx)
334     element = 0;
335
336   return element;
337 }
338 \f
339 /* Clear a single bit in a bitmap.  */
340
341 void
342 bitmap_clear_bit (bitmap head, int bit)
343 {
344   bitmap_element *ptr = bitmap_find_bit (head, bit);
345
346   if (ptr != 0)
347     {
348       unsigned bit_num  = bit % BITMAP_WORD_BITS;
349       unsigned word_num = bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS;
350       ptr->bits[word_num] &= ~ (((BITMAP_WORD) 1) << bit_num);
351
352       /* If we cleared the entire word, free up the element */
353       if (bitmap_element_zerop (ptr))
354         bitmap_element_free (head, ptr);
355     }
356 }
357
358 /* Set a single bit in a bitmap.  */
359
360 void
361 bitmap_set_bit (bitmap head, int bit)
362 {
363   bitmap_element *ptr = bitmap_find_bit (head, bit);
364   unsigned word_num = bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS;
365   unsigned bit_num  = bit % BITMAP_WORD_BITS;
366   BITMAP_WORD bit_val = ((BITMAP_WORD) 1) << bit_num;
367
368   if (ptr == 0)
369     {
370       ptr = bitmap_element_allocate (head);
371       ptr->indx = bit / BITMAP_ELEMENT_ALL_BITS;
372       ptr->bits[word_num] = bit_val;
373       bitmap_element_link (head, ptr);
374     }
375   else
376     ptr->bits[word_num] |= bit_val;
377 }
378
379 /* Return whether a bit is set within a bitmap.  */
380
381 int
382 bitmap_bit_p (bitmap head, int bit)
383 {
384   bitmap_element *ptr;
385   unsigned bit_num;
386   unsigned word_num;
387
388   ptr = bitmap_find_bit (head, bit);
389   if (ptr == 0)
390     return 0;
391
392   bit_num = bit % BITMAP_WORD_BITS;
393   word_num = bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS;
394
395   return (ptr->bits[word_num] >> bit_num) & 1;
396 }
397 \f
398 /* Return the bit number of the first set bit in the bitmap, or -1
399    if the bitmap is empty.  */
400
401 int
402 bitmap_first_set_bit (bitmap a)
403 {
404   bitmap_element *ptr = a->first;
405   BITMAP_WORD word;
406   unsigned word_num, bit_num;
407
408   if (ptr == NULL)
409     return -1;
410
411 #if BITMAP_ELEMENT_WORDS == 2
412   word_num = 0, word = ptr->bits[0];
413   if (word == 0)
414     word_num = 1, word = ptr->bits[1];
415 #else
416   for (word_num = 0; word_num < BITMAP_ELEMENT_WORDS; ++word_num)
417     if ((word = ptr->bits[word_num]) != 0)
418       break;
419 #endif
420
421   /* Binary search for the first set bit.  */
422   /* ??? It'd be nice to know if ffs or ffsl was available.  */
423
424   bit_num = 0;
425   word = word & -word;
426
427 #if nBITMAP_WORD_BITS > 64
428  #error "Fill out the table."
429 #endif
430 #if nBITMAP_WORD_BITS > 32
431   if ((word & 0xffffffff) == 0)
432     word >>= 32, bit_num += 32;
433 #endif
434   if ((word & 0xffff) == 0)
435     word >>= 16, bit_num += 16;
436   if ((word & 0xff) == 0)
437     word >>= 8, bit_num += 8;
438   if (word & 0xf0)
439     bit_num += 4;
440   if (word & 0xcc)
441     bit_num += 2;
442   if (word & 0xaa)
443     bit_num += 1;
444
445   return (ptr->indx * BITMAP_ELEMENT_ALL_BITS
446           + word_num * BITMAP_WORD_BITS
447           + bit_num);
448 }
449
450 /* Return the bit number of the last set bit in the bitmap, or -1
451    if the bitmap is empty.  */
452
453 int
454 bitmap_last_set_bit (bitmap a)
455 {
456   bitmap_element *ptr = a->first;
457   BITMAP_WORD word;
458   unsigned word_num, bit_num;
459
460   if (ptr == NULL)
461     return -1;
462
463   while (ptr->next != NULL)
464     ptr = ptr->next;
465
466 #if BITMAP_ELEMENT_WORDS == 2
467   word_num = 1, word = ptr->bits[1];
468   if (word == 0)
469     word_num = 0, word = ptr->bits[0];
470 #else
471   for (word_num = BITMAP_ELEMENT_WORDS; word_num-- > 0; )
472     if ((word = ptr->bits[word_num]) != 0)
473       break;
474 #endif
475
476   /* Binary search for the last set bit.  */
477
478   bit_num = 0;
479 #if nBITMAP_WORD_BITS > 64
480  #error "Fill out the table."
481 #endif
482 #if nBITMAP_WORD_BITS > 32
483   if (word & ~(BITMAP_WORD)0xffffffff)
484     word >>= 32, bit_num += 32;
485 #endif
486   if (word & 0xffff0000)
487     word >>= 16, bit_num += 16;
488   if (word & 0xff00)
489     word >>= 8, bit_num += 8;
490   if (word & 0xf0)
491     word >>= 4, bit_num += 4;
492   if (word & 0xc)
493     word >>= 2, bit_num += 2;
494   if (word & 0x2)
495     bit_num += 1;
496
497   return (ptr->indx * BITMAP_ELEMENT_ALL_BITS
498           + word_num * BITMAP_WORD_BITS
499           + bit_num);
500 }
501 \f
502 /* Store in bitmap TO the result of combining bitmap FROM1 and FROM2 using
503    a specific bit manipulation.  Return true if TO changes.  */
504
505 int
506 bitmap_operation (bitmap to, bitmap from1, bitmap from2,
507                   enum bitmap_bits operation)
508 {
509 #define HIGHEST_INDEX (unsigned int) ~0
510
511   bitmap_element *from1_ptr = from1->first;
512   bitmap_element *from2_ptr = from2->first;
513   unsigned int indx1 = (from1_ptr) ? from1_ptr->indx : HIGHEST_INDEX;
514   unsigned int indx2 = (from2_ptr) ? from2_ptr->indx : HIGHEST_INDEX;
515   bitmap_element *to_ptr = to->first;
516   bitmap_element *from1_tmp;
517   bitmap_element *from2_tmp;
518   bitmap_element *to_tmp;
519   unsigned int indx;
520   int changed = 0;
521
522 #if BITMAP_ELEMENT_WORDS == 2
523 #define DOIT(OP)                                        \
524   do {                                                  \
525     BITMAP_WORD t0, t1, f10, f11, f20, f21;             \
526     f10 = from1_tmp->bits[0];                           \
527     f20 = from2_tmp->bits[0];                           \
528     t0 = f10 OP f20;                                    \
529     changed |= (t0 != to_tmp->bits[0]);                 \
530     f11 = from1_tmp->bits[1];                           \
531     f21 = from2_tmp->bits[1];                           \
532     t1 = f11 OP f21;                                    \
533     changed |= (t1 != to_tmp->bits[1]);                 \
534     to_tmp->bits[0] = t0;                               \
535     to_tmp->bits[1] = t1;                               \
536   } while (0)
537 #else
538 #define DOIT(OP)                                        \
539   do {                                                  \
540     BITMAP_WORD t, f1, f2;                              \
541     int i;                                              \
542     for (i = 0; i < BITMAP_ELEMENT_WORDS; ++i)          \
543       {                                                 \
544         f1 = from1_tmp->bits[i];                        \
545         f2 = from2_tmp->bits[i];                        \
546         t = f1 OP f2;                                   \
547         changed |= (t != to_tmp->bits[i]);              \
548         to_tmp->bits[i] = t;                            \
549       }                                                 \
550   } while (0)
551 #endif
552
553   to->first = to->current = 0;
554
555   while (from1_ptr != 0 || from2_ptr != 0)
556     {
557       /* Figure out whether we need to substitute zero elements for
558          missing links.  */
559       if (indx1 == indx2)
560         {
561           indx = indx1;
562           from1_tmp = from1_ptr;
563           from2_tmp = from2_ptr;
564           from1_ptr = from1_ptr->next;
565           indx1 = (from1_ptr) ? from1_ptr->indx : HIGHEST_INDEX;
566           from2_ptr = from2_ptr->next;
567           indx2 = (from2_ptr) ? from2_ptr->indx : HIGHEST_INDEX;
568         }
569       else if (indx1 < indx2)
570         {
571           indx = indx1;
572           from1_tmp = from1_ptr;
573           from2_tmp = &bitmap_zero_bits;
574           from1_ptr = from1_ptr->next;
575           indx1 = (from1_ptr) ? from1_ptr->indx : HIGHEST_INDEX;
576         }
577       else
578         {
579           indx = indx2;
580           from1_tmp = &bitmap_zero_bits;
581           from2_tmp = from2_ptr;
582           from2_ptr = from2_ptr->next;
583           indx2 = (from2_ptr) ? from2_ptr->indx : HIGHEST_INDEX;
584         }
585
586       /* Find the appropriate element from TO.  Begin by discarding
587          elements that we've skipped.  */
588       while (to_ptr && to_ptr->indx < indx)
589         {
590           changed = 1;
591           to_tmp = to_ptr;
592           to_ptr = to_ptr->next;
593           bitmap_elem_to_freelist (to, to_tmp);
594         }
595       if (to_ptr && to_ptr->indx == indx)
596         {
597           to_tmp = to_ptr;
598           to_ptr = to_ptr->next;
599         }
600       else
601         to_tmp = bitmap_element_allocate (to);
602
603       /* Do the operation, and if any bits are set, link it into the
604          linked list.  */
605       switch (operation)
606         {
607         default:
608           abort ();
609
610         case BITMAP_AND:
611           DOIT (&);
612           break;
613
614         case BITMAP_AND_COMPL:
615           DOIT (&~);
616           break;
617
618         case BITMAP_IOR:
619           DOIT (|);
620           break;
621         case BITMAP_IOR_COMPL:
622           DOIT (|~);
623           break;
624         case BITMAP_XOR:
625           DOIT (^);
626           break;
627         }
628
629       if (! bitmap_element_zerop (to_tmp))
630         {
631           to_tmp->indx = indx;
632           bitmap_element_link (to, to_tmp);
633         }
634       else
635         {
636           bitmap_elem_to_freelist (to, to_tmp);
637         }
638     }
639
640   /* If we have elements of TO left over, free the lot.  */
641   if (to_ptr)
642     {
643       changed = 1;
644       for (to_tmp = to_ptr; to_tmp->next ; to_tmp = to_tmp->next)
645         continue;
646       if (to->using_obstack)
647         {
648           to_tmp->next = bitmap_free;
649           bitmap_free = to_ptr;
650         }
651       else
652         {
653           to_tmp->next = bitmap_ggc_free;
654           bitmap_ggc_free = to_ptr;
655         }
656     }
657
658 #undef DOIT
659
660   return changed;
661 }
662
663 /* Return true if two bitmaps are identical.  */
664
665 int
666 bitmap_equal_p (bitmap a, bitmap b)
667 {
668   bitmap_head c;
669   int ret;
670
671   memset (&c, 0, sizeof (c));
672   ret = ! bitmap_operation (&c, a, b, BITMAP_XOR);
673   bitmap_clear (&c);
674
675   return ret;
676 }
677 \f
678 /* Or into bitmap TO bitmap FROM1 and'ed with the complement of
679    bitmap FROM2.  */
680
681 void
682 bitmap_ior_and_compl (bitmap to, bitmap from1, bitmap from2)
683 {
684   bitmap_head tmp;
685
686   tmp.first = tmp.current = 0;
687   tmp.using_obstack = 0;
688
689   bitmap_operation (&tmp, from1, from2, BITMAP_AND_COMPL);
690   bitmap_operation (to, to, &tmp, BITMAP_IOR);
691   bitmap_clear (&tmp);
692 }
693
694 int
695 bitmap_union_of_diff (bitmap dst, bitmap a, bitmap b, bitmap c)
696 {
697   bitmap_head tmp;
698   int changed;
699
700   tmp.first = tmp.current = 0;
701   tmp.using_obstack = 0;
702
703   bitmap_operation (&tmp, b, c, BITMAP_AND_COMPL);
704   changed = bitmap_operation (dst, &tmp, a, BITMAP_IOR);
705   bitmap_clear (&tmp);
706
707   return changed;
708 }
709 \f
710 /* Initialize a bitmap header.  */
711
712 bitmap
713 bitmap_initialize (bitmap head, int using_obstack)
714 {
715   if (head == NULL && ! using_obstack)
716     head = ggc_alloc (sizeof (*head));
717
718   head->first = head->current = 0;
719   head->using_obstack = using_obstack;
720
721   return head;
722 }
723 \f
724 /* Debugging function to print out the contents of a bitmap.  */
725
726 void
727 debug_bitmap_file (FILE *file, bitmap head)
728 {
729   bitmap_element *ptr;
730
731   fprintf (file, "\nfirst = ");
732   fprintf (file, HOST_PTR_PRINTF, (PTR) head->first);
733   fprintf (file, " current = ");
734   fprintf (file, HOST_PTR_PRINTF, (PTR) head->current);
735   fprintf (file, " indx = %u\n", head->indx);
736
737   for (ptr = head->first; ptr; ptr = ptr->next)
738     {
739       unsigned int i, j, col = 26;
740
741       fprintf (file, "\t");
742       fprintf (file, HOST_PTR_PRINTF, (PTR) ptr);
743       fprintf (file, " next = ");
744       fprintf (file, HOST_PTR_PRINTF, (PTR) ptr->next);
745       fprintf (file, " prev = ");
746       fprintf (file, HOST_PTR_PRINTF, (PTR) ptr->prev);
747       fprintf (file, " indx = %u\n\t\tbits = {", ptr->indx);
748
749       for (i = 0; i < BITMAP_ELEMENT_WORDS; i++)
750         for (j = 0; j < BITMAP_WORD_BITS; j++)
751           if ((ptr->bits[i] >> j) & 1)
752             {
753               if (col > 70)
754                 {
755                   fprintf (file, "\n\t\t\t");
756                   col = 24;
757                 }
758
759               fprintf (file, " %u", (ptr->indx * BITMAP_ELEMENT_ALL_BITS
760                                      + i * BITMAP_WORD_BITS + j));
761               col += 4;
762             }
763
764       fprintf (file, " }\n");
765     }
766 }
767
768 /* Function to be called from the debugger to print the contents
769    of a bitmap.  */
770
771 void
772 debug_bitmap (bitmap head)
773 {
774   debug_bitmap_file (stdout, head);
775 }
776
777 /* Function to print out the contents of a bitmap.  Unlike debug_bitmap_file,
778    it does not print anything but the bits.  */
779
780 void
781 bitmap_print (FILE *file, bitmap head, const char *prefix, const char *suffix)
782 {
783   const char *comma = "";
784   int i;
785
786   fputs (prefix, file);
787   EXECUTE_IF_SET_IN_BITMAP (head, 0, i,
788                             {
789                               fprintf (file, "%s%d", comma, i);
790                               comma = ", ";
791                             });
792   fputs (suffix, file);
793 }
794
795 #include "gt-bitmap.h"