ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
goto2c.h
Go to the documentation of this file.
1#ifndef CPROVER_GOTO2C_H
2#define CPROVER_GOTO2C_H
3
7
8class goto2ct
9{
10public:
11 goto2ct(namespacet &_ns, goto_functionst _goto_functions)
12 : ns(_ns), goto_functions(_goto_functions)
13 {
14 }
15
16 // Preprocessing methods
17 void preprocess();
19 void preprocess(std::string function_id, goto_functiont &goto_function);
20 void preprocess(goto_programt &goto_program);
22
23 // Checking methods
24 void check();
26 void check(std::string function_id, goto_functiont &goto_function);
27 void check(goto_programt &goto_program);
28 void check(goto_programt::instructiont &instruction);
29
30 // Translation methods
31 std::string translate();
33 std::string translate(std::string function_id, goto_functiont &goto_function);
34 std::string translate(goto_programt &goto_program);
35 std::string translate(goto_programt::instructiont &instruction);
36
37 // Access methods
42
44 {
45 return ns;
46 }
47
48protected:
51
52 std::list<symbolt> fun_decls;
53 std::list<typet> global_types;
54 std::list<symbolt> global_vars;
55 std::list<symbolt> extern_vars;
56 std::map<std::string, exprt> initializers;
57
58 std::map<std::string, std::list<typet>> local_types;
59 std::map<std::string, std::list<symbolt>> local_static_vars;
60
61private:
62 // Auxiliary methods
63 typet get_base_type(typet type, namespacet ns);
64
65 // Preprocessing methods
66 void extract_symbol_tables();
67 void extract_initializers_from_esbmc_main();
68 void simplify_initializers();
69 void sort_compound_types(namespacet &ns, std::list<typet> &types);
70 void sort_compound_types_rec(
72 std::list<typet> &sorted_types,
73 std::set<typet> &observed_types,
74 typet &type);
75 void assign_scope_ids(goto_programt &goto_program);
76 void remove_unsupported_instructions(goto_programt &goto_program);
77 expr2tc replace_array_assignment_with_memcpy(const code_assign2t &assign);
78 void adjust_invalid_assignments(goto_programt &goto_program);
79 void adjust_invalid_assignment_rec(
80 goto_programt::instructionst &new_instructions,
82 namespacet &ns);
83
84 // Checking methods for each individual instruction type
85 void check_assert(goto_programt::instructiont instruction);
86 void check_assume(goto_programt::instructiont instruction);
87 void check_goto(goto_programt::instructiont instruction);
88 void check_function_call(goto_programt::instructiont instruction);
89 void check_return(goto_programt::instructiont instruction);
90 void check_end_function(goto_programt::instructiont instruction);
91 void check_decl(goto_programt::instructiont instruction);
92 void check_dead(goto_programt::instructiont instruction);
93 void check_assign(goto_programt::instructiont instruction);
94 void check_location(goto_programt::instructiont instruction);
95 void check_skip(goto_programt::instructiont instruction);
96 void check_throw(goto_programt::instructiont instruction);
97 void check_catch(goto_programt::instructiont instruction);
98 void check_atomic_begin(goto_programt::instructiont instruction);
99 void check_atomic_end(goto_programt::instructiont instruction);
100 void check_other(goto_programt::instructiont instruction);
101
102 // Methods for checking expressions
103 void check_guard(const expr2tc &guard);
104};
105
106#endif
Definition irep2_expr.h:2007
void preprocess()
Definition goto2c_preprocess.cpp:8
std::map< std::string, std::list< typet > > local_types
Definition goto2c.h:58
std::list< symbolt > global_vars
Definition goto2c.h:54
goto_functionst get_goto_functions()
Definition goto2c.h:38
goto_functionst goto_functions
Definition goto2c.h:50
void check(goto_functionst &goto_functions)
void preprocess(goto_programt::instructiont &instruction)
std::list< symbolt > fun_decls
Definition goto2c.h:52
namespacet get_namespace()
Definition goto2c.h:43
namespacet & ns
Definition goto2c.h:49
std::map< std::string, exprt > initializers
Definition goto2c.h:56
goto2ct(namespacet &_ns, goto_functionst _goto_functions)
Definition goto2c.h:11
std::map< std::string, std::list< symbolt > > local_static_vars
Definition goto2c.h:59
std::string translate()
Definition goto2c_translate.cpp:8
std::list< typet > global_types
Definition goto2c.h:53
void check()
Definition goto2c_check.cpp:3
std::list< symbolt > extern_vars
Definition goto2c.h:55
Definition goto_functions.h:56
Definition goto_functions.h:23
Container for an instruction of the goto-program.
Definition goto_program.h:95
A generic container class for a control flow graph for one function, in the form of a goto-program.
Definition goto_program.h:63
std::list< class instructiont > instructionst
Definition goto_program.h:588
Definition namespace.h:10
Definition type.h:9
irep_container< expr2t > expr2tc
Definition irep2.h:431