Skip to content

Commit 6a0ce03

Browse files
committed
Updates requested in the review.
Mostly rewording of few sentences. There is also added one sentence to Data representation of the grapht: initialisation of inserted node.
1 parent 1da964c commit 6a0ce03

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

src/analyses/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,17 @@ To be documented.
9595
### Dependence graph
9696

9797
Implemented in `src/analyses/dependence_graph.h(cpp)`. It is a graph and an
98-
abstract interpreter in the same time. The abstract interpretation nature
98+
abstract interpreter at the same time. The abstract interpretation nature
9999
allows a dependence graph to build itself (the graph) from a given GOTO program.
100100

101101
A dependence graph extends the class `grapht` with `dep_nodet` as the type of
102102
nodes (see `src/util/graph.h` for more details about
103103
[graph representation](../util/README.md)).
104-
The `dep_nodet` extends `graph_nodet<dep_edget>` by an iterator to a GOTO
104+
The `dep_nodet` extends `graph_nodet<dep_edget>` with an iterator to a GOTO
105105
program instruction. It means that each graph node corresponds to a particular
106106
program instruction. A labelled edge `(u, v)` of a dependence graph expresses
107107
a dependency of the program instruction corresponding to node `u` on the program
108-
instruction corresponding to node `v`. The label of the edge (i.e. data of the
108+
instruction corresponding to node `v`. The label of the edge (data of the
109109
type `dep_edget` attached to the edge) denotes the kind of dependency. It can be
110110
`control-dependency`, `data-dependency`, or both.
111111

@@ -124,11 +124,11 @@ Post-dominators analysis is implemented in `src/analyses/cfg_dominators.h(cpp)`.
124124

125125
The instruction `j` corresponding to node `v` is data-dependent on the
126126
instruction `i` corresponding to node `u` if and only if `j` may read data from
127-
memory location defined (i.e. written) by `i`.
127+
the memory location defined (i.e. written) by `i`.
128128

129-
Reaching definitions analysis together with read-write ranges analysis are used
130-
to check whether one instruction may read data writen by another instruction.
131-
For more details see `src/analyses/reaching_definitions.h(cpp)` and
129+
The reaching definitions analysis is used together with the read-write ranges
130+
analysis to check whether one instruction may read data writen by another
131+
instruction. For more details see `src/analyses/reaching_definitions.h(cpp)` and
132132
`src/analyses/goto_rw.h(cpp)`.
133133

134134
#### Construction
@@ -137,8 +137,8 @@ The dependence graph extends the standard abstract interpreter class `ait`
137137
with post-dominators analysis and reaching definitions analysis. The domain of
138138
the abstract interpreter is defined in the class `dep_graph_domaint`.
139139

140-
For each instruction `i` there is created an instance of `dep_graph_domaint`
141-
associated with `i`. The instance stores a set `control_deps` of program
140+
For each instruction `i` an instance of `dep_graph_domaint` associated with `i`
141+
is created. The instance stores a set `control_deps` of program
142142
instructions the instruction `i` depends on via control-dependency, and a set
143143
`data_deps` of program instructions the instruction `i` depends on via
144144
data-dependency. These sets are updated (increased) during the computation,

src/util/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,20 +388,22 @@ _not_ be extended - but it may be helpful to be aware of where this happens.
388388
\subsection Graph
389389
### Graph
390390

391-
Implemented in `src/util/graph.h` as `grapht` class. The class natively defines
392-
only a directional graph. However, an undirected graph can be emulated by
391+
Implemented in `src/util/graph.h` as `grapht` class. The `grapht` class
392+
represents a directed graph. However, an undirected graph can be emulated by
393393
inserting for each edge (u, v) also (v, u). A multi-graph is not supported
394394
though, because parallel edges are not allowed between vertices.
395395

396396
#### Data representation
397397

398-
A graph is defined by a template class `grapht<N>`, where the type `N` defines
399-
a node of the graph. The class `grapht` stores the nodes in a vector. A user of
398+
A graph is defined by a template class `grapht<N>`, where `N` is the type of the
399+
nodes of the graph. The class `grapht` stores the nodes in a vector. A user of
400400
the graph is supposed to access the nodes via their indices in the vector. The
401401
node type `N` must meet these requirements:
402402
- It must be default constructible; the common way how to insert a node to the
403403
graph is to call method `add_node` which pushes a new default-constructed
404404
instance of `N` to the end of the vector and returns its index.
405+
Then `operator[]` can be used to obtain a reference to the pushed instance and
406+
set its content as desired.
405407
- It must define a type `edget`, representing type of data attached to any edge
406408
of the graph; in case edges should not have any data attached, then one can
407409
use a predefined class `empty_edget`. The type must be default-constructible.
@@ -417,7 +419,8 @@ node type `N` must meet these requirements:
417419
- It must define a method `pretty` converting the node to a "pretty" string.
418420

419421
One can use a predefined template class `graph_nodet<E>` as the template
420-
parameter `N` of the graph.
422+
parameter `N` of the graph. The template parameter `E` allows to define the type
423+
`edget`.
421424

422425
#### Graph algorithms
423426

0 commit comments

Comments
 (0)