@@ -56,14 +56,6 @@ void flow_insensitive_analysis_baset::operator()(
56
56
fixedpoint (goto_functions);
57
57
}
58
58
59
- void flow_insensitive_analysis_baset::operator ()(
60
- const goto_programt &goto_program)
61
- {
62
- initialize (goto_program);
63
- goto_functionst goto_functions;
64
- fixedpoint (goto_program, goto_functions);
65
- }
66
-
67
59
void flow_insensitive_analysis_baset::output (
68
60
const goto_functionst &goto_functions,
69
61
std::ostream &out)
@@ -72,14 +64,14 @@ void flow_insensitive_analysis_baset::output(
72
64
{
73
65
out << " ////\n " << " //// Function: " << f_it->first << " \n ////\n\n " ;
74
66
75
- output (f_it->second . body , f_it->first , out);
67
+ output (f_it->first , f_it->second . body , out);
76
68
}
77
69
}
78
70
79
71
void flow_insensitive_analysis_baset::output (
80
- const goto_programt &,
81
72
const irep_idt &,
82
- std::ostream &out) const
73
+ const goto_programt &,
74
+ std::ostream &out)
83
75
{
84
76
get_state ().output (ns, out);
85
77
}
@@ -102,6 +94,7 @@ flow_insensitive_analysis_baset::get_next(
102
94
}
103
95
104
96
bool flow_insensitive_analysis_baset::fixedpoint (
97
+ const irep_idt &function_identifier,
105
98
const goto_programt &goto_program,
106
99
const goto_functionst &goto_functions)
107
100
{
@@ -122,14 +115,15 @@ bool flow_insensitive_analysis_baset::fixedpoint(
122
115
{
123
116
locationt l=get_next (working_set);
124
117
125
- if (visit (l, working_set, goto_program, goto_functions))
118
+ if (visit (function_identifier, l, working_set, goto_program, goto_functions))
126
119
new_data=true ;
127
120
}
128
121
129
122
return new_data;
130
123
}
131
124
132
125
bool flow_insensitive_analysis_baset::visit (
126
+ const irep_idt &function_identifier,
133
127
locationt l,
134
128
working_sett &working_set,
135
129
const goto_programt &goto_program,
@@ -160,16 +154,17 @@ bool flow_insensitive_analysis_baset::visit(
160
154
// this is a big special case
161
155
const code_function_callt &code = to_code_function_call (l->code );
162
156
163
- changed=
164
- do_function_call_rec (
165
- l,
166
- code.function (),
167
- code.arguments (),
168
- get_state (),
169
- goto_functions);
157
+ changed = do_function_call_rec (
158
+ function_identifier,
159
+ l,
160
+ code.function (),
161
+ code.arguments (),
162
+ get_state (),
163
+ goto_functions);
170
164
}
171
165
else
172
- changed = get_state ().transform (ns, l, to_l);
166
+ changed = get_state ().transform (
167
+ ns, function_identifier, l, function_identifier, to_l);
173
168
174
169
if (changed || !seen (to_l))
175
170
{
@@ -196,6 +191,7 @@ bool flow_insensitive_analysis_baset::visit(
196
191
}
197
192
198
193
bool flow_insensitive_analysis_baset::do_function_call (
194
+ const irep_idt &calling_function,
199
195
locationt l_call,
200
196
const goto_functionst &goto_functions,
201
197
const goto_functionst::function_mapt::const_iterator f_it,
@@ -225,9 +221,11 @@ bool flow_insensitive_analysis_baset::do_function_call(
225
221
t->location_number =1 ;
226
222
227
223
locationt l_next=l_call; l_next++;
228
- bool new_data=state.transform (ns, l_call, r);
229
- new_data = state.transform (ns, r, t) || new_data;
230
- new_data = state.transform (ns, t, l_next) || new_data;
224
+ bool new_data =
225
+ state.transform (ns, calling_function, l_call, f_it->first , r);
226
+ new_data = state.transform (ns, f_it->first , r, f_it->first , t) || new_data;
227
+ new_data =
228
+ state.transform (ns, f_it->first , t, calling_function, l_next) || new_data;
231
229
232
230
return new_data;
233
231
}
@@ -244,7 +242,8 @@ bool flow_insensitive_analysis_baset::do_function_call(
244
242
l_begin->function == f_it->first , " function names have to match" );
245
243
246
244
// do the edge from the call site to the beginning of the function
247
- new_data=state.transform (ns, l_call, l_begin);
245
+ new_data =
246
+ state.transform (ns, calling_function, l_call, f_it->first , l_begin);
248
247
249
248
// do each function at least once
250
249
if (functions_done.find (f_it->first )==
@@ -258,7 +257,7 @@ bool flow_insensitive_analysis_baset::do_function_call(
258
257
if (new_data)
259
258
{
260
259
// recursive call
261
- fixedpoint (goto_function.body , goto_functions);
260
+ fixedpoint (f_it-> first , goto_function.body , goto_functions);
262
261
new_data=true ; // could be reset by fixedpoint
263
262
}
264
263
}
@@ -272,13 +271,16 @@ bool flow_insensitive_analysis_baset::do_function_call(
272
271
// do edge from end of function to instruction after call
273
272
locationt l_next=l_call;
274
273
l_next++;
275
- new_data = state.transform (ns, l_end, l_next) || new_data;
274
+ new_data =
275
+ state.transform (ns, f_it->first , l_end, calling_function, l_next) ||
276
+ new_data;
276
277
}
277
278
278
279
return new_data;
279
280
}
280
281
281
282
bool flow_insensitive_analysis_baset::do_function_call_rec (
283
+ const irep_idt &calling_function,
282
284
locationt l_call,
283
285
const exprt &function,
284
286
const exprt::operandst &arguments,
@@ -305,13 +307,8 @@ bool flow_insensitive_analysis_baset::do_function_call_rec(
305
307
if (it==goto_functions.function_map .end ())
306
308
throw " failed to find function " +id2string (identifier);
307
309
308
- new_data =
309
- do_function_call (
310
- l_call,
311
- goto_functions,
312
- it,
313
- arguments,
314
- state);
310
+ new_data = do_function_call (
311
+ calling_function, l_call, goto_functions, it, arguments, state);
315
312
316
313
recursion_set.erase (identifier);
317
314
}
@@ -320,21 +317,22 @@ bool flow_insensitive_analysis_baset::do_function_call_rec(
320
317
if (function.operands ().size ()!=3 )
321
318
throw " if takes three arguments" ;
322
319
323
- new_data =
324
- do_function_call_rec (
325
- l_call,
326
- function.op1 (),
327
- arguments,
328
- state,
329
- goto_functions);
330
-
331
- new_data =
332
- do_function_call_rec (
333
- l_call,
334
- function.op2 (),
335
- arguments,
336
- state,
337
- goto_functions) || new_data;
320
+ new_data = do_function_call_rec (
321
+ calling_function,
322
+ l_call,
323
+ function.op1 (),
324
+ arguments,
325
+ state,
326
+ goto_functions);
327
+
328
+ new_data = do_function_call_rec (
329
+ calling_function,
330
+ l_call,
331
+ function.op2 (),
332
+ arguments,
333
+ state,
334
+ goto_functions) ||
335
+ new_data;
338
336
}
339
337
else if (function.id ()==ID_dereference)
340
338
{
@@ -356,13 +354,14 @@ bool flow_insensitive_analysis_baset::do_function_call_rec(
356
354
357
355
if (it!=goto_functions.function_map .end ())
358
356
{
359
- new_data =
360
- do_function_call_rec (
361
- l_call,
362
- o.object (),
363
- arguments,
364
- state,
365
- goto_functions) || new_data;
357
+ new_data = do_function_call_rec (
358
+ calling_function,
359
+ l_call,
360
+ o.object (),
361
+ arguments,
362
+ state,
363
+ goto_functions) ||
364
+ new_data;
366
365
}
367
366
}
368
367
}
@@ -405,7 +404,7 @@ bool flow_insensitive_analysis_baset::fixedpoint(
405
404
const goto_functionst &goto_functions)
406
405
{
407
406
functions_done.insert (it->first );
408
- return fixedpoint (it->second .body , goto_functions);
407
+ return fixedpoint (it->first , it-> second .body , goto_functions);
409
408
}
410
409
411
410
void flow_insensitive_analysis_baset::update (const goto_functionst &)
0 commit comments