@@ -92,7 +92,65 @@ To be documented.
92
92
93
93
\subsection analyses-dependence-graph Data- and control-dependence analysis (dependence_grapht)
94
94
95
- To be documented.
95
+ ### Dependence graph
96
+
97
+ Implemented in ` src/analyses/dependence_graph.h(cpp) ` . It is a graph and an
98
+ abstract interpreter at the same time. The abstract interpretation nature
99
+ allows a dependence graph to [ build itself] ( #Construction )
100
+ (the graph) from a given GOTO program.
101
+
102
+ A dependence graph extends the class ` grapht ` with ` dep_nodet ` as the type of
103
+ nodes (see ` src/util/graph.h ` for more details about
104
+ [ graph representation] ( "../util/README.md" ) ).
105
+ The ` dep_nodet ` extends ` graph_nodet<dep_edget> ` with an iterator to a GOTO
106
+ program instruction. It means that each graph node corresponds to a particular
107
+ program instruction. A labelled edge ` (u, v) ` of a dependence graph expresses
108
+ a dependency of the program instruction corresponding to node ` u ` on the program
109
+ instruction corresponding to node ` v ` . The label of the edge (data of the
110
+ type ` dep_edget ` attached to the edge) denotes the kind of dependency. It can be
111
+ ` control-dependency ` , ` data-dependency ` , or both.
112
+
113
+ #### Control dependency
114
+
115
+ An instruction ` j ` corresponding to node ` v ` is control-dependent on instruction
116
+ ` i ` corresponding to node ` u ` if and only if ` j ` post-dominates at least one
117
+ but not all successors instructions of ` i ` .
118
+
119
+ An instruction ` j ` post-dominates an instruction ` i ` if and only if each
120
+ execution path going through ` i ` eventually reaches ` j ` .
121
+
122
+ Post-dominators analysis is implemented in ` src/analyses/cfg_dominators.h(cpp) ` .
123
+
124
+ #### Data dependency
125
+
126
+ The instruction ` j ` corresponding to node ` v ` is data-dependent on the
127
+ instruction ` i ` corresponding to node ` u ` if and only if ` j ` may read data from
128
+ the memory location defined (i.e. written) by ` i ` .
129
+
130
+ The reaching definitions analysis is used together with the read-write ranges
131
+ analysis to check whether one instruction may read data writen by another
132
+ instruction. For more details see ` src/analyses/reaching_definitions.h(cpp) ` and
133
+ ` src/analyses/goto_rw.h(cpp) ` .
134
+
135
+ #### Construction
136
+
137
+ The dependence graph extends the standard abstract interpreter class ` ait `
138
+ with post-dominators analysis and reaching definitions analysis. The domain of
139
+ the abstract interpreter is defined in the class ` dep_graph_domaint ` .
140
+
141
+ For each instruction ` i ` an instance of ` dep_graph_domaint ` associated with ` i `
142
+ is created. The instance stores a set ` control_deps ` of program
143
+ instructions the instruction ` i ` depends on via control-dependency, and a set
144
+ ` data_deps ` of program instructions the instruction ` i ` depends on via
145
+ data-dependency. These sets are updated (increased) during the computation,
146
+ until a fix-point is reached.
147
+
148
+ The construction of a dependence graph is started by calling its ` initialize `
149
+ method and then, once a fix-point is reached by the abstract interpreter, the
150
+ method ` finalize ` converts data in the interpreter's domain (i.e. from
151
+ ` dep_graph_domaint ` instances) into edges of the graph. Nodes of the graph are
152
+ created during the run of the abstract interpreter; they are linked to the
153
+ corresponding program instructions.
96
154
97
155
\subsection analyses-dirtyt Address-taken lvalue analysis (dirtyt)
98
156
0 commit comments