@@ -135,28 +135,29 @@ We discuss all of them in the following sub-sections.
135
135
#### Struct ` reaching_definitiont `
136
136
137
137
Identifies a GOTO instruction where a given variable is defined (i.e. it is set
138
- a certain value). In consists of these data:
138
+ to a certain value). It consists of these data:
139
139
- ` identifier ` The name of the variable which was defined.
140
- - ` definition_at ` The iterator to the GOTO instruction where the variable is
140
+ - ` definition_at ` The iterator to the GOTO instruction where the variable
141
+ has been written to.
141
142
- ` bit_begin ` and ` bit_end ` These two integers define a range of bits (i.e. the
142
- begin and end bit indices) which represent the value of the variable. Clearly,
143
- ` 0 <= bit_begin < bit_end ` . However, ` bit_end ` can also be set a special value
144
- ` - ` , which means infinite/unknown index.
143
+ begin and end bit indices) which represent the value of the variable. So, the
144
+ integers represents the half-open interval ` [bit_begin, bit_end) ` of bits.
145
+ However, ` bit_end ` can also be set a special value ` -1 ` , which means
146
+ infinite/unknown index.
145
147
146
- There is defined an order of instances of this structure. But its purpose is
147
- only for to be able to use instances as keys in ordered containers, like
148
- ` std::map ` .
148
+ In order to use instances of this structure as keys in ordered containers, such
149
+ as std::map, an ordering is defined.
149
150
150
151
#### Class ` sparse_bitvector_analysist `
151
152
152
153
An instance of this class provides an assignment of unique numeric ` ID ` to each
153
154
inserted ` reaching_definitionst ` instance. Internally, the class holds two data
154
155
members:
155
156
156
- - ` value_map ` It is ( an unordered) map from names of program variables to a set
157
+ - ` value_map ` is an unordered map from names of program variables to a set
157
158
of pairs (` reaching_definitiont ` , ` ID ` ). Formally, the map is defined as
158
159
` value_map: var_names -> (reaching_definitionst -> ID) ` .
159
- - ` values ` It is a map from an ` ID ` to the corresponding ` reaching_definitiont `
160
+ - ` values ` is a map from an ` ID ` to the corresponding ` reaching_definitiont `
160
161
instance inside the map ` value_map ` . Namely, the map is implemented as an
161
162
` std::vector ` of iterators to elements of the map ` value_map ` . An index to
162
163
` values ` vector is the ` ID ` of the related ` reaching_definitionst ` instance.
@@ -172,8 +173,8 @@ information is held in these data members:
172
173
173
174
- ` has_value ` This (three value logic) flag determines, whether the instance
174
175
represents ` top ` , ` bottom ` , or any other element of the lattice, by values
175
- ` TRUE ` , ` FALSE ` , and ` UNKNOW ` respectively. Initially it is set to ` FALSE ` .
176
- - ` bv_container ` It is a pointer to a
176
+ ` TRUE ` , ` FALSE ` , and ` UNKNOWN ` respectively. Initially it is set to ` FALSE ` .
177
+ - ` bv_container ` is a pointer to a
177
178
` sparse_bitvector_analysist<reaching_definitiont> ` instance. It holds the
178
179
actual reaching definitions data of individual program variables. This
179
180
pointer is initially ` nullptr ` and it is later set (by
@@ -182,13 +183,13 @@ information is held in these data members:
182
183
all ` rd_range_domaint ` instances. NOTE: ` reaching_definitions_analysist `
183
184
inherits from ` sparse_bitvector_analysist<reaching_definitiont> ` and so
184
185
` this ` is passed to ` set_bitvector_container ` for all instances.
185
- - ` values ` It is ( an ordered) map from program variable names to ` ID ` s of
186
+ - ` values ` is an ordered map from program variable names to ` ID ` s of
186
187
` reaching_definitiont ` instances stored in map pointed to by ` bv_container ` .
187
188
The map is not empty only if ` has_value ` is ` UNKNOWN ` . Variables in the map
188
189
are all those which are live at the associated instruction.
189
- - ` export_cache ` It is a helper data structure. It consists of data already
190
+ - ` export_cache ` is a helper data structure. It consists of data already
190
191
stored in ` values ` and ` bv_container ` . The purpose of this structure is to
191
- provide a boost for certain operations (discussed below). It is basically
192
+ provide a speed-up for certain operations (discussed below). It is basically
192
193
(an ordered) map from (a subset of) variables in ` values ` to iterators to
193
194
GOTO instructions where the variables are defined. Moreover, each such
194
195
iterator is also associated with a range of bits defining the value of that
@@ -208,7 +209,7 @@ NOTE: The operation actually does not produce a new `join` element. The element
208
209
` a ` is modified to become the ` join ` element.
209
210
210
211
NOTE: When union of ` a.values[v] ` and ` b.values[v] ` is computed, then ` v ` must
211
- removed from the cache ` export_cache `
212
+ be removed from the cache ` export_cache ` .
212
213
213
214
##### Method ` transform `
214
215
@@ -250,7 +251,7 @@ A utility function which updates internal data structures by inserting a
250
251
new reaching definition record, for a passed variable name, written in given
251
252
GOTO instruction (identified by an iterator), at same range of bits.
252
253
253
- ##### Method ` polulate_cache `
254
+ ##### Method ` populate_cache `
254
255
255
256
Given a variable name ` v ` it collects data from ` bv_container ` for each ` ID `
256
257
in ` values[v] ` and stores them into ` export_cache[v] ` . Namely, for each
0 commit comments