CBMC
process_goto_program.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Process a Goto Program
4 
5 Author: Martin Brain, martin.brain@cs.ox.ac.uk
6 
7 \*******************************************************************/
8 
11 
12 #include "process_goto_program.h"
13 
14 #include <util/message.h>
15 #include <util/options.h>
16 
21 #include <goto-programs/mm_io.h>
29 
30 #include <ansi-c/goto_check_c.h>
31 
32 #include "goto_check.h"
33 
35  goto_modelt &goto_model,
36  const optionst &options,
37  messaget &log)
38 {
39  if(options.get_bool_option("string-abstraction"))
40  string_instrumentation(goto_model);
41 
42  // remove function pointers
43  log.status() << "Removal of function pointers and virtual functions"
44  << messaget::eom;
45  remove_function_pointers(log.get_message_handler(), goto_model, false);
46 
47  mm_io(goto_model);
48 
49  // instrument library preconditions
50  instrument_preconditions(goto_model);
51 
52  // do partial inlining
53  if(options.get_bool_option("partial-inline"))
54  {
55  log.status() << "Partial Inlining" << messaget::eom;
56  goto_partial_inline(goto_model, log.get_message_handler());
57  }
58 
59  // remove returns, gcc vectors, complex
60  if(
61  options.get_bool_option("remove-returns") ||
62  options.get_bool_option("string-abstraction"))
63  {
64  remove_returns(goto_model);
65  }
66 
67  remove_vector(goto_model);
68  remove_complex(goto_model);
69 
70  if(options.get_bool_option("rewrite-union"))
71  rewrite_union(goto_model);
72 
73  // add generic checks
74  log.status() << "Generic Property Instrumentation" << messaget::eom;
75  goto_check_c(options, goto_model, log.get_message_handler());
76  transform_assertions_assumptions(options, goto_model);
77 
78  // checks don't know about adjusted float expressions
79  adjust_float_expressions(goto_model);
80 
81  if(options.get_bool_option("string-abstraction"))
82  {
83  log.status() << "String Abstraction" << messaget::eom;
84  string_abstraction(goto_model, log.get_message_handler());
85  }
86 
87  // recalculate numbers, etc.
88  goto_model.goto_functions.update();
89 
90  return false;
91 }
messaget
Class that provides messages with a built-in verbosity 'level'.
Definition: message.h:154
mm_io
void mm_io(const exprt &mm_io_r, const exprt &mm_io_r_value, const exprt &mm_io_w, goto_functionst::goto_functiont &goto_function, const namespacet &ns)
Definition: mm_io.cpp:37
string_abstraction.h
rewrite_union.h
goto_inline.h
optionst
Definition: options.h:22
messaget::status
mstreamt & status() const
Definition: message.h:414
goto_partial_inline
void goto_partial_inline(goto_modelt &goto_model, message_handlert &message_handler, unsigned smallfunc_limit, bool adjust_function)
Inline all function calls to functions either marked as "inlined" or smaller than smallfunc_limit (by...
Definition: goto_inline.cpp:122
instrument_preconditions.h
goto_check_c.h
goto_model.h
goto_modelt
Definition: goto_model.h:25
options.h
messaget::eom
static eomt eom
Definition: message.h:297
string_instrumentation.h
goto_check_c
void goto_check_c(const irep_idt &function_identifier, goto_functionst::goto_functiont &goto_function, const namespacet &ns, const optionst &options, message_handlert &message_handler)
Definition: goto_check_c.cpp:2397
remove_vector
static void remove_vector(typet &)
removes vector data type
Definition: remove_vector.cpp:293
remove_complex.h
mm_io.h
string_instrumentation
void string_instrumentation(symbol_tablet &symbol_table, goto_programt &dest)
Definition: string_instrumentation.cpp:162
instrument_preconditions
void instrument_preconditions(const goto_modelt &goto_model, goto_programt &goto_program)
Definition: instrument_preconditions.cpp:99
remove_function_pointers
void remove_function_pointers(message_handlert &_message_handler, goto_modelt &goto_model, bool only_remove_const_fps)
Definition: remove_function_pointers.cpp:533
rewrite_union
void rewrite_union(exprt &expr)
We rewrite u.c for unions u into byte_extract(u, 0), and { .c = v } into byte_update(NIL,...
Definition: rewrite_union.cpp:65
transform_assertions_assumptions
static void transform_assertions_assumptions(goto_programt &goto_program, bool enable_assertions, bool enable_built_in_assertions, bool enable_assumptions)
Definition: goto_check.cpp:19
goto_check.h
process_goto_program
bool process_goto_program(goto_modelt &goto_model, const optionst &options, messaget &log)
Common processing and simplification of goto_programts.
Definition: process_goto_program.cpp:34
remove_vector.h
remove_complex
static void remove_complex(typet &)
removes complex data type
Definition: remove_complex.cpp:230
remove_returns.h
messaget::get_message_handler
message_handlert & get_message_handler()
Definition: message.h:184
goto_modelt::goto_functions
goto_functionst goto_functions
GOTO functions.
Definition: goto_model.h:33
optionst::get_bool_option
bool get_bool_option(const std::string &option) const
Definition: options.cpp:44
remove_returns
void remove_returns(symbol_table_baset &symbol_table, goto_functionst &goto_functions)
removes returns
Definition: remove_returns.cpp:255
goto_functionst::update
void update()
Definition: goto_functions.h:83
adjust_float_expressions
void adjust_float_expressions(exprt &expr, const exprt &rounding_mode)
Replaces arithmetic operations and typecasts involving floating point numbers with their equivalent f...
Definition: adjust_float_expressions.cpp:85
string_abstraction
void string_abstraction(goto_modelt &goto_model, message_handlert &message_handler)
Definition: string_abstraction.cpp:72
message.h
adjust_float_expressions.h
remove_function_pointers.h
process_goto_program.h