@@ -681,7 +681,8 @@ void goto_instrument_parse_optionst::do_function_pointer_removal()
681681 function_pointer_removal_done=true ;
682682
683683 status () << " Function Pointer Removal" << eom;
684- remove_function_pointers (symbol_table, goto_functions, false );
684+ remove_function_pointers (
685+ symbol_table, goto_functions, cmdline.isset (" pointer-check" ));
685686}
686687
687688/* ******************************************************************\
@@ -834,13 +835,28 @@ void goto_instrument_parse_optionst::instrument_goto_program()
834835
835836 namespacet ns (symbol_table);
836837
838+ // now do full inlining, if requested
839+ if (cmdline.isset (" inline" ))
840+ {
841+ do_function_pointer_removal ();
842+
843+ if (cmdline.isset (" show-custom-bitvector-analysis" ) ||
844+ cmdline.isset (" custom-bitvector-analysis" ))
845+ {
846+ do_remove_returns ();
847+ thread_exit_instrumentation (goto_functions);
848+ mutex_init_instrumentation (symbol_table, goto_functions);
849+ }
850+
851+ status () << " Performing full inlining" << eom;
852+ goto_inline (goto_functions, ns, ui_message_handler);
853+ }
854+
837855 if (cmdline.isset (" show-custom-bitvector-analysis" ) ||
838856 cmdline.isset (" custom-bitvector-analysis" ))
839857 {
840- partial_inlining_done=true ;
841- status () << " Partial Inlining" << eom;
842- const namespacet ns (symbol_table);
843- goto_partial_inline (goto_functions, ns, ui_message_handler);
858+ do_partial_inlining ();
859+
844860 status () << " Propagating Constants" << eom;
845861 constant_propagator_ait constant_propagator_ai (goto_functions, ns);
846862 remove_skip (goto_functions);
@@ -853,8 +869,6 @@ void goto_instrument_parse_optionst::instrument_goto_program()
853869 do_remove_returns ();
854870 parameter_assignments (symbol_table, goto_functions);
855871
856- namespacet ns (symbol_table);
857-
858872 // recalculate numbers, etc.
859873 goto_functions.update ();
860874
@@ -877,31 +891,14 @@ void goto_instrument_parse_optionst::instrument_goto_program()
877891 code_contracts (symbol_table, goto_functions);
878892 }
879893
880- // now do full inlining, if requested
881- if (cmdline.isset (" inline" ))
882- {
883- status () << " Function Pointer Removal" << eom;
884- remove_function_pointers (
885- symbol_table, goto_functions, cmdline.isset (" pointer-check" ));
886-
887- if (cmdline.isset (" show-custom-bitvector-analysis" ) ||
888- cmdline.isset (" custom-bitvector-analysis" ))
889- {
890- do_remove_returns ();
891- thread_exit_instrumentation (goto_functions);
892- mutex_init_instrumentation (symbol_table, goto_functions);
893- }
894-
895- status () << " Performing full inlining" << eom;
896- goto_inline (goto_functions, ns, ui_message_handler);
897- }
894+ // replace function pointers, if explicitly requested
895+ if (cmdline.isset (" remove-function-pointers" ))
896+ do_function_pointer_removal ();
898897
899898 if (cmdline.isset (" constant-propagator" ))
900899 {
901900 do_function_pointer_removal ();
902901
903- namespacet ns (symbol_table);
904-
905902 status () << " Propagating Constants" << eom;
906903
907904 constant_propagator_ait constant_propagator_ai (goto_functions, ns);
@@ -950,16 +947,9 @@ void goto_instrument_parse_optionst::instrument_goto_program()
950947 cmdline.isset (" isr" ) ||
951948 cmdline.isset (" concurrency" ))
952949 {
953- if (!cmdline.isset (" inline" ))
954- {
955- status () << " Function Pointer Removal" << eom;
956- remove_function_pointers (symbol_table, goto_functions, cmdline.isset (" pointer-check" ));
957-
958- // do partial inlining
959- status () << " Partial Inlining" << eom;
960- goto_partial_inline (goto_functions, ns, ui_message_handler);
961- }
962-
950+ do_function_pointer_removal ();
951+ do_partial_inlining ();
952+
963953 status () << " Pointer Analysis" << eom;
964954 value_set_analysist value_set_analysis (ns);
965955 value_set_analysis (goto_functions);
@@ -1191,9 +1181,7 @@ void goto_instrument_parse_optionst::instrument_goto_program()
11911181 // full slice?
11921182 if (cmdline.isset (" full-slice" ))
11931183 {
1194- status () << " Function Pointer Removal" << eom;
1195- remove_function_pointers (
1196- symbol_table, goto_functions, cmdline.isset (" pointer-check" ));
1184+ do_function_pointer_removal ();
11971185
11981186 status () << " Performing a full slice" << eom;
11991187 if (cmdline.isset (" property" ))
@@ -1299,6 +1287,7 @@ void goto_instrument_parse_optionst::help()
12991287 " Further transformations:\n "
13001288 " --constant-propagator propagate constants and simplify expressions\n "
13011289 " --inline perform full inlining\n "
1290+ " --remove-function-pointers replace function pointers by case statement over function calls\n "
13021291 " --add-library add models of C library functions\n "
13031292 " \n "
13041293 " Other options:\n "
0 commit comments