Skip to content

Commit f8e38fb

Browse files
committed
Add edge type parameter to ai transform method
1 parent 9091faa commit f8e38fb

22 files changed

+61
-25
lines changed

src/analyses/ai.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,8 @@ bool ai_baset::visit(
365365
// initialize state, if necessary
366366
get_state(to_l);
367367

368-
new_values.transform(l, to_l, *this, ns);
368+
new_values.transform(
369+
l, to_l, *this, ns, ai_domain_baset::edge_typet::FUNCTION_LOCAL);
369370

370371
if(merge(new_values, l, to_l))
371372
have_new_values=true;
@@ -398,7 +399,8 @@ bool ai_baset::do_function_call(
398399
{
399400
// if we don't have a body, we just do an edige call -> return
400401
std::unique_ptr<statet> tmp_state(make_temporary_state(get_state(l_call)));
401-
tmp_state->transform(l_call, l_return, *this, ns);
402+
tmp_state->transform(
403+
l_call, l_return, *this, ns, ai_domain_baset::edge_typet::FUNCTION_LOCAL);
402404

403405
return merge(*tmp_state, l_call, l_return);
404406
}
@@ -415,7 +417,8 @@ bool ai_baset::do_function_call(
415417

416418
// do the edge from the call site to the beginning of the function
417419
std::unique_ptr<statet> tmp_state(make_temporary_state(get_state(l_call)));
418-
tmp_state->transform(l_call, l_begin, *this, ns);
420+
tmp_state->transform(
421+
l_call, l_begin, *this, ns, ai_domain_baset::edge_typet::CALL);
419422

420423
bool new_data=false;
421424

@@ -442,7 +445,8 @@ bool ai_baset::do_function_call(
442445
return false; // function exit point not reachable
443446

444447
std::unique_ptr<statet> tmp_state(make_temporary_state(end_state));
445-
tmp_state->transform(l_end, l_return, *this, ns);
448+
tmp_state->transform(
449+
l_end, l_return, *this, ns, ai_domain_baset::edge_typet::RETURN);
446450

447451
// Propagate those
448452
return merge(*tmp_state, l_end, l_return);

src/analyses/ai.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ class ai_baset;
3131
class ai_domain_baset
3232
{
3333
public:
34+
enum class edge_typet
35+
{
36+
FUNCTION_LOCAL,
37+
CALL,
38+
RETURN,
39+
};
40+
3441
// The constructor is expected to produce 'false'
3542
// or 'bottom'
3643
ai_domain_baset()
@@ -53,7 +60,8 @@ class ai_domain_baset
5360
locationt from,
5461
locationt to,
5562
ai_baset &ai,
56-
const namespacet &ns)=0;
63+
const namespacet &ns,
64+
edge_typet edge_type) = 0;
5765

5866
virtual void output(
5967
std::ostream &out,

src/analyses/constant_propagator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ void constant_propagator_domaint::transform(
4545
locationt from,
4646
locationt to,
4747
ai_baset &ai,
48-
const namespacet &ns)
48+
const namespacet &ns,
49+
ai_domain_baset::edge_typet /*edge_type*/)
4950
{
5051
#ifdef DEBUG
5152
std::cout << "Transform from/to:\n";

src/analyses/constant_propagator.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class constant_propagator_domaint:public ai_domain_baset
2525
locationt from,
2626
locationt to,
2727
ai_baset &ai_base,
28-
const namespacet &ns) final override;
28+
const namespacet &ns,
29+
ai_domain_baset::edge_typet edge_type) final override;
2930

3031
virtual void output(
3132
std::ostream &out,

src/analyses/custom_bitvector_analysis.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ void custom_bitvector_domaint::transform(
269269
locationt from,
270270
locationt to,
271271
ai_baset &ai,
272-
const namespacet &ns)
272+
const namespacet &ns,
273+
ai_domain_baset::edge_typet /*edge_type*/)
273274
{
274275
// upcast of ai
275276
custom_bitvector_analysist &cba=

src/analyses/custom_bitvector_analysis.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ class custom_bitvector_domaint:public ai_domain_baset
2727
locationt from,
2828
locationt to,
2929
ai_baset &ai,
30-
const namespacet &ns) final override;
30+
const namespacet &ns,
31+
ai_domain_baset::edge_typet edge_type) final override;
3132

3233
void output(
3334
std::ostream &out,

src/analyses/dependence_graph.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ void dep_graph_domaint::transform(
187187
goto_programt::const_targett from,
188188
goto_programt::const_targett to,
189189
ai_baset &ai,
190-
const namespacet &ns)
190+
const namespacet &ns,
191+
ai_domain_baset::edge_typet /*edge_type*/)
191192
{
192193
dependence_grapht *dep_graph=dynamic_cast<dependence_grapht*>(&ai);
193194
assert(dep_graph!=nullptr);

src/analyses/dependence_graph.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ class dep_graph_domaint:public ai_domain_baset
8383
goto_programt::const_targett from,
8484
goto_programt::const_targett to,
8585
ai_baset &ai,
86-
const namespacet &ns) final override;
86+
const namespacet &ns,
87+
ai_domain_baset::edge_typet edge_type) final override;
8788

8889
void output(
8990
std::ostream &out,

src/analyses/escape_analysis.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ void escape_domaint::transform(
165165
locationt from,
166166
locationt to,
167167
ai_baset &ai,
168-
const namespacet &ns)
168+
const namespacet &ns,
169+
ai_domain_baset::edge_typet /*edge_type*/)
169170
{
170171
if(has_values.is_false())
171172
return;

src/analyses/escape_analysis.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ class escape_domaint:public ai_domain_baset
3232
locationt from,
3333
locationt to,
3434
ai_baset &ai,
35-
const namespacet &ns) final override;
35+
const namespacet &ns,
36+
ai_domain_baset::edge_typet edge_type) final override;
3637

3738
void output(
3839
std::ostream &out,

0 commit comments

Comments
 (0)