ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
goto_convert_functions.h
Go to the documentation of this file.
1#ifndef CPROVER_GOTO_CONVERT_FUNCTIONS_H
2#define CPROVER_GOTO_CONVERT_FUNCTIONS_H
3
6
7// just convert it all
8void goto_convert(
9 contextt &context,
10 optionst &options,
11 goto_functionst &functions);
12
14{
15public:
16 typedef std::map<irep_idt, std::set<irep_idt>> typename_mapt;
17 typedef std::set<irep_idt> typename_sett;
18
19 void goto_convert();
20 void convert_function(symbolt &symbol);
22 void collect_type(const irept &type, typename_sett &set);
23 void collect_expr(const irept &expr, typename_sett &set);
24 void
25 rename_types(irept &type, const symbolt &cur_name_sym, const irep_idt &sname);
26 void
27 rename_exprs(irept &expr, const symbolt &cur_name_sym, const irep_idt &sname);
28
29 // Const probes mirroring rename_types/rename_exprs: return true iff the
30 // subtree actually contains a `symbol` type that rename_types would
31 // replace. rename_*() only mutate at those points, but the mutable
32 // Forall_* traversal detaches (deep-copies, under COW) every node it
33 // walks regardless. Gating the mutable descent on these read-only
34 // checks avoids detaching the overwhelming majority of nodes that
35 // have nothing to rename.
36 bool type_needs_rename(const irept &type, const irep_idt &sname) const;
37 bool expr_needs_rename(const irept &expr, const irep_idt &sname) const;
38 void
39 wallop_type(irep_idt name, typename_mapt &typenames, const irep_idt &sname);
40
42 contextt &_context,
43 optionst &_options,
44 goto_functionst &_functions);
45
46protected:
48
49 static bool hide(const goto_programt &goto_program);
50
51 //
52 // function calls
53 //
54 void add_return(
56 const irep_idt &identifier,
57 const locationt &location);
58
59 // W1-loc spike Phase C (esbmc/esbmc#4715): consume the IREP2 body `body2`
60 // natively, emitting `dest` without the whole-body legacy round-trip and
61 // inheriting each `code_*2t::location` onto its value operands at
62 // consumption (design D3; Phase B proved this reproduces the round-trip's
63 // locations byte-identically). Returns true iff every statement kind in
64 // `body2` is supported by the native dispatcher; returns false — leaving
65 // `dest` untouched — the moment it meets an unsupported kind, so the caller
66 // falls back to `goto_convert_rec` and the native path stays byte-identical
67 // to the round-trip. Default on; --no-irep2-native-body forces the fallback.
68 bool try_convert_body_native(const expr2tc &body2, goto_programt &dest);
69
70 // Consume one IREP2 statement `code2` natively, appending to `dest`. Returns
71 // false the instant an unsupported kind (or a shape the native emission would
72 // not reproduce byte-identically) appears, so the caller discards the partial
73 // walk and falls back to `goto_convert_rec`. A member so it can reuse the
74 // inherited goto_convertt machinery (has_sideeffect / is_atomic_symbol /
75 // has_atomic_read / ns) to gate the value-statement kinds.
77 const expr2tc &code2,
78 goto_programt &dest,
79 const locationt &inherited);
80 // convert_native_rec, then convert_full_expression's unwind for an
81 // expression statement.
83 const expr2tc &code2,
84 goto_programt &dest,
85 const locationt &inherited);
86
88 irep_idt name,
89 typename_mapt &typenames,
90 const irep_idt &sname,
91 std::set<irep_idt> &in_progress);
92};
93
94#endif
Definition context.h:57
std::set< irep_idt > typename_sett
Definition goto_convert_functions.h:17
void thrash_type_symbols()
Definition goto_convert_functions.cpp:2296
bool try_convert_body_native(const expr2tc &body2, goto_programt &dest)
Definition goto_convert_functions.cpp:1816
bool convert_native_full_expression(const expr2tc &code2, goto_programt &dest, const locationt &inherited)
Definition goto_convert_functions.cpp:519
void collect_expr(const irept &expr, typename_sett &set)
Definition goto_convert_functions.cpp:2034
void rename_types(irept &type, const symbolt &cur_name_sym, const irep_idt &sname)
Definition goto_convert_functions.cpp:2112
void add_return(goto_functiont &f, const irep_idt &identifier, const locationt &location)
Definition goto_convert_functions.cpp:57
goto_functionst & functions
Definition goto_convert_functions.h:47
std::map< irep_idt, std::set< irep_idt > > typename_mapt
Definition goto_convert_functions.h:16
bool convert_native_rec(const expr2tc &code2, goto_programt &dest, const locationt &inherited)
Definition goto_convert_functions.cpp:533
void goto_convert()
Definition goto_convert_functions.cpp:24
void wallop_type(irep_idt name, typename_mapt &typenames, const irep_idt &sname)
Definition goto_convert_functions.cpp:2233
void rename_exprs(irept &expr, const symbolt &cur_name_sym, const irep_idt &sname)
Definition goto_convert_functions.cpp:2194
void convert_function(symbolt &symbol)
Definition goto_convert_functions.cpp:1837
static bool hide(const goto_programt &goto_program)
Definition goto_convert_functions.cpp:43
bool type_needs_rename(const irept &type, const irep_idt &sname) const
Definition goto_convert_functions.cpp:2067
bool expr_needs_rename(const irept &expr, const irep_idt &sname) const
Definition goto_convert_functions.cpp:2083
goto_convert_functionst(contextt &_context, optionst &_options, goto_functionst &_functions)
Definition goto_convert_functions.cpp:16
void collect_type(const irept &type, typename_sett &set)
Definition goto_convert_functions.cpp:2012
void wallop_type_impl(irep_idt name, typename_mapt &typenames, const irep_idt &sname, std::set< irep_idt > &in_progress)
Definition goto_convert_functions.cpp:2243
goto_convertt(contextt &_context, optionst &_options)
Definition goto_convert_class.h:30
Definition goto_functions.h:56
Definition goto_functions.h:23
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
Definition irep.h:36
Definition location.h:7
Definition options.h:11
Definition symbol.h:12
void goto_convert(contextt &context, optionst &options, goto_functionst &functions)
Definition goto_convert_functions.cpp:2001
irep_container< expr2t > expr2tc
Definition irep2.h:431
@ identifier
Definition nested_func_transform.cpp:62