Skip to content

Commit 75ace41

Browse files
committed
Updates requested in the review: Bug-fixes, typos, rephrasing.
1 parent ff41c1c commit 75ace41

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

src/analyses/README.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -135,28 +135,29 @@ We discuss all of them in the following sub-sections.
135135
#### Struct `reaching_definitiont`
136136

137137
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:
139139
- `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.
141142
- `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.
145147

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.
149150

150151
#### Class `sparse_bitvector_analysist`
151152

152153
An instance of this class provides an assignment of unique numeric `ID` to each
153154
inserted `reaching_definitionst` instance. Internally, the class holds two data
154155
members:
155156

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
157158
of pairs (`reaching_definitiont`, `ID`). Formally, the map is defined as
158159
`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`
160161
instance inside the map `value_map`. Namely, the map is implemented as an
161162
`std::vector` of iterators to elements of the map `value_map`. An index to
162163
`values` vector is the `ID` of the related `reaching_definitionst` instance.
@@ -172,8 +173,8 @@ information is held in these data members:
172173

173174
- `has_value` This (three value logic) flag determines, whether the instance
174175
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
177178
`sparse_bitvector_analysist<reaching_definitiont>` instance. It holds the
178179
actual reaching definitions data of individual program variables. This
179180
pointer is initially `nullptr` and it is later set (by
@@ -182,13 +183,13 @@ information is held in these data members:
182183
all `rd_range_domaint` instances. NOTE: `reaching_definitions_analysist`
183184
inherits from `sparse_bitvector_analysist<reaching_definitiont>` and so
184185
`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
186187
`reaching_definitiont` instances stored in map pointed to by `bv_container`.
187188
The map is not empty only if `has_value` is `UNKNOWN`. Variables in the map
188189
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
190191
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
192193
(an ordered) map from (a subset of) variables in `values` to iterators to
193194
GOTO instructions where the variables are defined. Moreover, each such
194195
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
208209
`a` is modified to become the `join` element.
209210

210211
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`.
212213

213214
##### Method `transform`
214215

@@ -250,7 +251,7 @@ A utility function which updates internal data structures by inserting a
250251
new reaching definition record, for a passed variable name, written in given
251252
GOTO instruction (identified by an iterator), at same range of bits.
252253

253-
##### Method `polulate_cache`
254+
##### Method `populate_cache`
254255

255256
Given a variable name `v` it collects data from `bv_container` for each `ID`
256257
in `values[v]` and stores them into `export_cache[v]`. Namely, for each

0 commit comments

Comments
 (0)