File tree Expand file tree Collapse file tree 12 files changed +163
-13
lines changed
regression/goto-instrument Expand file tree Collapse file tree 12 files changed +163
-13
lines changed Original file line number Diff line number Diff line change
1
+
2
+ int x ;
3
+
4
+ void g ()
5
+ {
6
+ x = 1 ;
7
+ }
8
+
9
+ void f ()
10
+ {
11
+ g ();
12
+ }
13
+
14
+ int main ()
15
+ {
16
+ f ();
17
+ }
18
+
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --function-inline main --log -
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+
2
+ int x ;
3
+
4
+ void h ()
5
+ {
6
+ x = 1 ;
7
+ }
8
+
9
+ void g ()
10
+ {
11
+ h ();
12
+ }
13
+
14
+ void f ()
15
+ {
16
+ g ();
17
+ }
18
+
19
+ int main ()
20
+ {
21
+ f ();
22
+ }
23
+
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --function-inline main --log - --no-caching
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+
2
+ int x ;
3
+
4
+ void h ()
5
+ {
6
+ x = 1 ;
7
+ }
8
+
9
+ void g ()
10
+ {
11
+ h ();
12
+ }
13
+
14
+ void f ()
15
+ {
16
+ g ();
17
+ }
18
+
19
+ int main ()
20
+ {
21
+ f ();
22
+ }
23
+
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --function-inline main --log - --no-caching --verbosity 9
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -1052,6 +1052,8 @@ void goto_instrument_parse_optionst::instrument_goto_program()
1052
1052
std::string function=cmdline.get_value (" function-inline" );
1053
1053
assert (!function.empty ());
1054
1054
1055
+ bool caching=!cmdline.isset (" no-caching" );
1056
+
1055
1057
do_indirect_call_and_rtti_removal ();
1056
1058
1057
1059
status () << " Inlining calls of function `" << function << " '" << eom;
@@ -1063,7 +1065,8 @@ void goto_instrument_parse_optionst::instrument_goto_program()
1063
1065
function,
1064
1066
ns,
1065
1067
ui_message_handler,
1066
- true );
1068
+ true ,
1069
+ caching);
1067
1070
}
1068
1071
else
1069
1072
{
@@ -1076,7 +1079,8 @@ void goto_instrument_parse_optionst::instrument_goto_program()
1076
1079
function,
1077
1080
ns,
1078
1081
ui_message_handler,
1079
- true );
1082
+ true ,
1083
+ caching);
1080
1084
1081
1085
if (have_file)
1082
1086
{
@@ -1548,6 +1552,7 @@ void goto_instrument_parse_optionst::help()
1548
1552
" --inline perform full inlining\n "
1549
1553
" --partial-inline perform partial inlining\n "
1550
1554
" --function-inline <function> transitively inline all calls <function> makes\n " // NOLINT(*)
1555
+ " --no-caching disable caching of intermediate results during transitive function inlining\n " // NOLINT(*)
1551
1556
" --log <file> log in json format which code segments were inlined, use with --function-inline\n " // NOLINT(*)
1552
1557
" --remove-function-pointers replace function pointers by case statement over function calls\n " // NOLINT(*)
1553
1558
" --add-library add models of C library functions\n "
Original file line number Diff line number Diff line change 53
53
" (show-struct-alignment)(interval-analysis)(show-intervals)" \
54
54
" (show-uninitialized)(show-locations)" \
55
55
" (full-slice)(reachability-slice)(slice-global-inits)" \
56
- " (inline)(partial-inline)(function-inline):(log):" \
56
+ " (inline)(partial-inline)(function-inline):(log):(no-caching) " \
57
57
" (remove-function-pointers)" \
58
58
" (show-claims)(show-properties)(property):" \
59
59
" (show-symbol-table)(show-points-to)(show-rw-set)" \
Original file line number Diff line number Diff line change @@ -273,13 +273,15 @@ void goto_function_inline(
273
273
const irep_idt function,
274
274
const namespacet &ns,
275
275
message_handlert &message_handler,
276
- bool adjust_function)
276
+ bool adjust_function,
277
+ bool caching)
277
278
{
278
279
goto_inlinet goto_inline (
279
280
goto_functions,
280
281
ns,
281
282
message_handler,
282
- adjust_function);
283
+ adjust_function,
284
+ caching);
283
285
284
286
goto_functionst::function_mapt::iterator f_it=
285
287
goto_functions.function_map .find (function);
@@ -327,13 +329,15 @@ jsont goto_function_inline_and_log(
327
329
const irep_idt function,
328
330
const namespacet &ns,
329
331
message_handlert &message_handler,
330
- bool adjust_function)
332
+ bool adjust_function,
333
+ bool caching)
331
334
{
332
335
goto_inlinet goto_inline (
333
336
goto_functions,
334
337
ns,
335
338
message_handler,
336
- adjust_function);
339
+ adjust_function,
340
+ caching);
337
341
338
342
goto_functionst::function_mapt::iterator f_it=
339
343
goto_functions.function_map .find (function);
@@ -349,6 +353,7 @@ jsont goto_function_inline_and_log(
349
353
// gather all calls
350
354
goto_inlinet::inline_mapt inline_map;
351
355
356
+ // create empty call list
352
357
goto_inlinet::call_listt &call_list=inline_map[f_it->first ];
353
358
354
359
goto_programt &goto_program=goto_function.body ;
Original file line number Diff line number Diff line change @@ -50,20 +50,23 @@ void goto_function_inline(
50
50
goto_modelt &goto_model,
51
51
const irep_idt function,
52
52
message_handlert &message_handler,
53
- bool adjust_function=false );
53
+ bool adjust_function=false ,
54
+ bool caching=true );
54
55
55
56
void goto_function_inline (
56
57
goto_functionst &goto_functions,
57
58
const irep_idt function,
58
59
const namespacet &ns,
59
60
message_handlert &message_handler,
60
- bool adjust_function=false );
61
+ bool adjust_function=false ,
62
+ bool caching=true );
61
63
62
64
jsont goto_function_inline_and_log (
63
65
goto_functionst &goto_functions,
64
66
const irep_idt function,
65
67
const namespacet &ns,
66
68
message_handlert &message_handler,
67
- bool adjust_function=false );
69
+ bool adjust_function=false ,
70
+ bool caching=true );
68
71
69
72
#endif // CPROVER_GOTO_PROGRAMS_GOTO_INLINE_H
You can’t perform that action at this time.
0 commit comments