Skip to content

Commit b316da9

Browse files
author
martin
committed
Add partial inlining as an optional part of process_goto_program
In CBMC and goto-diff this is dead, in goto-analyze it preserves the existing behaviour. It is not 100% clear to me that the existing behaviour is useful or desirable but it is preserved as the point of this PR is not changing behaviour unless necessary.
1 parent 3ff3d8f commit b316da9

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

src/cbmc/cbmc_parse_options.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Author: Daniel Kroening, [email protected]
5050

5151
#include <goto-programs/add_malloc_may_fail_variable_initializations.h>
5252
#include <goto-programs/adjust_float_expressions.h>
53+
#include <goto-programs/goto_inline.h>
5354
#include <goto-programs/initialize_goto_model.h>
5455
#include <goto-programs/instrument_preconditions.h>
5556
#include <goto-programs/link_to_library.h>
@@ -946,6 +947,13 @@ bool cbmc_parse_optionst::process_goto_program(
946947
// instrument library preconditions
947948
instrument_preconditions(goto_model);
948949

950+
// do partial inlining
951+
if(options.get_bool_option("partial-inline"))
952+
{
953+
log.status() << "Partial Inlining" << messaget::eom;
954+
goto_partial_inline(goto_model, log.get_message_handler());
955+
}
956+
949957
// remove returns, gcc vectors, complex
950958
remove_returns(goto_model);
951959
remove_vector(goto_model);

src/goto-analyzer/goto_analyzer_parse_options.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,9 @@ int goto_analyzer_parse_optionst::doit()
608608

609609
goto_model = initialize_goto_model(cmdline.args, ui_message_handler, options);
610610

611+
// Perserve backwards compatability in processing
612+
options.set_option("partial-inline", true);
613+
611614
if(process_goto_program(options))
612615
return CPROVER_EXIT_INTERNAL_ERROR;
613616

@@ -906,8 +909,11 @@ bool goto_analyzer_parse_optionst::process_goto_program(
906909
instrument_preconditions(goto_model);
907910

908911
// do partial inlining
909-
log.status() << "Partial Inlining" << messaget::eom;
910-
goto_partial_inline(goto_model, ui_message_handler);
912+
if(options.get_bool_option("partial-inline"))
913+
{
914+
log.status() << "Partial Inlining" << messaget::eom;
915+
goto_partial_inline(goto_model, ui_message_handler);
916+
}
911917

912918
// remove returns, gcc vectors, complex
913919
remove_returns(goto_model);

src/goto-diff/goto_diff_parse_options.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,13 @@ bool goto_diff_parse_optionst::process_goto_program(
302302
// instrument library preconditions
303303
instrument_preconditions(goto_model);
304304

305+
// do partial inlining
306+
if(options.get_bool_option("partial-inline"))
307+
{
308+
log.status() << "Partial Inlining" << messaget::eom;
309+
goto_partial_inline(goto_model, ui_message_handler);
310+
}
311+
305312
// remove returns, gcc vectors, complex
306313
remove_returns(goto_model);
307314
remove_vector(goto_model);

0 commit comments

Comments
 (0)