annotate gcc/bitmap.h @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Functions to support general ended bitmaps.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 Copyright (C) 1997-2018 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 #ifndef GCC_BITMAP_H
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #define GCC_BITMAP_H
111
kono
parents: 67
diff changeset
22
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
23 /* Implementation of sparse integer sets as a linked list or tree.
111
kono
parents: 67
diff changeset
24
kono
parents: 67
diff changeset
25 This sparse set representation is suitable for sparse sets with an
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
26 unknown (a priori) universe.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
27
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
28 Sets are represented as double-linked lists of container nodes of
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
29 type "struct bitmap_element" or as a binary trees of the same
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
30 container nodes. Each container node consists of an index for the
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
31 first member that could be held in the container, a small array of
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
32 integers that represent the members in the container, and pointers
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
33 to the next and previous element in the linked list, or left and
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
34 right children in the tree. In linked-list form, the container
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
35 nodes in the list are sorted in ascending order, i.e. the head of
111
kono
parents: 67
diff changeset
36 the list holds the element with the smallest member of the set.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
37 In tree form, nodes to the left have a smaller container index.
111
kono
parents: 67
diff changeset
38
kono
parents: 67
diff changeset
39 For a given member I in the set:
kono
parents: 67
diff changeset
40 - the element for I will have index is I / (bits per element)
kono
parents: 67
diff changeset
41 - the position for I within element is I % (bits per element)
kono
parents: 67
diff changeset
42
kono
parents: 67
diff changeset
43 This representation is very space-efficient for large sparse sets, and
kono
parents: 67
diff changeset
44 the size of the set can be changed dynamically without much overhead.
kono
parents: 67
diff changeset
45 An important parameter is the number of bits per element. In this
kono
parents: 67
diff changeset
46 implementation, there are 128 bits per element. This results in a
kono
parents: 67
diff changeset
47 high storage overhead *per element*, but a small overall overhead if
kono
parents: 67
diff changeset
48 the set is very sparse.
kono
parents: 67
diff changeset
49
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
50 The storage requirements for linked-list sparse sets are O(E), with E->N
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
51 in the worst case (a sparse set with large distances between the values
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
52 of the set members).
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
53
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
54 This representation also works well for data flow problems where the size
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
55 of the set may grow dynamically, but care must be taken that the member_p,
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
56 add_member, and remove_member operations occur with a suitable access
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
57 pattern.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
58
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
59 The linked-list set representation works well for problems involving very
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
60 sparse sets. The canonical example in GCC is, of course, the "set of
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
61 sets" for some CFG-based data flow problems (liveness analysis, dominance
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
62 frontiers, etc.).
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
63
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
64 For random-access sparse sets of unknown universe, the binary tree
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
65 representation is likely to be a more suitable choice. Theoretical
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
66 access times for the binary tree representation are better than those
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
67 for the linked-list, but in practice this is only true for truely
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
68 random access.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
69
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
70 Often the most suitable representation during construction of the set
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
71 is not the best choice for the usage of the set. For such cases, the
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
72 "view" of the set can be changed from one representation to the other.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
73 This is an O(E) operation:
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
74
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
75 * from list to tree view : bitmap_tree_view
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
76 * from tree to list view : bitmap_list_view
111
kono
parents: 67
diff changeset
77
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
78 Traversing linked lists or trees can be cache-unfriendly. Performance
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
79 can be improved by keeping container nodes in the set grouped together
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
80 in memory, using a dedicated obstack for a set (or group of related
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
81 sets). Elements allocated on obstacks are released to a free-list and
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
82 taken off the free list. If multiple sets are allocated on the same
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
83 obstack, elements freed from one set may be re-used for one of the other
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
84 sets. This usually helps avoid cache misses.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
85
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
86 A single free-list is used for all sets allocated in GGC space. This is
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
87 bad for persistent sets, so persistent sets should be allocated on an
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
88 obstack whenever possible.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
89
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
90 For random-access sets with a known, relatively small universe size, the
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
91 SparseSet or simple bitmap representations may be more efficient than a
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
92 linked-list set.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
93
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
94
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
95 LINKED LIST FORM
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
96 ================
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
97
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
98 In linked-list form, in-order iterations of the set can be executed
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
99 efficiently. The downside is that many random-access operations are
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
100 relatively slow, because the linked list has to be traversed to test
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
101 membership (i.e. member_p/ add_member/remove_member).
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
102
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
103 To improve the performance of this set representation, the last
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
104 accessed element and its index are cached. For membership tests on
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
105 members close to recently accessed members, the cached last element
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
106 improves membership test to a constant-time operation.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
107
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
108 The following operations can always be performed in O(1) time in
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
109 list view:
111
kono
parents: 67
diff changeset
110
kono
parents: 67
diff changeset
111 * clear : bitmap_clear
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
112 * smallest_member : bitmap_first_set_bit
111
kono
parents: 67
diff changeset
113 * choose_one : (not implemented, but could be
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
114 in constant time)
111
kono
parents: 67
diff changeset
115
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
116 The following operations can be performed in O(E) time worst-case in
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
117 list view (with E the number of elements in the linked list), but in
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
118 O(1) time with a suitable access patterns:
111
kono
parents: 67
diff changeset
119
kono
parents: 67
diff changeset
120 * member_p : bitmap_bit_p
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
121 * add_member : bitmap_set_bit / bitmap_set_range
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
122 * remove_member : bitmap_clear_bit / bitmap_clear_range
111
kono
parents: 67
diff changeset
123
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
124 The following operations can be performed in O(E) time in list view:
111
kono
parents: 67
diff changeset
125
kono
parents: 67
diff changeset
126 * cardinality : bitmap_count_bits
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
127 * largest_member : bitmap_last_set_bit (but this could
111
kono
parents: 67
diff changeset
128 in constant time with a pointer to
kono
parents: 67
diff changeset
129 the last element in the chain)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
130 * set_size : bitmap_last_set_bit
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
132 In tree view the following operations can all be performed in O(log E)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
133 amortized time with O(E) worst-case behavior.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
134
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
135 * smallest_member
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
136 * largest_member
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
137 * set_size
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
138 * member_p
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
139 * add_member
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
140 * remove_member
111
kono
parents: 67
diff changeset
141
kono
parents: 67
diff changeset
142 Additionally, the linked-list sparse set representation supports
kono
parents: 67
diff changeset
143 enumeration of the members in O(E) time:
kono
parents: 67
diff changeset
144
kono
parents: 67
diff changeset
145 * forall : EXECUTE_IF_SET_IN_BITMAP
kono
parents: 67
diff changeset
146 * set_copy : bitmap_copy
kono
parents: 67
diff changeset
147 * set_intersection : bitmap_intersect_p /
kono
parents: 67
diff changeset
148 bitmap_and / bitmap_and_into /
kono
parents: 67
diff changeset
149 EXECUTE_IF_AND_IN_BITMAP
kono
parents: 67
diff changeset
150 * set_union : bitmap_ior / bitmap_ior_into
kono
parents: 67
diff changeset
151 * set_difference : bitmap_intersect_compl_p /
kono
parents: 67
diff changeset
152 bitmap_and_comp / bitmap_and_comp_into /
kono
parents: 67
diff changeset
153 EXECUTE_IF_AND_COMPL_IN_BITMAP
kono
parents: 67
diff changeset
154 * set_disjuction : bitmap_xor_comp / bitmap_xor_comp_into
kono
parents: 67
diff changeset
155 * set_compare : bitmap_equal_p
kono
parents: 67
diff changeset
156
kono
parents: 67
diff changeset
157 Some operations on 3 sets that occur frequently in data flow problems
kono
parents: 67
diff changeset
158 are also implemented:
kono
parents: 67
diff changeset
159
kono
parents: 67
diff changeset
160 * A | (B & C) : bitmap_ior_and_into
kono
parents: 67
diff changeset
161 * A | (B & ~C) : bitmap_ior_and_compl /
kono
parents: 67
diff changeset
162 bitmap_ior_and_compl_into
kono
parents: 67
diff changeset
163
kono
parents: 67
diff changeset
164
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
165 BINARY TREE FORM
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
166 ================
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
167 An alternate "view" of a bitmap is its binary tree representation.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
168 For this representation, splay trees are used because they can be
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
169 implemented using the same data structures as the linked list, with
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
170 no overhead for meta-data (like color, or rank) on the tree nodes.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
171
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
172 In binary tree form, random-access to the set is much more efficient
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
173 than for the linked-list representation. Downsides are the high cost
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
174 of clearing the set, and the relatively large number of operations
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
175 necessary to balance the tree. Also, iterating the set members is
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
176 not supported.
111
kono
parents: 67
diff changeset
177
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
178 As for the linked-list representation, the last accessed element and
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
179 its index are cached, so that membership tests on the latest accessed
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
180 members is a constant-time operation. Other lookups take O(logE)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
181 time amortized (but O(E) time worst-case).
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
182
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
183 The following operations can always be performed in O(1) time:
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
184
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
185 * choose_one : (not implemented, but could be
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
186 implemented in constant time)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
187
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
188 The following operations can be performed in O(logE) time amortized
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
189 but O(E) time worst-case, but in O(1) time if the same element is
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
190 accessed.
111
kono
parents: 67
diff changeset
191
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
192 * member_p : bitmap_bit_p
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
193 * add_member : bitmap_set_bit
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
194 * remove_member : bitmap_clear_bit
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
195
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
196 The following operations can be performed in O(logE) time amortized
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
197 but O(E) time worst-case:
111
kono
parents: 67
diff changeset
198
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
199 * smallest_member : bitmap_first_set_bit
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
200 * largest_member : bitmap_last_set_bit
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
201 * set_size : bitmap_last_set_bit
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
202
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
203 The following operations can be performed in O(E) time:
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
204
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
205 * clear : bitmap_clear
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
206
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
207 The binary tree sparse set representation does *not* support any form
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
208 of enumeration, and does also *not* support logical operations on sets.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
209 The binary tree representation is only supposed to be used for sets
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
210 on which many random-access membership tests will happen. */
111
kono
parents: 67
diff changeset
211
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
212 #include "obstack.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
213
111
kono
parents: 67
diff changeset
214 /* Bitmap memory usage. */
kono
parents: 67
diff changeset
215 struct bitmap_usage: public mem_usage
kono
parents: 67
diff changeset
216 {
kono
parents: 67
diff changeset
217 /* Default contructor. */
kono
parents: 67
diff changeset
218 bitmap_usage (): m_nsearches (0), m_search_iter (0) {}
kono
parents: 67
diff changeset
219 /* Constructor. */
kono
parents: 67
diff changeset
220 bitmap_usage (size_t allocated, size_t times, size_t peak,
kono
parents: 67
diff changeset
221 uint64_t nsearches, uint64_t search_iter)
kono
parents: 67
diff changeset
222 : mem_usage (allocated, times, peak),
kono
parents: 67
diff changeset
223 m_nsearches (nsearches), m_search_iter (search_iter) {}
kono
parents: 67
diff changeset
224
kono
parents: 67
diff changeset
225 /* Sum the usage with SECOND usage. */
kono
parents: 67
diff changeset
226 bitmap_usage
kono
parents: 67
diff changeset
227 operator+ (const bitmap_usage &second)
kono
parents: 67
diff changeset
228 {
kono
parents: 67
diff changeset
229 return bitmap_usage (m_allocated + second.m_allocated,
kono
parents: 67
diff changeset
230 m_times + second.m_times,
kono
parents: 67
diff changeset
231 m_peak + second.m_peak,
kono
parents: 67
diff changeset
232 m_nsearches + second.m_nsearches,
kono
parents: 67
diff changeset
233 m_search_iter + second.m_search_iter);
kono
parents: 67
diff changeset
234 }
kono
parents: 67
diff changeset
235
kono
parents: 67
diff changeset
236 /* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */
kono
parents: 67
diff changeset
237 inline void
kono
parents: 67
diff changeset
238 dump (mem_location *loc, mem_usage &total) const
kono
parents: 67
diff changeset
239 {
kono
parents: 67
diff changeset
240 char *location_string = loc->to_string ();
kono
parents: 67
diff changeset
241
kono
parents: 67
diff changeset
242 fprintf (stderr, "%-48s %10" PRIu64 ":%5.1f%%"
kono
parents: 67
diff changeset
243 "%10" PRIu64 "%10" PRIu64 ":%5.1f%%"
kono
parents: 67
diff changeset
244 "%12" PRIu64 "%12" PRIu64 "%10s\n",
kono
parents: 67
diff changeset
245 location_string, (uint64_t)m_allocated,
kono
parents: 67
diff changeset
246 get_percent (m_allocated, total.m_allocated),
kono
parents: 67
diff changeset
247 (uint64_t)m_peak, (uint64_t)m_times,
kono
parents: 67
diff changeset
248 get_percent (m_times, total.m_times),
kono
parents: 67
diff changeset
249 m_nsearches, m_search_iter,
kono
parents: 67
diff changeset
250 loc->m_ggc ? "ggc" : "heap");
kono
parents: 67
diff changeset
251
kono
parents: 67
diff changeset
252 free (location_string);
kono
parents: 67
diff changeset
253 }
kono
parents: 67
diff changeset
254
kono
parents: 67
diff changeset
255 /* Dump header with NAME. */
kono
parents: 67
diff changeset
256 static inline void
kono
parents: 67
diff changeset
257 dump_header (const char *name)
kono
parents: 67
diff changeset
258 {
kono
parents: 67
diff changeset
259 fprintf (stderr, "%-48s %11s%16s%17s%12s%12s%10s\n", name, "Leak", "Peak",
kono
parents: 67
diff changeset
260 "Times", "N searches", "Search iter", "Type");
kono
parents: 67
diff changeset
261 print_dash_line ();
kono
parents: 67
diff changeset
262 }
kono
parents: 67
diff changeset
263
kono
parents: 67
diff changeset
264 /* Number search operations. */
kono
parents: 67
diff changeset
265 uint64_t m_nsearches;
kono
parents: 67
diff changeset
266 /* Number of search iterations. */
kono
parents: 67
diff changeset
267 uint64_t m_search_iter;
kono
parents: 67
diff changeset
268 };
kono
parents: 67
diff changeset
269
kono
parents: 67
diff changeset
270 /* Bitmap memory description. */
kono
parents: 67
diff changeset
271 extern mem_alloc_description<bitmap_usage> bitmap_mem_desc;
kono
parents: 67
diff changeset
272
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
273 /* Fundamental storage type for bitmap. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
274
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
275 typedef unsigned long BITMAP_WORD;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
276 /* BITMAP_WORD_BITS needs to be unsigned, but cannot contain casts as
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
277 it is used in preprocessor directives -- hence the 1u. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
278 #define BITMAP_WORD_BITS (CHAR_BIT * SIZEOF_LONG * 1u)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
279
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
280 /* Number of words to use for each element in the linked list. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
281
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
282 #ifndef BITMAP_ELEMENT_WORDS
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
283 #define BITMAP_ELEMENT_WORDS ((128 + BITMAP_WORD_BITS - 1) / BITMAP_WORD_BITS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
284 #endif
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
285
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
286 /* Number of bits in each actual element of a bitmap. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
287
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
288 #define BITMAP_ELEMENT_ALL_BITS (BITMAP_ELEMENT_WORDS * BITMAP_WORD_BITS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
289
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
290 /* Obstack for allocating bitmaps and elements from. */
111
kono
parents: 67
diff changeset
291 struct GTY (()) bitmap_obstack {
kono
parents: 67
diff changeset
292 struct bitmap_element *elements;
kono
parents: 67
diff changeset
293 struct bitmap_head *heads;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
294 struct obstack GTY ((skip)) obstack;
111
kono
parents: 67
diff changeset
295 };
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
296
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
297 /* Bitmap set element. We use a linked list to hold only the bits that
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
298 are set. This allows for use to grow the bitset dynamically without
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
299 having to realloc and copy a giant bit array.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
300
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
301 The free list is implemented as a list of lists. There is one
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
302 outer list connected together by prev fields. Each element of that
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
303 outer is an inner list (that may consist only of the outer list
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
304 element) that are connected by the next fields. The prev pointer
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
305 is undefined for interior elements. This allows
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
306 bitmap_elt_clear_from to be implemented in unit time rather than
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
307 linear in the number of elements to be freed. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
308
111
kono
parents: 67
diff changeset
309 struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) bitmap_element {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
310 /* In list form, the next element in the linked list;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
311 in tree form, the left child node in the tree. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
312 struct bitmap_element *next;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
313 /* In list form, the previous element in the linked list;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
314 in tree form, the right child node in the tree. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
315 struct bitmap_element *prev;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
316 /* regno/BITMAP_ELEMENT_ALL_BITS. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
317 unsigned int indx;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
318 /* Bits that are set, counting from INDX, inclusive */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
319 BITMAP_WORD bits[BITMAP_ELEMENT_WORDS];
111
kono
parents: 67
diff changeset
320 };
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
321
111
kono
parents: 67
diff changeset
322 /* Head of bitmap linked list. The 'current' member points to something
kono
parents: 67
diff changeset
323 already pointed to by the chain started by first, so GTY((skip)) it. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
324
111
kono
parents: 67
diff changeset
325 struct GTY(()) bitmap_head {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
326 /* Index of last element looked at. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
327 unsigned int indx;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
328 /* False if the bitmap is in list form; true if the bitmap is in tree form.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
329 Bitmap iterators only work on bitmaps in list form. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
330 bool tree_form;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
331 /* In list form, the first element in the linked list;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
332 in tree form, the root of the tree. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
333 bitmap_element *first;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
334 /* Last element looked at. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
335 bitmap_element * GTY((skip(""))) current;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
336 /* Obstack to allocate elements from. If NULL, then use GGC allocation. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
337 bitmap_obstack *obstack;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
338 void dump ();
111
kono
parents: 67
diff changeset
339 };
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
340
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
341 /* Global data */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
342 extern bitmap_element bitmap_zero_bits; /* Zero bitmap element */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
343 extern bitmap_obstack bitmap_default_obstack; /* Default bitmap obstack */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
344
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
345 /* Change the view of the bitmap to list, or tree. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
346 void bitmap_list_view (bitmap);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
347 void bitmap_tree_view (bitmap);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
348
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
349 /* Clear a bitmap by freeing up the linked list. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
350 extern void bitmap_clear (bitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
351
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
352 /* Copy a bitmap to another bitmap. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
353 extern void bitmap_copy (bitmap, const_bitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
354
111
kono
parents: 67
diff changeset
355 /* Move a bitmap to another bitmap. */
kono
parents: 67
diff changeset
356 extern void bitmap_move (bitmap, bitmap);
kono
parents: 67
diff changeset
357
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
358 /* True if two bitmaps are identical. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
359 extern bool bitmap_equal_p (const_bitmap, const_bitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
360
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
361 /* True if the bitmaps intersect (their AND is non-empty). */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
362 extern bool bitmap_intersect_p (const_bitmap, const_bitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
363
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
364 /* True if the complement of the second intersects the first (their
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
365 AND_COMPL is non-empty). */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
366 extern bool bitmap_intersect_compl_p (const_bitmap, const_bitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
367
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
368 /* True if MAP is an empty bitmap. */
111
kono
parents: 67
diff changeset
369 inline bool bitmap_empty_p (const_bitmap map)
kono
parents: 67
diff changeset
370 {
kono
parents: 67
diff changeset
371 return !map->first;
kono
parents: 67
diff changeset
372 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
373
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
374 /* True if the bitmap has only a single bit set. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
375 extern bool bitmap_single_bit_set_p (const_bitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
376
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
377 /* Count the number of bits set in the bitmap. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
378 extern unsigned long bitmap_count_bits (const_bitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
379
111
kono
parents: 67
diff changeset
380 /* Count the number of unique bits set across the two bitmaps. */
kono
parents: 67
diff changeset
381 extern unsigned long bitmap_count_unique_bits (const_bitmap, const_bitmap);
kono
parents: 67
diff changeset
382
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
383 /* Boolean operations on bitmaps. The _into variants are two operand
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
384 versions that modify the first source operand. The other variants
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
385 are three operand versions that to not destroy the source bitmaps.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
386 The operations supported are &, & ~, |, ^. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
387 extern void bitmap_and (bitmap, const_bitmap, const_bitmap);
111
kono
parents: 67
diff changeset
388 extern bool bitmap_and_into (bitmap, const_bitmap);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
389 extern bool bitmap_and_compl (bitmap, const_bitmap, const_bitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
390 extern bool bitmap_and_compl_into (bitmap, const_bitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
391 #define bitmap_compl_and(DST, A, B) bitmap_and_compl (DST, B, A)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
392 extern void bitmap_compl_and_into (bitmap, const_bitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
393 extern void bitmap_clear_range (bitmap, unsigned int, unsigned int);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
394 extern void bitmap_set_range (bitmap, unsigned int, unsigned int);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
395 extern bool bitmap_ior (bitmap, const_bitmap, const_bitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
396 extern bool bitmap_ior_into (bitmap, const_bitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
397 extern void bitmap_xor (bitmap, const_bitmap, const_bitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
398 extern void bitmap_xor_into (bitmap, const_bitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
399
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
400 /* DST = A | (B & C). Return true if DST changes. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
401 extern bool bitmap_ior_and_into (bitmap DST, const_bitmap B, const_bitmap C);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
402 /* DST = A | (B & ~C). Return true if DST changes. */
111
kono
parents: 67
diff changeset
403 extern bool bitmap_ior_and_compl (bitmap DST, const_bitmap A,
kono
parents: 67
diff changeset
404 const_bitmap B, const_bitmap C);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
405 /* A |= (B & ~C). Return true if A changes. */
111
kono
parents: 67
diff changeset
406 extern bool bitmap_ior_and_compl_into (bitmap A,
kono
parents: 67
diff changeset
407 const_bitmap B, const_bitmap C);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
408
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
409 /* Clear a single bit in a bitmap. Return true if the bit changed. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
410 extern bool bitmap_clear_bit (bitmap, int);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
411
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
412 /* Set a single bit in a bitmap. Return true if the bit changed. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
413 extern bool bitmap_set_bit (bitmap, int);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
414
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
415 /* Return true if a bit is set in a bitmap. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
416 extern int bitmap_bit_p (bitmap, int);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
417
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
418 /* Debug functions to print a bitmap. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
419 extern void debug_bitmap (const_bitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
420 extern void debug_bitmap_file (FILE *, const_bitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
421
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
422 /* Print a bitmap. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
423 extern void bitmap_print (FILE *, const_bitmap, const char *, const char *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
424
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
425 /* Initialize and release a bitmap obstack. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
426 extern void bitmap_obstack_initialize (bitmap_obstack *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
427 extern void bitmap_obstack_release (bitmap_obstack *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
428 extern void bitmap_register (bitmap MEM_STAT_DECL);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
429 extern void dump_bitmap_statistics (void);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
430
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
431 /* Initialize a bitmap header. OBSTACK indicates the bitmap obstack
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
432 to allocate from, NULL for GC'd bitmap. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
433
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
434 static inline void
111
kono
parents: 67
diff changeset
435 bitmap_initialize (bitmap head, bitmap_obstack *obstack CXX_MEM_STAT_INFO)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
436 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
437 head->first = head->current = NULL;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
438 head->indx = head->tree_form = 0;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
439 head->obstack = obstack;
111
kono
parents: 67
diff changeset
440 if (GATHER_STATISTICS)
kono
parents: 67
diff changeset
441 bitmap_register (head PASS_MEM_STAT);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
442 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
443
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
444 /* Allocate and free bitmaps from obstack, malloc and gc'd memory. */
111
kono
parents: 67
diff changeset
445 extern bitmap bitmap_alloc (bitmap_obstack *obstack CXX_MEM_STAT_INFO);
kono
parents: 67
diff changeset
446 #define BITMAP_ALLOC bitmap_alloc
kono
parents: 67
diff changeset
447 extern bitmap bitmap_gc_alloc (ALONE_CXX_MEM_STAT_INFO);
kono
parents: 67
diff changeset
448 #define BITMAP_GGC_ALLOC bitmap_gc_alloc
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
449 extern void bitmap_obstack_free (bitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
450
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
451 /* A few compatibility/functions macros for compatibility with sbitmaps */
111
kono
parents: 67
diff changeset
452 inline void dump_bitmap (FILE *file, const_bitmap map)
kono
parents: 67
diff changeset
453 {
kono
parents: 67
diff changeset
454 bitmap_print (file, map, "", "\n");
kono
parents: 67
diff changeset
455 }
kono
parents: 67
diff changeset
456 extern void debug (const bitmap_head &ref);
kono
parents: 67
diff changeset
457 extern void debug (const bitmap_head *ptr);
kono
parents: 67
diff changeset
458
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
459 extern unsigned bitmap_first_set_bit (const_bitmap);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
460 extern unsigned bitmap_last_set_bit (const_bitmap);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
461
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
462 /* Compute bitmap hash (for purposes of hashing etc.) */
111
kono
parents: 67
diff changeset
463 extern hashval_t bitmap_hash (const_bitmap);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
464
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
465 /* Do any cleanup needed on a bitmap when it is no longer used. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
466 #define BITMAP_FREE(BITMAP) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
467 ((void) (bitmap_obstack_free ((bitmap) BITMAP), (BITMAP) = (bitmap) NULL))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
468
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
469 /* Iterator for bitmaps. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
470
111
kono
parents: 67
diff changeset
471 struct bitmap_iterator
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
472 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
473 /* Pointer to the current bitmap element. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
474 bitmap_element *elt1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
475
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
476 /* Pointer to 2nd bitmap element when two are involved. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
477 bitmap_element *elt2;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
478
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
479 /* Word within the current element. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
480 unsigned word_no;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
481
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
482 /* Contents of the actually processed word. When finding next bit
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
483 it is shifted right, so that the actual bit is always the least
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
484 significant bit of ACTUAL. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
485 BITMAP_WORD bits;
111
kono
parents: 67
diff changeset
486 };
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
487
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
488 /* Initialize a single bitmap iterator. START_BIT is the first bit to
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
489 iterate from. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
490
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
491 static inline void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
492 bmp_iter_set_init (bitmap_iterator *bi, const_bitmap map,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
493 unsigned start_bit, unsigned *bit_no)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
494 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
495 bi->elt1 = map->first;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
496 bi->elt2 = NULL;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
497
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
498 gcc_checking_assert (!map->tree_form);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
499
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
500 /* Advance elt1 until it is not before the block containing start_bit. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
501 while (1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
502 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
503 if (!bi->elt1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
504 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
505 bi->elt1 = &bitmap_zero_bits;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
506 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
507 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
508
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
509 if (bi->elt1->indx >= start_bit / BITMAP_ELEMENT_ALL_BITS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
510 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
511 bi->elt1 = bi->elt1->next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
512 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
513
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
514 /* We might have gone past the start bit, so reinitialize it. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
515 if (bi->elt1->indx != start_bit / BITMAP_ELEMENT_ALL_BITS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
516 start_bit = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
517
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
518 /* Initialize for what is now start_bit. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
519 bi->word_no = start_bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
520 bi->bits = bi->elt1->bits[bi->word_no];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
521 bi->bits >>= start_bit % BITMAP_WORD_BITS;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
522
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
523 /* If this word is zero, we must make sure we're not pointing at the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
524 first bit, otherwise our incrementing to the next word boundary
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
525 will fail. It won't matter if this increment moves us into the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
526 next word. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
527 start_bit += !bi->bits;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
528
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
529 *bit_no = start_bit;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
530 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
531
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
532 /* Initialize an iterator to iterate over the intersection of two
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
533 bitmaps. START_BIT is the bit to commence from. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
534
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
535 static inline void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
536 bmp_iter_and_init (bitmap_iterator *bi, const_bitmap map1, const_bitmap map2,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
537 unsigned start_bit, unsigned *bit_no)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
538 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
539 bi->elt1 = map1->first;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
540 bi->elt2 = map2->first;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
541
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
542 gcc_checking_assert (!map1->tree_form && !map2->tree_form);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
543
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
544 /* Advance elt1 until it is not before the block containing
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
545 start_bit. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
546 while (1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
547 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
548 if (!bi->elt1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
549 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
550 bi->elt2 = NULL;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
551 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
552 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
553
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
554 if (bi->elt1->indx >= start_bit / BITMAP_ELEMENT_ALL_BITS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
555 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
556 bi->elt1 = bi->elt1->next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
557 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
558
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
559 /* Advance elt2 until it is not before elt1. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
560 while (1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
561 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
562 if (!bi->elt2)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
563 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
564 bi->elt1 = bi->elt2 = &bitmap_zero_bits;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
565 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
566 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
567
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
568 if (bi->elt2->indx >= bi->elt1->indx)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
569 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
570 bi->elt2 = bi->elt2->next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
571 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
572
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
573 /* If we're at the same index, then we have some intersecting bits. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
574 if (bi->elt1->indx == bi->elt2->indx)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
575 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
576 /* We might have advanced beyond the start_bit, so reinitialize
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
577 for that. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
578 if (bi->elt1->indx != start_bit / BITMAP_ELEMENT_ALL_BITS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
579 start_bit = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
580
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
581 bi->word_no = start_bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
582 bi->bits = bi->elt1->bits[bi->word_no] & bi->elt2->bits[bi->word_no];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
583 bi->bits >>= start_bit % BITMAP_WORD_BITS;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
584 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
585 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
586 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
587 /* Otherwise we must immediately advance elt1, so initialize for
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
588 that. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
589 bi->word_no = BITMAP_ELEMENT_WORDS - 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
590 bi->bits = 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
591 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
592
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
593 /* If this word is zero, we must make sure we're not pointing at the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
594 first bit, otherwise our incrementing to the next word boundary
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
595 will fail. It won't matter if this increment moves us into the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
596 next word. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
597 start_bit += !bi->bits;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
598
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
599 *bit_no = start_bit;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
600 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
601
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
602 /* Initialize an iterator to iterate over the bits in MAP1 & ~MAP2. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
603
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
604 static inline void
111
kono
parents: 67
diff changeset
605 bmp_iter_and_compl_init (bitmap_iterator *bi,
kono
parents: 67
diff changeset
606 const_bitmap map1, const_bitmap map2,
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
607 unsigned start_bit, unsigned *bit_no)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
608 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
609 bi->elt1 = map1->first;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
610 bi->elt2 = map2->first;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
611
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
612 gcc_checking_assert (!map1->tree_form && !map2->tree_form);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
613
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
614 /* Advance elt1 until it is not before the block containing start_bit. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
615 while (1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
616 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
617 if (!bi->elt1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
618 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
619 bi->elt1 = &bitmap_zero_bits;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
620 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
621 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
622
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
623 if (bi->elt1->indx >= start_bit / BITMAP_ELEMENT_ALL_BITS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
624 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
625 bi->elt1 = bi->elt1->next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
626 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
627
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
628 /* Advance elt2 until it is not before elt1. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
629 while (bi->elt2 && bi->elt2->indx < bi->elt1->indx)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
630 bi->elt2 = bi->elt2->next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
631
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
632 /* We might have advanced beyond the start_bit, so reinitialize for
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
633 that. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
634 if (bi->elt1->indx != start_bit / BITMAP_ELEMENT_ALL_BITS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
635 start_bit = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
636
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
637 bi->word_no = start_bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
638 bi->bits = bi->elt1->bits[bi->word_no];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
639 if (bi->elt2 && bi->elt1->indx == bi->elt2->indx)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
640 bi->bits &= ~bi->elt2->bits[bi->word_no];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
641 bi->bits >>= start_bit % BITMAP_WORD_BITS;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
642
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
643 /* If this word is zero, we must make sure we're not pointing at the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
644 first bit, otherwise our incrementing to the next word boundary
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
645 will fail. It won't matter if this increment moves us into the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
646 next word. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
647 start_bit += !bi->bits;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
648
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
649 *bit_no = start_bit;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
650 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
651
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
652 /* Advance to the next bit in BI. We don't advance to the next
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
653 nonzero bit yet. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
654
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
655 static inline void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
656 bmp_iter_next (bitmap_iterator *bi, unsigned *bit_no)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
657 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
658 bi->bits >>= 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
659 *bit_no += 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
660 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
661
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
662 /* Advance to first set bit in BI. */
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
663
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
664 static inline void
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
665 bmp_iter_next_bit (bitmap_iterator * bi, unsigned *bit_no)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
666 {
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
667 #if (GCC_VERSION >= 3004)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
668 {
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
669 unsigned int n = __builtin_ctzl (bi->bits);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
670 gcc_assert (sizeof (unsigned long) == sizeof (BITMAP_WORD));
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
671 bi->bits >>= n;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
672 *bit_no += n;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
673 }
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
674 #else
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
675 while (!(bi->bits & 1))
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
676 {
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
677 bi->bits >>= 1;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
678 *bit_no += 1;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
679 }
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
680 #endif
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
681 }
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
682
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
683 /* Advance to the next nonzero bit of a single bitmap, we will have
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
684 already advanced past the just iterated bit. Return true if there
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
685 is a bit to iterate. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
686
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
687 static inline bool
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
688 bmp_iter_set (bitmap_iterator *bi, unsigned *bit_no)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
689 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
690 /* If our current word is nonzero, it contains the bit we want. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
691 if (bi->bits)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
692 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
693 next_bit:
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
694 bmp_iter_next_bit (bi, bit_no);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
695 return true;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
696 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
697
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
698 /* Round up to the word boundary. We might have just iterated past
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
699 the end of the last word, hence the -1. It is not possible for
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
700 bit_no to point at the beginning of the now last word. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
701 *bit_no = ((*bit_no + BITMAP_WORD_BITS - 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
702 / BITMAP_WORD_BITS * BITMAP_WORD_BITS);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
703 bi->word_no++;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
704
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
705 while (1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
706 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
707 /* Find the next nonzero word in this elt. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
708 while (bi->word_no != BITMAP_ELEMENT_WORDS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
709 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
710 bi->bits = bi->elt1->bits[bi->word_no];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
711 if (bi->bits)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
712 goto next_bit;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
713 *bit_no += BITMAP_WORD_BITS;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
714 bi->word_no++;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
715 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
716
111
kono
parents: 67
diff changeset
717 /* Make sure we didn't remove the element while iterating. */
kono
parents: 67
diff changeset
718 gcc_checking_assert (bi->elt1->indx != -1U);
kono
parents: 67
diff changeset
719
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
720 /* Advance to the next element. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
721 bi->elt1 = bi->elt1->next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
722 if (!bi->elt1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
723 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
724 *bit_no = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
725 bi->word_no = 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
726 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
727 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
728
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
729 /* Advance to the next nonzero bit of an intersecting pair of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
730 bitmaps. We will have already advanced past the just iterated bit.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
731 Return true if there is a bit to iterate. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
732
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
733 static inline bool
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
734 bmp_iter_and (bitmap_iterator *bi, unsigned *bit_no)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
735 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
736 /* If our current word is nonzero, it contains the bit we want. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
737 if (bi->bits)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
738 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
739 next_bit:
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
740 bmp_iter_next_bit (bi, bit_no);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
741 return true;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
742 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
743
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
744 /* Round up to the word boundary. We might have just iterated past
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
745 the end of the last word, hence the -1. It is not possible for
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
746 bit_no to point at the beginning of the now last word. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
747 *bit_no = ((*bit_no + BITMAP_WORD_BITS - 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
748 / BITMAP_WORD_BITS * BITMAP_WORD_BITS);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
749 bi->word_no++;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
750
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
751 while (1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
752 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
753 /* Find the next nonzero word in this elt. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
754 while (bi->word_no != BITMAP_ELEMENT_WORDS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
755 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
756 bi->bits = bi->elt1->bits[bi->word_no] & bi->elt2->bits[bi->word_no];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
757 if (bi->bits)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
758 goto next_bit;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
759 *bit_no += BITMAP_WORD_BITS;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
760 bi->word_no++;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
761 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
762
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
763 /* Advance to the next identical element. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
764 do
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
765 {
111
kono
parents: 67
diff changeset
766 /* Make sure we didn't remove the element while iterating. */
kono
parents: 67
diff changeset
767 gcc_checking_assert (bi->elt1->indx != -1U);
kono
parents: 67
diff changeset
768
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
769 /* Advance elt1 while it is less than elt2. We always want
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
770 to advance one elt. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
771 do
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
772 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
773 bi->elt1 = bi->elt1->next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
774 if (!bi->elt1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
775 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
776 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
777 while (bi->elt1->indx < bi->elt2->indx);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
778
111
kono
parents: 67
diff changeset
779 /* Make sure we didn't remove the element while iterating. */
kono
parents: 67
diff changeset
780 gcc_checking_assert (bi->elt2->indx != -1U);
kono
parents: 67
diff changeset
781
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
782 /* Advance elt2 to be no less than elt1. This might not
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
783 advance. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
784 while (bi->elt2->indx < bi->elt1->indx)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
785 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
786 bi->elt2 = bi->elt2->next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
787 if (!bi->elt2)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
788 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
789 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
790 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
791 while (bi->elt1->indx != bi->elt2->indx);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
792
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
793 *bit_no = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
794 bi->word_no = 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
795 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
796 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
797
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
798 /* Advance to the next nonzero bit in the intersection of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
799 complemented bitmaps. We will have already advanced past the just
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
800 iterated bit. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
801
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
802 static inline bool
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
803 bmp_iter_and_compl (bitmap_iterator *bi, unsigned *bit_no)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
804 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
805 /* If our current word is nonzero, it contains the bit we want. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
806 if (bi->bits)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
807 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
808 next_bit:
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
809 bmp_iter_next_bit (bi, bit_no);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
810 return true;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
811 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
812
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
813 /* Round up to the word boundary. We might have just iterated past
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
814 the end of the last word, hence the -1. It is not possible for
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
815 bit_no to point at the beginning of the now last word. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
816 *bit_no = ((*bit_no + BITMAP_WORD_BITS - 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
817 / BITMAP_WORD_BITS * BITMAP_WORD_BITS);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
818 bi->word_no++;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
819
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
820 while (1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
821 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
822 /* Find the next nonzero word in this elt. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
823 while (bi->word_no != BITMAP_ELEMENT_WORDS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
824 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
825 bi->bits = bi->elt1->bits[bi->word_no];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
826 if (bi->elt2 && bi->elt2->indx == bi->elt1->indx)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
827 bi->bits &= ~bi->elt2->bits[bi->word_no];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
828 if (bi->bits)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
829 goto next_bit;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
830 *bit_no += BITMAP_WORD_BITS;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
831 bi->word_no++;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
832 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
833
111
kono
parents: 67
diff changeset
834 /* Make sure we didn't remove the element while iterating. */
kono
parents: 67
diff changeset
835 gcc_checking_assert (bi->elt1->indx != -1U);
kono
parents: 67
diff changeset
836
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
837 /* Advance to the next element of elt1. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
838 bi->elt1 = bi->elt1->next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
839 if (!bi->elt1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
840 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
841
111
kono
parents: 67
diff changeset
842 /* Make sure we didn't remove the element while iterating. */
kono
parents: 67
diff changeset
843 gcc_checking_assert (! bi->elt2 || bi->elt2->indx != -1U);
kono
parents: 67
diff changeset
844
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
845 /* Advance elt2 until it is no less than elt1. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
846 while (bi->elt2 && bi->elt2->indx < bi->elt1->indx)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
847 bi->elt2 = bi->elt2->next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
848
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
849 *bit_no = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
850 bi->word_no = 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
851 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
852 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
853
111
kono
parents: 67
diff changeset
854 /* If you are modifying a bitmap you are currently iterating over you
kono
parents: 67
diff changeset
855 have to ensure to
kono
parents: 67
diff changeset
856 - never remove the current bit;
kono
parents: 67
diff changeset
857 - if you set or clear a bit before the current bit this operation
kono
parents: 67
diff changeset
858 will not affect the set of bits you are visiting during the iteration;
kono
parents: 67
diff changeset
859 - if you set or clear a bit after the current bit it is unspecified
kono
parents: 67
diff changeset
860 whether that affects the set of bits you are visiting during the
kono
parents: 67
diff changeset
861 iteration.
kono
parents: 67
diff changeset
862 If you want to remove the current bit you can delay this to the next
kono
parents: 67
diff changeset
863 iteration (and after the iteration in case the last iteration is
kono
parents: 67
diff changeset
864 affected). */
kono
parents: 67
diff changeset
865
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
866 /* Loop over all bits set in BITMAP, starting with MIN and setting
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
867 BITNUM to the bit number. ITER is a bitmap iterator. BITNUM
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
868 should be treated as a read-only variable as it contains loop
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
869 state. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
870
111
kono
parents: 67
diff changeset
871 #ifndef EXECUTE_IF_SET_IN_BITMAP
kono
parents: 67
diff changeset
872 /* See sbitmap.h for the other definition of EXECUTE_IF_SET_IN_BITMAP. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
873 #define EXECUTE_IF_SET_IN_BITMAP(BITMAP, MIN, BITNUM, ITER) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
874 for (bmp_iter_set_init (&(ITER), (BITMAP), (MIN), &(BITNUM)); \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
875 bmp_iter_set (&(ITER), &(BITNUM)); \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
876 bmp_iter_next (&(ITER), &(BITNUM)))
111
kono
parents: 67
diff changeset
877 #endif
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
878
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
879 /* Loop over all the bits set in BITMAP1 & BITMAP2, starting with MIN
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
880 and setting BITNUM to the bit number. ITER is a bitmap iterator.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
881 BITNUM should be treated as a read-only variable as it contains
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
882 loop state. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
883
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
884 #define EXECUTE_IF_AND_IN_BITMAP(BITMAP1, BITMAP2, MIN, BITNUM, ITER) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
885 for (bmp_iter_and_init (&(ITER), (BITMAP1), (BITMAP2), (MIN), \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
886 &(BITNUM)); \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
887 bmp_iter_and (&(ITER), &(BITNUM)); \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
888 bmp_iter_next (&(ITER), &(BITNUM)))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
889
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
890 /* Loop over all the bits set in BITMAP1 & ~BITMAP2, starting with MIN
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
891 and setting BITNUM to the bit number. ITER is a bitmap iterator.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
892 BITNUM should be treated as a read-only variable as it contains
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
893 loop state. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
894
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
895 #define EXECUTE_IF_AND_COMPL_IN_BITMAP(BITMAP1, BITMAP2, MIN, BITNUM, ITER) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
896 for (bmp_iter_and_compl_init (&(ITER), (BITMAP1), (BITMAP2), (MIN), \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
897 &(BITNUM)); \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
898 bmp_iter_and_compl (&(ITER), &(BITNUM)); \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
899 bmp_iter_next (&(ITER), &(BITNUM)))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
900
111
kono
parents: 67
diff changeset
901 /* A class that ties the lifetime of a bitmap to its scope. */
kono
parents: 67
diff changeset
902 class auto_bitmap
kono
parents: 67
diff changeset
903 {
kono
parents: 67
diff changeset
904 public:
kono
parents: 67
diff changeset
905 auto_bitmap () { bitmap_initialize (&m_bits, &bitmap_default_obstack); }
kono
parents: 67
diff changeset
906 explicit auto_bitmap (bitmap_obstack *o) { bitmap_initialize (&m_bits, o); }
kono
parents: 67
diff changeset
907 ~auto_bitmap () { bitmap_clear (&m_bits); }
kono
parents: 67
diff changeset
908 // Allow calling bitmap functions on our bitmap.
kono
parents: 67
diff changeset
909 operator bitmap () { return &m_bits; }
kono
parents: 67
diff changeset
910
kono
parents: 67
diff changeset
911 private:
kono
parents: 67
diff changeset
912 // Prevent making a copy that references our bitmap.
kono
parents: 67
diff changeset
913 auto_bitmap (const auto_bitmap &);
kono
parents: 67
diff changeset
914 auto_bitmap &operator = (const auto_bitmap &);
kono
parents: 67
diff changeset
915 #if __cplusplus >= 201103L
kono
parents: 67
diff changeset
916 auto_bitmap (auto_bitmap &&);
kono
parents: 67
diff changeset
917 auto_bitmap &operator = (auto_bitmap &&);
kono
parents: 67
diff changeset
918 #endif
kono
parents: 67
diff changeset
919
kono
parents: 67
diff changeset
920 bitmap_head m_bits;
kono
parents: 67
diff changeset
921 };
kono
parents: 67
diff changeset
922
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
923 #endif /* GCC_BITMAP_H */