@@ -17,6 +17,8 @@ Author: Daniel Kroening, kroening@kroening.com
17
17
18
18
#include < goto-programs/goto_convert_functions.h>
19
19
#include < goto-programs/remove_function_pointers.h>
20
+ #include < goto-programs/remove_virtual_functions.h>
21
+ #include < goto-programs/remove_instanceof.h>
20
22
#include < goto-programs/remove_skip.h>
21
23
#include < goto-programs/goto_inline.h>
22
24
#include < goto-programs/show_properties.h>
@@ -246,7 +248,7 @@ int goto_instrument_parse_optionst::doit()
246
248
247
249
if (cmdline.isset (" show-value-sets" ))
248
250
{
249
- do_function_pointer_removal ();
251
+ do_indirect_call_and_rtti_removal ();
250
252
do_partial_inlining ();
251
253
252
254
// recalculate numbers, etc.
@@ -263,7 +265,7 @@ int goto_instrument_parse_optionst::doit()
263
265
264
266
if (cmdline.isset (" show-global-may-alias" ))
265
267
{
266
- do_function_pointer_removal ();
268
+ do_indirect_call_and_rtti_removal ();
267
269
do_partial_inlining ();
268
270
do_remove_returns ();
269
271
parameter_assignments (symbol_table, goto_functions);
@@ -281,7 +283,7 @@ int goto_instrument_parse_optionst::doit()
281
283
282
284
if (cmdline.isset (" show-local-bitvector-analysis" ))
283
285
{
284
- do_function_pointer_removal ();
286
+ do_indirect_call_and_rtti_removal ();
285
287
do_partial_inlining ();
286
288
parameter_assignments (symbol_table, goto_functions);
287
289
@@ -305,7 +307,7 @@ int goto_instrument_parse_optionst::doit()
305
307
306
308
if (cmdline.isset (" show-custom-bitvector-analysis" ))
307
309
{
308
- do_function_pointer_removal ();
310
+ do_indirect_call_and_rtti_removal ();
309
311
do_partial_inlining ();
310
312
do_remove_returns ();
311
313
parameter_assignments (symbol_table, goto_functions);
@@ -331,7 +333,7 @@ int goto_instrument_parse_optionst::doit()
331
333
332
334
if (cmdline.isset (" show-escape-analysis" ))
333
335
{
334
- do_function_pointer_removal ();
336
+ do_indirect_call_and_rtti_removal ();
335
337
do_partial_inlining ();
336
338
do_remove_returns ();
337
339
parameter_assignments (symbol_table, goto_functions);
@@ -351,7 +353,7 @@ int goto_instrument_parse_optionst::doit()
351
353
352
354
if (cmdline.isset (" custom-bitvector-analysis" ))
353
355
{
354
- do_function_pointer_removal ();
356
+ do_indirect_call_and_rtti_removal ();
355
357
do_partial_inlining ();
356
358
do_remove_returns ();
357
359
parameter_assignments (symbol_table, goto_functions);
@@ -382,7 +384,7 @@ int goto_instrument_parse_optionst::doit()
382
384
383
385
if (cmdline.isset (" show-points-to" ))
384
386
{
385
- do_function_pointer_removal ();
387
+ do_indirect_call_and_rtti_removal ();
386
388
do_partial_inlining ();
387
389
388
390
// recalculate numbers, etc.
@@ -399,7 +401,7 @@ int goto_instrument_parse_optionst::doit()
399
401
400
402
if (cmdline.isset (" show-intervals" ))
401
403
{
402
- do_function_pointer_removal ();
404
+ do_indirect_call_and_rtti_removal ();
403
405
do_partial_inlining ();
404
406
405
407
// recalculate numbers, etc.
@@ -433,7 +435,7 @@ int goto_instrument_parse_optionst::doit()
433
435
434
436
if (!cmdline.isset (" inline" ))
435
437
{
436
- do_function_pointer_removal ();
438
+ do_indirect_call_and_rtti_removal ();
437
439
do_partial_inlining ();
438
440
439
441
// recalculate numbers, etc.
@@ -460,7 +462,7 @@ int goto_instrument_parse_optionst::doit()
460
462
461
463
if (cmdline.isset (" show-reaching-definitions" ))
462
464
{
463
- do_function_pointer_removal ();
465
+ do_indirect_call_and_rtti_removal ();
464
466
465
467
const namespacet ns (symbol_table);
466
468
reaching_definitions_analysist rd_analysis (ns);
@@ -483,7 +485,7 @@ int goto_instrument_parse_optionst::doit()
483
485
484
486
if (cmdline.isset (" show-dependence-graph" ))
485
487
{
486
- do_function_pointer_removal ();
488
+ do_indirect_call_and_rtti_removal ();
487
489
488
490
const namespacet ns (symbol_table);
489
491
dependence_grapht dependence_graph (ns);
@@ -674,7 +676,7 @@ int goto_instrument_parse_optionst::doit()
674
676
675
677
if (cmdline.isset (" accelerate" ))
676
678
{
677
- do_function_pointer_removal ();
679
+ do_indirect_call_and_rtti_removal ();
678
680
679
681
namespacet ns (symbol_table);
680
682
@@ -757,7 +759,7 @@ int goto_instrument_parse_optionst::doit()
757
759
758
760
/* ******************************************************************\
759
761
760
- Function: goto_instrument_parse_optionst::do_function_pointer_removal
762
+ Function: goto_instrument_parse_optionst::do_indirect_call_and_rtti_removal
761
763
762
764
Inputs:
763
765
@@ -767,9 +769,10 @@ Function: goto_instrument_parse_optionst::do_function_pointer_removal
767
769
768
770
\*******************************************************************/
769
771
770
- void goto_instrument_parse_optionst::do_function_pointer_removal ()
772
+ void goto_instrument_parse_optionst::do_indirect_call_and_rtti_removal (
773
+ bool force)
771
774
{
772
- if (function_pointer_removal_done)
775
+ if (function_pointer_removal_done && !force )
773
776
return ;
774
777
775
778
function_pointer_removal_done=true ;
@@ -779,6 +782,10 @@ void goto_instrument_parse_optionst::do_function_pointer_removal()
779
782
symbol_table,
780
783
goto_functions,
781
784
cmdline.isset (" pointer-check" ));
785
+ status () << " Virtual function removal" << eom;
786
+ remove_virtual_functions (symbol_table, goto_functions);
787
+ status () << " Java instanceof removal" << eom;
788
+ remove_instanceof (symbol_table, goto_functions);
782
789
}
783
790
784
791
/* ******************************************************************\
@@ -954,7 +961,7 @@ void goto_instrument_parse_optionst::instrument_goto_program()
954
961
// now do full inlining, if requested
955
962
if (cmdline.isset (" inline" ))
956
963
{
957
- do_function_pointer_removal ();
964
+ do_indirect_call_and_rtti_removal ();
958
965
959
966
if (cmdline.isset (" show-custom-bitvector-analysis" ) ||
960
967
cmdline.isset (" custom-bitvector-analysis" ))
@@ -980,7 +987,7 @@ void goto_instrument_parse_optionst::instrument_goto_program()
980
987
981
988
if (cmdline.isset (" escape-analysis" ))
982
989
{
983
- do_function_pointer_removal ();
990
+ do_indirect_call_and_rtti_removal ();
984
991
do_partial_inlining ();
985
992
do_remove_returns ();
986
993
parameter_assignments (symbol_table, goto_functions);
@@ -1009,14 +1016,14 @@ void goto_instrument_parse_optionst::instrument_goto_program()
1009
1016
1010
1017
// replace function pointers, if explicitly requested
1011
1018
if (cmdline.isset (" remove-function-pointers" ))
1012
- do_function_pointer_removal ();
1019
+ do_indirect_call_and_rtti_removal ();
1013
1020
1014
1021
if (cmdline.isset (" function-inline" ))
1015
1022
{
1016
1023
std::string function=cmdline.get_value (" function-inline" );
1017
1024
assert (!function.empty ());
1018
1025
1019
- do_function_pointer_removal ();
1026
+ do_indirect_call_and_rtti_removal ();
1020
1027
1021
1028
status () << " Inlining calls of function `" << function << " '" << eom;
1022
1029
@@ -1067,7 +1074,7 @@ void goto_instrument_parse_optionst::instrument_goto_program()
1067
1074
1068
1075
if (cmdline.isset (" partial-inline" ))
1069
1076
{
1070
- do_function_pointer_removal ();
1077
+ do_indirect_call_and_rtti_removal ();
1071
1078
1072
1079
status () << " Partial inlining" << eom;
1073
1080
goto_partial_inline (goto_functions, ns, ui_message_handler, true );
@@ -1079,11 +1086,7 @@ void goto_instrument_parse_optionst::instrument_goto_program()
1079
1086
// now do full inlining, if requested
1080
1087
if (cmdline.isset (" inline" ))
1081
1088
{
1082
- status () << " Function Pointer Removal" << eom;
1083
- remove_function_pointers (
1084
- symbol_table,
1085
- goto_functions,
1086
- cmdline.isset (" pointer-check" ));
1089
+ do_indirect_call_and_rtti_removal (/* force=*/ true );
1087
1090
1088
1091
if (cmdline.isset (" show-custom-bitvector-analysis" ) ||
1089
1092
cmdline.isset (" custom-bitvector-analysis" ))
@@ -1099,7 +1102,7 @@ void goto_instrument_parse_optionst::instrument_goto_program()
1099
1102
1100
1103
if (cmdline.isset (" constant-propagator" ))
1101
1104
{
1102
- do_function_pointer_removal ();
1105
+ do_indirect_call_and_rtti_removal ();
1103
1106
1104
1107
status () << " Propagating Constants" << eom;
1105
1108
@@ -1161,7 +1164,7 @@ void goto_instrument_parse_optionst::instrument_goto_program()
1161
1164
cmdline.isset (" isr" ) ||
1162
1165
cmdline.isset (" concurrency" ))
1163
1166
{
1164
- do_function_pointer_removal ();
1167
+ do_indirect_call_and_rtti_removal ();
1165
1168
do_partial_inlining ();
1166
1169
1167
1170
status () << " Pointer Analysis" << eom;
@@ -1400,7 +1403,7 @@ void goto_instrument_parse_optionst::instrument_goto_program()
1400
1403
// full slice?
1401
1404
if (cmdline.isset (" full-slice" ))
1402
1405
{
1403
- do_function_pointer_removal ();
1406
+ do_indirect_call_and_rtti_removal ();
1404
1407
1405
1408
status () << " Performing a full slice" << eom;
1406
1409
if (cmdline.isset (" property" ))
0 commit comments