ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
goto_functions.h
Go to the documentation of this file.
1#ifndef CPROVER_GOTO_FUNCTIONS_H
2#define CPROVER_GOTO_FUNCTIONS_H
3
4#define Forall_goto_functions(it, functions) \
5 for (goto_functionst::function_mapt::iterator it = \
6 (functions).function_map.begin(); \
7 it != (functions).function_map.end(); \
8 it++)
9
10#define forall_goto_functions(it, functions) \
11 for (goto_functionst::function_mapt::const_iterator it = \
12 (functions).function_map.begin(); \
13 it != (functions).function_map.end(); \
14 it++)
15
18#include <util/irep/std_types.h>
19#include <util/config/options.h>
21
23{
24public:
26 // The function signature (a code_type2t). Unlike the legacy code_typet this
27 // replaced, a default-constructed type2tc is nil rather than an empty code
28 // type, so it must be assigned (migrate_type(symbol.type)) before any read:
29 // to_code_type() dereferences it. All construction paths set it before use.
31 bool body_available = false;
32
33 // Cached, decoded copy of the function's C++ exception specification. The
34 // canonical representation lives on the function symbol's typet (and so
35 // survives GOTO-binary serialization); this is derived from it whenever the
36 // function type is (re)built. Used by symex to enforce the specification at
37 // the function-frame boundary.
39
40 // The set of functions that have been inlined into this one. Necessary to
41 // make symex renaming work.
42 std::set<std::string> inlined_funcs;
43
48 void
49 update_instructions_function(const irep_idt &function_id, bool force = false)
50 {
51 body.update_instructions_function(function_id, force);
52 }
53};
54
56{
57public:
66 {
67 bool operator()(const irep_idt &a, const irep_idt &b) const
68 {
69 return a.as_string() < b.as_string();
70 }
71 };
72
73 typedef std::map<irep_idt, goto_functiont, id_string_order> function_mapt;
75
76 // For coverage and multi-property
77 // Store and pass the coverage data in incr/kind mode
78 static std::unordered_set<std::string> reached_claims;
79 static std::unordered_multiset<std::string> reached_mul_claims;
80
81 static std::mutex reached_claims_mutex;
82 static std::mutex reached_mul_claims_mutex;
83
84 // One verdict per property for the current run, shared between symbolic
85 // execution (which discharges trivially true claims) and bmct (which solves
86 // the rest). Static for the same reason reached_claims is: goto_symext holds
87 // goto_functionst by const reference. Cleared at the start of each run.
89
90 // Serialises clear_verified_claims_in_goto across parallel multi-property
91 // claims, which may concurrently make_skip() the same assert instruction.
92 // One shared lock replaces what used to be a per-instruction std::mutex
93 // (40 bytes on every GOTO instruction in the program).
94 static std::mutex clear_claims_mutex;
95
96 void clear()
97 {
98 function_map.clear();
99 }
100
101 void output(const namespacet &ns, std::ostream &out) const;
102 void dump() const;
103
107
114
116 {
117 return "__ESBMC_main";
118 }
119
121 {
122 function_map.swap(other.function_map);
123 }
124};
125
126void get_local_identifiers(const goto_functiont &, std::set<irep_idt> &dest);
127
128bool spawns_threads(const goto_functionst &goto_functions);
129
130#endif
Canonical, function-boundary C++ exception specification.
Definition exception_specification.h:25
Definition goto_functions.h:56
std::map< irep_idt, goto_functiont, id_string_order > function_mapt
Definition goto_functions.h:73
void swap(goto_functionst &other)
Definition goto_functions.h:120
void compute_loop_numbers()
Definition goto_function.cpp:232
void dump() const
Definition goto_function.cpp:193
static std::mutex reached_mul_claims_mutex
Definition goto_functions.h:82
static std::mutex reached_claims_mutex
Definition goto_functions.h:81
function_mapt function_map
Definition goto_functions.h:74
void compute_location_numbers()
Definition goto_function.cpp:219
void output(const namespacet &ns, std::ostream &out) const
Definition goto_function.cpp:200
static property_verdict_tablet property_verdicts
Definition goto_functions.h:88
static std::unordered_multiset< std::string > reached_mul_claims
Definition goto_functions.h:79
void update()
Definition goto_functions.h:108
void clear()
Definition goto_functions.h:96
irep_idt main_id() const
Definition goto_functions.h:115
static std::mutex clear_claims_mutex
Definition goto_functions.h:94
static std::unordered_set< std::string > reached_claims
Definition goto_functions.h:78
void compute_target_numbers()
Definition goto_function.cpp:226
Definition goto_functions.h:23
goto_programt body
Definition goto_functions.h:25
std::set< std::string > inlined_funcs
Definition goto_functions.h:42
void update_instructions_function(const irep_idt &function_id, bool force=false)
update the function member in each instruction
Definition goto_functions.h:49
bool body_available
Definition goto_functions.h:31
exception_specificationt exception_spec
Definition goto_functions.h:38
type2tc type
Definition goto_functions.h:30
A generic container class for a control flow graph for one function, in the form of a goto-program.
Definition goto_program.h:63
Definition irep_idt.h:12
const std::string & as_string() const
Definition irep_idt.h:138
Definition namespace.h:10
One verdict per property for a whole verification run.
Definition property_verdict.h:84
@ other
Definition converter_compare.cpp:887
bool spawns_threads(const goto_functionst &goto_functions)
Whether the program can create a thread.
Definition goto_function.cpp:285
void get_local_identifiers(const goto_functiont &, std::set< irep_idt > &dest)
Definition goto_function.cpp:239
irep_container< type2t > type2tc
Definition irep2.h:430
Order function_map by the id's string content, not by irep_idt's default operator< (which compares th...
Definition goto_functions.h:66
bool operator()(const irep_idt &a, const irep_idt &b) const
Definition goto_functions.h:67