OSDN Git Service

cp:
[pf3gnuchains/gcc-fork.git] / gcc / sbitmap.c
1 /* Simple bitmaps.
2    Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
9 version.
10
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING.  If not, write to the Free
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA.  */
20
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "tm.h"
25 #include "rtl.h"
26 #include "flags.h"
27 #include "hard-reg-set.h"
28 #include "basic-block.h"
29
30 /* Bitmap manipulation routines.  */
31
32 /* Allocate a simple bitmap of N_ELMS bits.  */
33
34 sbitmap
35 sbitmap_alloc (n_elms)
36      unsigned int n_elms;
37 {
38   unsigned int bytes, size, amt;
39   sbitmap bmap;
40
41   size = SBITMAP_SET_SIZE (n_elms);
42   bytes = size * sizeof (SBITMAP_ELT_TYPE);
43   amt = (sizeof (struct simple_bitmap_def)
44          + bytes - sizeof (SBITMAP_ELT_TYPE));
45   bmap = (sbitmap) xmalloc (amt);
46   bmap->n_bits = n_elms;
47   bmap->size = size;
48   bmap->bytes = bytes;
49   return bmap;
50 }
51
52 /* Resize a simple bitmap BMAP to N_ELMS bits.  If increasing the
53    size of BMAP, clear the new bits to zero if the DEF argument
54    is zero, and set them to one otherwise.  */
55
56 sbitmap
57 sbitmap_resize (bmap, n_elms, def)
58      sbitmap bmap;
59      unsigned int n_elms;
60      int def;
61 {
62   unsigned int bytes, size, amt;
63   unsigned int last_bit;
64
65   size = SBITMAP_SET_SIZE (n_elms);
66   bytes = size * sizeof (SBITMAP_ELT_TYPE);
67   if (bytes > bmap->bytes)
68     {
69       amt = (sizeof (struct simple_bitmap_def)
70             + bytes - sizeof (SBITMAP_ELT_TYPE));
71       bmap = (sbitmap) xrealloc (bmap, amt);
72     }
73
74   if (n_elms > bmap->n_bits)
75     {
76       if (def)
77         {
78           memset (bmap->elms + bmap->size, -1, bytes - bmap->bytes);
79
80           /* Set the new bits if the original last element.  */
81           last_bit = bmap->n_bits % SBITMAP_ELT_BITS;
82           if (last_bit)
83             bmap->elms[bmap->size - 1]
84               |= ~((SBITMAP_ELT_TYPE)-1 >> (SBITMAP_ELT_BITS - last_bit));
85
86           /* Clear the unused bit in the new last element.  */
87           last_bit = n_elms % SBITMAP_ELT_BITS;
88           if (last_bit)
89             bmap->elms[size - 1]
90               &= (SBITMAP_ELT_TYPE)-1 >> (SBITMAP_ELT_BITS - last_bit);
91         }
92       else
93         memset (bmap->elms + bmap->size, 0, bytes - bmap->bytes);
94     }
95   else if (n_elms < bmap->n_bits)
96     {
97       /* Clear the surplus bits in the last word.  */
98       last_bit = n_elms % SBITMAP_ELT_BITS;
99       if (last_bit)
100         bmap->elms[size - 1]
101           &= (SBITMAP_ELT_TYPE)-1 >> (SBITMAP_ELT_BITS - last_bit);
102     }
103
104   bmap->n_bits = n_elms;
105   bmap->size = size;
106   bmap->bytes = bytes;
107   return bmap;
108 }
109
110 /* Allocate a vector of N_VECS bitmaps of N_ELMS bits.  */
111
112 sbitmap *
113 sbitmap_vector_alloc (n_vecs, n_elms)
114      unsigned int n_vecs, n_elms;
115 {
116   unsigned int i, bytes, offset, elm_bytes, size, amt, vector_bytes;
117   sbitmap *bitmap_vector;
118
119   size = SBITMAP_SET_SIZE (n_elms);
120   bytes = size * sizeof (SBITMAP_ELT_TYPE);
121   elm_bytes = (sizeof (struct simple_bitmap_def)
122                + bytes - sizeof (SBITMAP_ELT_TYPE));
123   vector_bytes = n_vecs * sizeof (sbitmap *);
124
125   /* Round up `vector_bytes' to account for the alignment requirements
126      of an sbitmap.  One could allocate the vector-table and set of sbitmaps
127      separately, but that requires maintaining two pointers or creating
128      a cover struct to hold both pointers (so our result is still just
129      one pointer).  Neither is a bad idea, but this is simpler for now.  */
130   {
131     /* Based on DEFAULT_ALIGNMENT computation in obstack.c.  */
132     struct { char x; SBITMAP_ELT_TYPE y; } align;
133     int alignment = (char *) & align.y - & align.x;
134     vector_bytes = (vector_bytes + alignment - 1) & ~ (alignment - 1);
135   }
136
137   amt = vector_bytes + (n_vecs * elm_bytes);
138   bitmap_vector = (sbitmap *) xmalloc (amt);
139
140   for (i = 0, offset = vector_bytes; i < n_vecs; i++, offset += elm_bytes)
141     {
142       sbitmap b = (sbitmap) ((char *) bitmap_vector + offset);
143
144       bitmap_vector[i] = b;
145       b->n_bits = n_elms;
146       b->size = size;
147       b->bytes = bytes;
148     }
149
150   return bitmap_vector;
151 }
152
153 /* Copy sbitmap SRC to DST.  */
154
155 void
156 sbitmap_copy (dst, src)
157      sbitmap dst, src;
158 {
159   memcpy (dst->elms, src->elms, sizeof (SBITMAP_ELT_TYPE) * dst->size);
160 }
161
162 /* Determine if a == b.  */
163 int
164 sbitmap_equal (a, b)
165      sbitmap a, b;
166 {
167   return !memcmp (a->elms, b->elms, sizeof (SBITMAP_ELT_TYPE) * a->size);
168 }
169
170 /* Zero all elements in a bitmap.  */
171
172 void
173 sbitmap_zero (bmap)
174      sbitmap bmap;
175 {
176   memset (bmap->elms, 0, bmap->bytes);
177 }
178
179 /* Set all elements in a bitmap to ones.  */
180
181 void
182 sbitmap_ones (bmap)
183      sbitmap bmap;
184 {
185   unsigned int last_bit;
186
187   memset (bmap->elms, -1, bmap->bytes);
188
189   last_bit = bmap->n_bits % SBITMAP_ELT_BITS;
190   if (last_bit)
191     bmap->elms[bmap->size - 1]
192       = (SBITMAP_ELT_TYPE)-1 >> (SBITMAP_ELT_BITS - last_bit);
193 }
194
195 /* Zero a vector of N_VECS bitmaps.  */
196
197 void
198 sbitmap_vector_zero (bmap, n_vecs)
199      sbitmap *bmap;
200      unsigned int n_vecs;
201 {
202   unsigned int i;
203
204   for (i = 0; i < n_vecs; i++)
205     sbitmap_zero (bmap[i]);
206 }
207
208 /* Set a vector of N_VECS bitmaps to ones.  */
209
210 void
211 sbitmap_vector_ones (bmap, n_vecs)
212      sbitmap *bmap;
213      unsigned int n_vecs;
214 {
215   unsigned int i;
216
217   for (i = 0; i < n_vecs; i++)
218     sbitmap_ones (bmap[i]);
219 }
220
221 /* Set DST to be A union (B - C).
222    DST = A | (B & ~C).
223    Returns true if any change is made.  */
224
225 bool
226 sbitmap_union_of_diff_cg (dst, a, b, c)
227      sbitmap dst, a, b, c;
228 {
229   unsigned int i, n = dst->size;
230   sbitmap_ptr dstp = dst->elms;
231   sbitmap_ptr ap = a->elms;
232   sbitmap_ptr bp = b->elms;
233   sbitmap_ptr cp = c->elms;
234   SBITMAP_ELT_TYPE changed = 0;
235
236   for (i = 0; i < n; i++)
237     {
238       SBITMAP_ELT_TYPE tmp = *ap++ | (*bp++ & ~*cp++);
239       changed |= *dstp ^ tmp;
240       *dstp++ = tmp;
241     }
242
243   return changed != 0;
244 }
245
246 void
247 sbitmap_union_of_diff (dst, a, b, c)
248      sbitmap dst, a, b, c;
249 {
250   unsigned int i, n = dst->size;
251   sbitmap_ptr dstp = dst->elms;
252   sbitmap_ptr ap = a->elms;
253   sbitmap_ptr bp = b->elms;
254   sbitmap_ptr cp = c->elms;
255
256   for (i = 0; i < n; i++)
257     *dstp++ = *ap++ | (*bp++ & ~*cp++);
258 }
259
260 /* Set bitmap DST to the bitwise negation of the bitmap SRC.  */
261
262 void
263 sbitmap_not (dst, src)
264      sbitmap dst, src;
265 {
266   unsigned int i, n = dst->size;
267   sbitmap_ptr dstp = dst->elms;
268   sbitmap_ptr srcp = src->elms;
269
270   for (i = 0; i < n; i++)
271     *dstp++ = ~*srcp++;
272 }
273
274 /* Set the bits in DST to be the difference between the bits
275    in A and the bits in B. i.e. dst = a & (~b).  */
276
277 void
278 sbitmap_difference (dst, a, b)
279      sbitmap dst, a, b;
280 {
281   unsigned int i, dst_size = dst->size;
282   unsigned int min_size = dst->size;
283   sbitmap_ptr dstp = dst->elms;
284   sbitmap_ptr ap = a->elms;
285   sbitmap_ptr bp = b->elms;
286   
287   /* A should be at least as large as DEST, to have a defined source.  */
288   if (a->size < dst_size)
289     abort ();
290   /* If minuend is smaller, we simply pretend it to be zero bits, i.e.
291      only copy the subtrahend into dest.  */
292   if (b->size < min_size)
293     min_size = b->size;
294   for (i = 0; i < min_size; i++)
295     *dstp++ = *ap++ & (~*bp++);
296   /* Now fill the rest of dest from A, if B was too short.
297      This makes sense only when destination and A differ.  */
298   if (dst != a && i != dst_size)
299     for (; i < dst_size; i++)
300       *dstp++ = *ap++;
301 }
302
303 /* Set DST to be (A and B).
304    Return nonzero if any change is made.  */
305
306 bool
307 sbitmap_a_and_b_cg (dst, a, b)
308      sbitmap dst, a, b;
309 {
310   unsigned int i, n = dst->size;
311   sbitmap_ptr dstp = dst->elms;
312   sbitmap_ptr ap = a->elms;
313   sbitmap_ptr bp = b->elms;
314   SBITMAP_ELT_TYPE changed = 0;
315
316   for (i = 0; i < n; i++)
317     {
318       SBITMAP_ELT_TYPE tmp = *ap++ & *bp++;
319       changed = *dstp ^ tmp;
320       *dstp++ = tmp;
321     }
322
323   return changed != 0;
324 }
325
326 void
327 sbitmap_a_and_b (dst, a, b)
328      sbitmap dst, a, b;
329 {
330   unsigned int i, n = dst->size;
331   sbitmap_ptr dstp = dst->elms;
332   sbitmap_ptr ap = a->elms;
333   sbitmap_ptr bp = b->elms;
334
335   for (i = 0; i < n; i++)
336     *dstp++ = *ap++ & *bp++;
337 }
338
339 /* Set DST to be (A xor B)).
340    Return nonzero if any change is made.  */
341
342 bool
343 sbitmap_a_xor_b_cg (dst, a, b)
344      sbitmap dst, a, b;
345 {
346   unsigned int i, n = dst->size;
347   sbitmap_ptr dstp = dst->elms;
348   sbitmap_ptr ap = a->elms;
349   sbitmap_ptr bp = b->elms;
350   SBITMAP_ELT_TYPE changed = 0;
351
352   for (i = 0; i < n; i++)
353     {
354       SBITMAP_ELT_TYPE tmp = *ap++ ^ *bp++;
355       changed = *dstp ^ tmp;
356       *dstp++ = tmp;
357     }
358
359   return changed != 0;
360 }
361
362 void
363 sbitmap_a_xor_b (dst, a, b)
364      sbitmap dst, a, b;
365 {
366   unsigned int i, n = dst->size;
367   sbitmap_ptr dstp = dst->elms;
368   sbitmap_ptr ap = a->elms;
369   sbitmap_ptr bp = b->elms;
370
371   for (i = 0; i < n; i++)
372     *dstp++ = *ap++ ^ *bp++;
373 }
374
375 /* Set DST to be (A or B)).
376    Return nonzero if any change is made.  */
377
378 bool
379 sbitmap_a_or_b_cg (dst, a, b)
380      sbitmap dst, a, b;
381 {
382   unsigned int i, n = dst->size;
383   sbitmap_ptr dstp = dst->elms;
384   sbitmap_ptr ap = a->elms;
385   sbitmap_ptr bp = b->elms;
386   SBITMAP_ELT_TYPE changed = 0;
387
388   for (i = 0; i < n; i++)
389     {
390       SBITMAP_ELT_TYPE tmp = *ap++ | *bp++;
391       changed = *dstp ^ tmp;
392       *dstp++ = tmp;
393     }
394
395   return changed != 0;
396 }
397
398 void
399 sbitmap_a_or_b (dst, a, b)
400      sbitmap dst, a, b;
401 {
402   unsigned int i, n = dst->size;
403   sbitmap_ptr dstp = dst->elms;
404   sbitmap_ptr ap = a->elms;
405   sbitmap_ptr bp = b->elms;
406
407   for (i = 0; i < n; i++)
408     *dstp++ = *ap++ | *bp++;
409 }
410
411 /* Return nonzero if A is a subset of B.  */
412
413 bool
414 sbitmap_a_subset_b_p (a, b)
415      sbitmap a, b;
416 {
417   unsigned int i, n = a->size;
418   sbitmap_ptr ap, bp;
419
420   for (ap = a->elms, bp = b->elms, i = 0; i < n; i++, ap++, bp++)
421     if ((*ap | *bp) != *bp)
422       return false;
423
424   return true;
425 }
426
427 /* Set DST to be (A or (B and C)).
428    Return nonzero if any change is made.  */
429
430 bool
431 sbitmap_a_or_b_and_c_cg (dst, a, b, c)
432      sbitmap dst, a, b, c;
433 {
434   unsigned int i, n = dst->size;
435   sbitmap_ptr dstp = dst->elms;
436   sbitmap_ptr ap = a->elms;
437   sbitmap_ptr bp = b->elms;
438   sbitmap_ptr cp = c->elms;
439   SBITMAP_ELT_TYPE changed = 0;
440
441   for (i = 0; i < n; i++)
442     {
443       SBITMAP_ELT_TYPE tmp = *ap++ | (*bp++ & *cp++);
444       changed |= *dstp ^ tmp;
445       *dstp++ = tmp;
446     }
447
448   return changed != 0;
449 }
450
451 void
452 sbitmap_a_or_b_and_c (dst, a, b, c)
453      sbitmap dst, a, b, c;
454 {
455   unsigned int i, n = dst->size;
456   sbitmap_ptr dstp = dst->elms;
457   sbitmap_ptr ap = a->elms;
458   sbitmap_ptr bp = b->elms;
459   sbitmap_ptr cp = c->elms;
460
461   for (i = 0; i < n; i++)
462     *dstp++ = *ap++ | (*bp++ & *cp++);
463 }
464
465 /* Set DST to be (A and (B or C)).
466    Return nonzero if any change is made.  */
467
468 bool
469 sbitmap_a_and_b_or_c_cg (dst, a, b, c)
470      sbitmap dst, a, b, c;
471 {
472   unsigned int i, n = dst->size;
473   sbitmap_ptr dstp = dst->elms;
474   sbitmap_ptr ap = a->elms;
475   sbitmap_ptr bp = b->elms;
476   sbitmap_ptr cp = c->elms;
477   SBITMAP_ELT_TYPE changed = 0;
478
479   for (i = 0; i < n; i++)
480     {
481       SBITMAP_ELT_TYPE tmp = *ap++ & (*bp++ | *cp++);
482       changed |= *dstp ^ tmp;
483       *dstp++ = tmp;
484     }
485
486   return changed != 0;
487 }
488
489 void
490 sbitmap_a_and_b_or_c (dst, a, b, c)
491      sbitmap dst, a, b, c;
492 {
493   unsigned int i, n = dst->size;
494   sbitmap_ptr dstp = dst->elms;
495   sbitmap_ptr ap = a->elms;
496   sbitmap_ptr bp = b->elms;
497   sbitmap_ptr cp = c->elms;
498
499   for (i = 0; i < n; i++)
500     *dstp++ = *ap++ & (*bp++ | *cp++);
501 }
502
503 #ifdef IN_GCC
504 /* Set the bitmap DST to the intersection of SRC of successors of
505    block number BB, using the new flow graph structures.  */
506
507 void
508 sbitmap_intersection_of_succs (dst, src, bb)
509      sbitmap dst;
510      sbitmap *src;
511      int bb;
512 {
513   basic_block b = BASIC_BLOCK (bb);
514   unsigned int set_size = dst->size;
515   edge e;
516
517   for (e = b->succ; e != 0; e = e->succ_next)
518     {
519       if (e->dest == EXIT_BLOCK_PTR)
520         continue;
521
522       sbitmap_copy (dst, src[e->dest->index]);
523       break;
524     }
525
526   if (e == 0)
527     sbitmap_ones (dst);
528   else
529     for (e = e->succ_next; e != 0; e = e->succ_next)
530       {
531         unsigned int i;
532         sbitmap_ptr p, r;
533
534         if (e->dest == EXIT_BLOCK_PTR)
535           continue;
536
537         p = src[e->dest->index]->elms;
538         r = dst->elms;
539         for (i = 0; i < set_size; i++)
540           *r++ &= *p++;
541       }
542 }
543
544 /* Set the bitmap DST to the intersection of SRC of predecessors of
545    block number BB, using the new flow graph structures.  */
546
547 void
548 sbitmap_intersection_of_preds (dst, src, bb)
549      sbitmap dst;
550      sbitmap *src;
551      int bb;
552 {
553   basic_block b = BASIC_BLOCK (bb);
554   unsigned int set_size = dst->size;
555   edge e;
556
557   for (e = b->pred; e != 0; e = e->pred_next)
558     {
559       if (e->src == ENTRY_BLOCK_PTR)
560         continue;
561
562       sbitmap_copy (dst, src[e->src->index]);
563       break;
564     }
565
566   if (e == 0)
567     sbitmap_ones (dst);
568   else
569     for (e = e->pred_next; e != 0; e = e->pred_next)
570       {
571         unsigned int i;
572         sbitmap_ptr p, r;
573
574         if (e->src == ENTRY_BLOCK_PTR)
575           continue;
576
577         p = src[e->src->index]->elms;
578         r = dst->elms;
579         for (i = 0; i < set_size; i++)
580           *r++ &= *p++;
581       }
582 }
583
584 /* Set the bitmap DST to the union of SRC of successors of
585    block number BB, using the new flow graph structures.  */
586
587 void
588 sbitmap_union_of_succs (dst, src, bb)
589      sbitmap dst;
590      sbitmap *src;
591      int bb;
592 {
593   basic_block b = BASIC_BLOCK (bb);
594   unsigned int set_size = dst->size;
595   edge e;
596
597   for (e = b->succ; e != 0; e = e->succ_next)
598     {
599       if (e->dest == EXIT_BLOCK_PTR)
600         continue;
601
602       sbitmap_copy (dst, src[e->dest->index]);
603       break;
604     }
605
606   if (e == 0)
607     sbitmap_zero (dst);
608   else
609     for (e = e->succ_next; e != 0; e = e->succ_next)
610       {
611         unsigned int i;
612         sbitmap_ptr p, r;
613
614         if (e->dest == EXIT_BLOCK_PTR)
615           continue;
616
617         p = src[e->dest->index]->elms;
618         r = dst->elms;
619         for (i = 0; i < set_size; i++)
620           *r++ |= *p++;
621       }
622 }
623
624 /* Set the bitmap DST to the union of SRC of predecessors of
625    block number BB, using the new flow graph structures.  */
626
627 void
628 sbitmap_union_of_preds (dst, src, bb)
629      sbitmap dst;
630      sbitmap *src;
631      int bb;
632 {
633   basic_block b = BASIC_BLOCK (bb);
634   unsigned int set_size = dst->size;
635   edge e;
636
637   for (e = b->pred; e != 0; e = e->pred_next)
638     {
639       if (e->src== ENTRY_BLOCK_PTR)
640         continue;
641
642       sbitmap_copy (dst, src[e->src->index]);
643       break;
644     }
645
646   if (e == 0)
647     sbitmap_zero (dst);
648   else
649     for (e = e->pred_next; e != 0; e = e->pred_next)
650       {
651         unsigned int i;
652         sbitmap_ptr p, r;
653
654         if (e->src == ENTRY_BLOCK_PTR)
655           continue;
656
657         p = src[e->src->index]->elms;
658         r = dst->elms;
659         for (i = 0; i < set_size; i++)
660           *r++ |= *p++;
661       }
662 }
663 #endif
664
665 /* Return number of first bit set in the bitmap, -1 if none.  */
666
667 int
668 sbitmap_first_set_bit (bmap)
669      sbitmap bmap;
670 {
671   unsigned int n;
672
673   EXECUTE_IF_SET_IN_SBITMAP (bmap, 0, n, { return n; });
674   return -1;
675 }
676
677 /* Return number of last bit set in the bitmap, -1 if none.  */
678
679 int
680 sbitmap_last_set_bit (bmap)
681      sbitmap bmap;
682 {
683   int i;
684   SBITMAP_ELT_TYPE *ptr = bmap->elms;
685
686   for (i = bmap->size - 1; i >= 0; i--)
687     {
688       SBITMAP_ELT_TYPE word = ptr[i];
689
690       if (word != 0)
691         {
692           unsigned int index = (i + 1) * SBITMAP_ELT_BITS - 1;
693           SBITMAP_ELT_TYPE mask
694             = (SBITMAP_ELT_TYPE) 1 << (SBITMAP_ELT_BITS - 1);
695
696           while (1)
697             {
698               if ((word & mask) != 0)
699                 return index;
700
701               mask >>= 1;
702               index--;
703             }
704         }
705     }
706
707   return -1;
708 }
709
710 void
711 dump_sbitmap (file, bmap)
712      FILE *file;
713      sbitmap bmap;
714 {
715   unsigned int i, n, j;
716   unsigned int set_size = bmap->size;
717   unsigned int total_bits = bmap->n_bits;
718
719   fprintf (file, "  ");
720   for (i = n = 0; i < set_size && n < total_bits; i++)
721     for (j = 0; j < SBITMAP_ELT_BITS && n < total_bits; j++, n++)
722       {
723         if (n != 0 && n % 10 == 0)
724           fprintf (file, " ");
725
726         fprintf (file, "%d",
727                  (bmap->elms[i] & ((SBITMAP_ELT_TYPE) 1 << j)) != 0);
728       }
729
730   fprintf (file, "\n");
731 }
732
733 void
734 dump_sbitmap_file (file, bmap)
735      FILE *file;
736      sbitmap bmap;
737 {
738   unsigned int i, pos;
739
740   fprintf (file, "n_bits = %d, set = {", bmap->n_bits);
741
742   for (pos = 30, i = 0; i < bmap->n_bits; i++)
743     if (TEST_BIT (bmap, i))
744       {
745         if (pos > 70)
746           {
747             fprintf (file, "\n  ");
748             pos = 0;
749           }
750
751         fprintf (file, "%d ", i);
752         pos += 2 + (i >= 10) + (i >= 100) + (i >= 1000);
753       }
754
755   fprintf (file, "}\n");
756 }
757
758 void
759 debug_sbitmap (bmap)
760      sbitmap bmap;
761 {
762   dump_sbitmap_file (stderr, bmap);
763 }
764
765 void
766 dump_sbitmap_vector (file, title, subtitle, bmaps, n_maps)
767      FILE *file;
768      const char *title, *subtitle;
769      sbitmap *bmaps;
770      int n_maps;
771 {
772   int bb;
773
774   fprintf (file, "%s\n", title);
775   for (bb = 0; bb < n_maps; bb++)
776     {
777       fprintf (file, "%s %d\n", subtitle, bb);
778       dump_sbitmap (file, bmaps[bb]);
779     }
780
781   fprintf (file, "\n");
782 }