Skip to content

Commit d692e69

Browse files
authored
Merge pull request #3864 from tautschnig/function-dependence_graph
Dependence graph now tracks a function identifier [blocks: #3126]
2 parents 81d8eb1 + 5de7631 commit d692e69

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/analyses/dependence_graph.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ bool dep_graph_domaint::merge(
5252
}
5353

5454
void dep_graph_domaint::control_dependencies(
55+
const irep_idt &function_id,
5556
goto_programt::const_targett from,
5657
goto_programt::const_targett to,
5758
dependence_grapht &dep_graph)
@@ -82,7 +83,7 @@ void dep_graph_domaint::control_dependencies(
8283

8384
// Get postdominators
8485

85-
const irep_idt id=from->function;
86+
const irep_idt id = function_id;
8687
const cfg_post_dominatorst &pd=dep_graph.cfg_post_dominators().at(id);
8788

8889
// Check all candidates
@@ -151,6 +152,7 @@ static bool may_be_def_use_pair(
151152

152153
void dep_graph_domaint::data_dependencies(
153154
goto_programt::const_targett,
155+
const irep_idt &function_to,
154156
goto_programt::const_targett to,
155157
dependence_grapht &dep_graph,
156158
const namespacet &ns)
@@ -162,7 +164,7 @@ void dep_graph_domaint::data_dependencies(
162164
value_setst &value_sets=
163165
dep_graph.reaching_definitions().get_value_sets();
164166
rw_range_set_value_sett rw_set(ns, value_sets);
165-
goto_rw(to->function, to, rw_set);
167+
goto_rw(function_to, to, rw_set);
166168

167169
forall_rw_range_set_r_objects(it, rw_set)
168170
{
@@ -205,7 +207,7 @@ void dep_graph_domaint::transform(
205207
{
206208
if(function_from == function_to)
207209
{
208-
control_dependencies(from, to, *dep_graph);
210+
control_dependencies(function_from, from, to, *dep_graph);
209211
}
210212
else
211213
{
@@ -231,9 +233,9 @@ void dep_graph_domaint::transform(
231233
}
232234
}
233235
else
234-
control_dependencies(from, to, *dep_graph);
236+
control_dependencies(function_from, from, to, *dep_graph);
235237

236-
data_dependencies(from, to, *dep_graph, ns);
238+
data_dependencies(from, function_to, to, *dep_graph, ns);
237239
}
238240

239241
void dep_graph_domaint::output(

src/analyses/dependence_graph.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,14 @@ class dep_graph_domaint:public ai_domain_baset
203203
dependence_graph_test_get_data_deps(const dep_graph_domaint &);
204204

205205
void control_dependencies(
206+
const irep_idt &function_id,
206207
goto_programt::const_targett from,
207208
goto_programt::const_targett to,
208209
dependence_grapht &dep_graph);
209210

210211
void data_dependencies(
211212
goto_programt::const_targett from,
213+
const irep_idt &function_to,
212214
goto_programt::const_targett to,
213215
dependence_grapht &dep_graph,
214216
const namespacet &ns);

0 commit comments

Comments
 (0)