CBMC
Loading...
Searching...
No Matches
goto_convert_class.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Program Transformation
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
11
12#ifndef CPROVER_GOTO_PROGRAMS_GOTO_CONVERT_CLASS_H
13#define CPROVER_GOTO_PROGRAMS_GOTO_CONVERT_CLASS_H
14
15#include <util/message.h>
16#include <util/namespace.h>
17#include <util/replace_expr.h>
18#include <util/std_code.h>
19
21
23
24#include "scope_tree.h"
25
26#include <list>
27#include <unordered_set>
28#include <vector>
29
32
33class goto_convertt : public messaget
34{
35public:
36 void
37 goto_convert(const codet &code, goto_programt &dest, const irep_idt &mode);
38
48
50 {
51 }
52
53 void set_prefix(const std::string &prefix)
54 {
55 tmp_symbol_prefix = prefix;
56 }
57
58protected:
61 std::string tmp_symbol_prefix;
63
65 {
69 std::list<irep_idt> temporaries;
75
76 clean_expr_resultt() = default;
77
78 void add(clean_expr_resultt &&other)
79 {
80 temporaries.splice(temporaries.begin(), other.temporaries);
81 side_effects.destructive_append(other.side_effects);
82 }
83
84 void add_temporary(const irep_idt &id)
85 {
86 temporaries.push_front(id);
87 }
88 };
89
91 const codet &code,
92 goto_programt &dest,
93 const irep_idt &mode);
94
95 //
96 // tools for symbols
97 //
99 const typet &type,
100 const std::string &suffix,
101 goto_programt &dest,
102 const source_locationt &,
103 const irep_idt &mode);
104
106 const exprt &expr,
107 goto_programt &dest,
108 const irep_idt &mode);
109
110 //
111 // translation of C expressions (with side effects)
112 // into the program logic
113 //
114
115 [[nodiscard]] clean_expr_resultt
116 clean_expr(exprt &expr, const irep_idt &mode, bool result_is_used = true);
117
118 [[nodiscard]] clean_expr_resultt
119 clean_expr_address_of(exprt &expr, const irep_idt &mode);
120
121 static bool needs_cleaning(const exprt &expr);
122
123 // Do we need to introduce a temporary for the value of an assignment
124 // to the given lhs? E.g., a[i] needs a temporary as its value may change
125 // when i is changed; likewise, *p needs a temporary as its value may change
126 // when p is changed.
127 static bool assignment_lhs_needs_temporary(const exprt &lhs)
128 {
129 return lhs.id() != ID_symbol;
130 }
131
133 exprt &expr,
134 const std::string &suffix,
136 const irep_idt &mode);
137
138 void rewrite_boolean(exprt &dest);
139
143 [[nodiscard]] clean_expr_resultt clean_function_call_operands(
144 exprt &function,
145 exprt::operandst &arguments,
146 const irep_idt &mode);
147
148 [[nodiscard]] clean_expr_resultt remove_side_effect(
149 side_effect_exprt &expr,
150 const irep_idt &mode,
151 bool result_is_used,
152 bool address_taken);
153 [[nodiscard]] clean_expr_resultt remove_assignment(
154 side_effect_exprt &expr,
155 bool result_is_used,
156 bool address_taken,
157 const irep_idt &mode);
158 [[nodiscard]] clean_expr_resultt remove_pre(
159 side_effect_exprt &expr,
160 bool result_is_used,
161 bool address_taken,
162 const irep_idt &mode);
163 [[nodiscard]] clean_expr_resultt remove_post(
164 side_effect_exprt &expr,
165 const irep_idt &mode,
166 bool result_is_used);
167 [[nodiscard]] clean_expr_resultt remove_function_call(
169 const irep_idt &mode,
170 bool result_is_used);
171 [[nodiscard]] clean_expr_resultt
173 [[nodiscard]] clean_expr_resultt remove_cpp_delete(side_effect_exprt &expr);
174 [[nodiscard]] clean_expr_resultt remove_malloc(
175 side_effect_exprt &expr,
176 const irep_idt &mode,
177 bool result_is_used);
178 [[nodiscard]] clean_expr_resultt
180 [[nodiscard]] clean_expr_resultt remove_statement_expression(
181 side_effect_exprt &expr,
182 const irep_idt &mode,
183 bool result_is_used);
184 [[nodiscard]] clean_expr_resultt
186 [[nodiscard]] clean_expr_resultt remove_overflow(
188 bool result_is_used,
189 const irep_idt &mode);
190
191 virtual void do_cpp_new(
192 const exprt &lhs,
193 const side_effect_exprt &rhs,
194 goto_programt &dest);
195
197 const exprt &lhs,
198 const side_effect_exprt &rhs,
199 goto_programt &dest);
200
202 const exprt &lhs,
203 const side_effect_exprt &rhs,
204 goto_programt &dest);
205
206 static void replace_new_object(const exprt &object, exprt &dest);
207
209 const exprt &lhs,
210 const side_effect_exprt &rhs,
211 goto_programt &dest);
212
213 //
214 // function calls
215 //
216
217 virtual void do_function_call(
218 const exprt &lhs,
219 const exprt &function,
220 const exprt::operandst &arguments,
221 goto_programt &dest,
222 const irep_idt &mode);
223
224 virtual void do_function_call_if(
225 const exprt &lhs,
226 const if_exprt &function,
227 const exprt::operandst &arguments,
228 goto_programt &dest,
229 const irep_idt &mode);
230
231 virtual void do_function_call_symbol(
232 const exprt &lhs,
233 const symbol_exprt &function,
234 const exprt::operandst &arguments,
235 goto_programt &dest,
236 const irep_idt &mode);
237
238 virtual void do_function_call_symbol(const symbolt &)
239 {
240 }
241
242 virtual void do_function_call_other(
243 const exprt &lhs,
244 const exprt &function,
245 const exprt::operandst &arguments,
246 goto_programt &dest);
247
248 //
249 // conversion
250 //
251 void convert_block(
252 const code_blockt &code,
253 goto_programt &dest,
254 const irep_idt &mode);
256 const code_frontend_declt &,
258 const irep_idt &mode);
259 void convert_decl_type(const codet &code, goto_programt &dest);
261 const code_expressiont &code,
262 goto_programt &dest,
263 const irep_idt &mode);
264 void convert_assign(
265 const code_assignt &code,
266 goto_programt &dest,
267 const irep_idt &mode);
268 void convert_cpp_delete(const codet &code, goto_programt &dest);
270 void
271 convert_for(const code_fort &code, goto_programt &dest, const irep_idt &mode);
272 void convert_while(
273 const code_whilet &code,
274 goto_programt &dest,
275 const irep_idt &mode);
276 void convert_dowhile(
277 const code_dowhilet &code,
278 goto_programt &dest,
279 const irep_idt &mode);
280 void convert_assume(
281 const code_assumet &code,
282 goto_programt &dest,
283 const irep_idt &mode);
284 void convert_assert(
285 const code_assertt &code,
286 goto_programt &dest,
287 const irep_idt &mode);
288 void convert_switch(
289 const code_switcht &code,
290 goto_programt &dest,
291 const irep_idt &mode);
292 void convert_break(
293 const code_breakt &code,
294 goto_programt &dest,
295 const irep_idt &mode);
296 void convert_return(
297 const code_frontend_returnt &,
298 goto_programt &dest,
299 const irep_idt &mode);
300 void convert_continue(
301 const code_continuet &code,
302 goto_programt &dest,
303 const irep_idt &mode);
305 const code_ifthenelset &code,
306 goto_programt &dest,
307 const irep_idt &mode);
308 void convert_goto(const code_gotot &code, goto_programt &dest);
309 void convert_gcc_computed_goto(const codet &code, goto_programt &dest);
310 void convert_skip(const codet &code, goto_programt &dest);
311 void convert_label(
312 const code_labelt &code,
313 goto_programt &dest,
314 const irep_idt &mode);
315 void convert_gcc_local_label(const codet &code, goto_programt &dest);
317 const code_switch_caset &code,
318 goto_programt &dest,
319 const irep_idt &mode);
322 goto_programt &dest,
323 const irep_idt &mode);
325 const code_function_callt &code,
326 goto_programt &dest,
327 const irep_idt &mode);
328 void convert_start_thread(const codet &code, goto_programt &dest);
329 void convert_end_thread(const codet &code, goto_programt &dest);
330 void convert_atomic_begin(const codet &code, goto_programt &dest);
331 void convert_atomic_end(const codet &code, goto_programt &dest);
333 const codet &code,
334 goto_programt &dest,
335 const irep_idt &mode);
337 const codet &code,
338 goto_programt &dest,
339 const irep_idt &mode);
341 const codet &code,
342 goto_programt &dest,
343 const irep_idt &mode);
345 const codet &code,
346 goto_programt &dest,
347 const irep_idt &mode);
349 const codet &code,
350 goto_programt &dest,
351 const irep_idt &mode);
353 const codet &code,
354 goto_programt &dest,
355 const irep_idt &mode);
357 const codet &code,
358 goto_programt &dest,
359 const irep_idt &mode);
360 void convert_asm(const code_asmt &code, goto_programt &dest);
361
362 void convert(const codet &code, goto_programt &dest, const irep_idt &mode);
363
364 void copy(
365 const codet &code,
367 goto_programt &dest);
368
369 //
370 // exceptions
371 //
372
374
376 const source_locationt &source_location,
377 goto_programt &dest,
378 const irep_idt &mode,
379 std::optional<node_indext> destructor_end_point = {},
380 std::optional<node_indext> destructor_start_point = {});
381
382 typedef std::list<
383 std::pair<goto_programt::targett, goto_programt::instructiont>>
386 goto_programt &dest,
387 std::unordered_map<irep_idt, symbolt, irep_id_hash> &label_flags,
388 const build_declaration_hops_inputst &inputs);
389
390 //
391 // gotos
392 //
393
394 void finish_gotos(goto_programt &dest, const irep_idt &mode);
397
398 typedef std::map<irep_idt, std::pair<goto_programt::targett, node_indext>>
400 typedef std::list<std::pair<goto_programt::targett, node_indext>> gotost;
401 typedef std::list<goto_programt::targett> computed_gotost;
403 typedef std::list<std::pair<goto_programt::targett, caset>> casest;
404 typedef std::map<
406 casest::iterator,
409
410 struct targetst
411 {
414
417
422
425
428
431
446
453
460
466
472
479
487
489 {
490 // for 'while', 'for', 'dowhile'
491
493 {
494 break_set = targets.break_set;
495 continue_set = targets.continue_set;
496 break_target = targets.break_target;
497 continue_target = targets.continue_target;
498 }
499
501 {
502 targets.break_set = break_set;
503 targets.continue_set = continue_set;
504 targets.break_target = break_target;
505 targets.continue_target = continue_target;
506 }
507
511 };
512
514 {
515 // for 'switch'
516
518 {
519 break_set = targets.break_set;
520 default_set = targets.default_set;
521 break_target = targets.break_target;
522 default_target = targets.default_target;
523 break_stack_node = targets.scope_stack.get_current_node();
524 cases = targets.cases;
525 cases_map = targets.cases_map;
526 }
527
529 {
530 targets.break_set = break_set;
531 targets.default_set = default_set;
532 targets.break_target = break_target;
533 targets.default_target = default_target;
534 targets.cases = cases;
535 targets.cases_map = cases_map;
536 }
537
542
545 };
546
548 {
549 // for 'try...catch' and the like
550
552 {
553 throw_set = targets.throw_set;
554 throw_target = targets.throw_target;
555 throw_stack_node = targets.scope_stack.get_current_node();
556 }
557
559 {
560 targets.throw_set = throw_set;
561 targets.throw_target = throw_target;
562 }
563
567 };
568
570 {
571 // for 'try...leave...finally'
572
574 {
575 leave_set = targets.leave_set;
576 leave_target = targets.leave_target;
577 leave_stack_node = targets.scope_stack.get_current_node();
578 }
579
581 {
582 targets.leave_set = leave_set;
583 targets.leave_target = leave_target;
584 }
585
589 };
590
591 exprt case_guard(const exprt &value, const caset &case_op);
592
593 // if(cond) { true_case } else { false_case }
595 const exprt &cond,
596 const source_locationt &,
597 goto_programt &true_case,
598 const source_locationt &,
599 goto_programt &false_case,
600 const source_locationt &,
601 goto_programt &dest,
602 const irep_idt &mode);
603
604 // if(guard) goto target_true; else goto target_false;
606 const exprt &guard,
609 const source_locationt &,
610 goto_programt &dest,
611 const irep_idt &mode);
612
613 // if(guard) goto target;
615 const exprt &guard,
617 const source_locationt &,
618 goto_programt &dest,
619 const irep_idt &mode);
620
621 // turn a OP b OP c into a list a, b, c
622 static void collect_operands(
623 const exprt &expr,
624 const irep_idt &id,
625 std::list<exprt> &dest);
626
627 // START_THREAD; ... END_THREAD;
630 goto_programt &dest,
631 const irep_idt &mode);
632
633 //
634 // misc
635 //
637 bool get_string_constant(const exprt &expr, irep_idt &);
638 exprt get_constant(const exprt &expr);
639
640 // some built-in functions
641 void do_atomic_begin(
642 const exprt &lhs,
643 const symbol_exprt &function,
644 const exprt::operandst &arguments,
645 goto_programt &dest);
646 void do_atomic_end(
647 const exprt &lhs,
648 const symbol_exprt &function,
649 const exprt::operandst &arguments,
650 goto_programt &dest);
652 const exprt &lhs,
653 const symbol_exprt &function,
654 const exprt::operandst &arguments,
655 goto_programt &dest);
657 const exprt &lhs,
658 const symbol_exprt &rhs,
659 const exprt::operandst &arguments,
660 goto_programt &dest);
661 void do_array_op(
662 const irep_idt &id,
663 const exprt &lhs,
664 const symbol_exprt &function,
665 const exprt::operandst &arguments,
666 goto_programt &dest);
667 void do_printf(
668 const exprt &lhs,
669 const symbol_exprt &function,
670 const exprt::operandst &arguments,
671 goto_programt &dest);
672 void do_scanf(
673 const exprt &lhs,
674 const symbol_exprt &function,
675 const exprt::operandst &arguments,
676 goto_programt &dest);
677 void do_input(
678 const exprt &rhs,
679 const exprt::operandst &arguments,
680 goto_programt &dest);
681 void do_output(
682 const exprt &rhs,
683 const exprt::operandst &arguments,
684 goto_programt &dest);
685 void do_prob_coin(
686 const exprt &lhs,
687 const symbol_exprt &function,
688 const exprt::operandst &arguments,
689 goto_programt &dest);
690 void do_prob_uniform(
691 const exprt &lhs,
692 const symbol_exprt &function,
693 const exprt::operandst &arguments,
694 goto_programt &dest);
695 void do_havoc_slice(
696 const exprt &lhs,
697 const symbol_exprt &function,
698 const exprt::operandst &arguments,
699 goto_programt &dest,
700 const irep_idt &mode);
701 void do_alloca(
702 const exprt &lhs,
703 const symbol_exprt &function,
704 const exprt::operandst &arguments,
705 goto_programt &dest,
706 const irep_idt &mode);
707
708 exprt get_array_argument(const exprt &src);
709};
710
711#endif // CPROVER_GOTO_PROGRAMS_GOTO_CONVERT_CLASS_H
std::unordered_set< symbol_exprt, irep_hash > address_taken(const std::vector< exprt > &src)
lifetimet
Selects the kind of objects allocated.
@ STATIC_GLOBAL
Allocate global objects with static lifetime.
static exprt guard(const exprt::operandst &guards, exprt cond)
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:566
codet representation of an inline assembler statement.
Definition std_code.h:1253
A non-fatal assertion, which checks a condition then permits execution to continue.
Definition std_code.h:270
A goto_instruction_codet representing an assignment in the program.
An assumption, which must hold in subsequent code.
Definition std_code.h:217
A codet representing sequential composition of program statements.
Definition std_code.h:130
codet representation of a break statement (within a for or while loop).
Definition std_code.h:1182
codet representation of a continue statement (within a for or while loop).
Definition std_code.h:1218
codet representation of a do while statement.
Definition std_code.h:672
codet representation of an expression statement.
Definition std_code.h:1394
codet representation of a for statement.
Definition std_code.h:734
A codet representing the declaration of a local variable.
Definition std_code.h:347
codet representation of a "return from a function" statement.
Definition std_code.h:893
goto_instruction_codet representation of a function call statement.
codet representation of a switch-case, i.e. a case statement within a switch.
Definition std_code.h:1097
codet representation of a goto statement.
Definition std_code.h:841
codet representation of an if-then-else statement.
Definition std_code.h:460
codet representation of a label for branch targets.
Definition std_code.h:959
codet representation of a switch-case, i.e. a case statement within a switch.
Definition std_code.h:1023
codet representing a switch statement.
Definition std_code.h:548
codet representing a while statement.
Definition std_code.h:610
Data structure for representing an arbitrary statement in a program.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:38
Base class for all expressions.
Definition expr.h:57
std::vector< exprt > operandst
Definition expr.h:59
void convert_for(const code_fort &code, goto_programt &dest, const irep_idt &mode)
void convert_assume(const code_assumet &code, goto_programt &dest, const irep_idt &mode)
clean_expr_resultt clean_expr_address_of(exprt &expr, const irep_idt &mode)
void do_havoc_slice(const exprt &lhs, const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest, const irep_idt &mode)
symbol_table_baset & symbol_table
void do_input(const exprt &rhs, const exprt::operandst &arguments, goto_programt &dest)
void convert_expression(const code_expressiont &code, goto_programt &dest, const irep_idt &mode)
void do_array_op(const irep_idt &id, const exprt &lhs, const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest)
void set_prefix(const std::string &prefix)
void convert_while(const code_whilet &code, goto_programt &dest, const irep_idt &mode)
void convert_loop_contracts(const codet &code, goto_programt::targett loop)
void convert_assign(const code_assignt &code, goto_programt &dest, const irep_idt &mode)
void convert_gcc_computed_goto(const codet &code, goto_programt &dest)
clean_expr_resultt remove_gcc_conditional_expression(exprt &expr, const irep_idt &mode)
void goto_convert_rec(const codet &code, goto_programt &dest, const irep_idt &mode)
void convert_CPROVER_throw(const codet &code, goto_programt &dest, const irep_idt &mode)
void optimize_guarded_gotos(goto_programt &dest)
Rewrite "if(x) goto z; goto y; z:" into "if(!x) goto y;" This only works if the "goto y" is not a bra...
void convert_atomic_begin(const codet &code, goto_programt &dest)
virtual void do_function_call_if(const exprt &lhs, const if_exprt &function, const exprt::operandst &arguments, goto_programt &dest, const irep_idt &mode)
void goto_convert(const codet &code, goto_programt &dest, const irep_idt &mode)
void convert_msc_try_finally(const codet &code, goto_programt &dest, const irep_idt &mode)
clean_expr_resultt remove_pre(side_effect_exprt &expr, bool result_is_used, bool address_taken, const irep_idt &mode)
void convert_gcc_switch_case_range(const code_gcc_switch_case_ranget &, goto_programt &dest, const irep_idt &mode)
virtual void do_function_call(const exprt &lhs, const exprt &function, const exprt::operandst &arguments, goto_programt &dest, const irep_idt &mode)
irep_idt get_string_constant(const exprt &expr)
void convert_label(const code_labelt &code, goto_programt &dest, const irep_idt &mode)
void copy(const codet &code, goto_program_instruction_typet type, goto_programt &dest)
exprt get_constant(const exprt &expr)
void generate_ifthenelse(const exprt &cond, const source_locationt &, goto_programt &true_case, const source_locationt &, goto_programt &false_case, const source_locationt &, goto_programt &dest, const irep_idt &mode)
if(guard) true_case; else false_case;
void convert_start_thread(const codet &code, goto_programt &dest)
void finish_gotos(goto_programt &dest, const irep_idt &mode)
clean_expr_resultt remove_post(side_effect_exprt &expr, const irep_idt &mode, bool result_is_used)
void generate_conditional_branch(const exprt &guard, goto_programt::targett target_true, goto_programt::targett target_false, const source_locationt &, goto_programt &dest, const irep_idt &mode)
if(guard) goto target_true; else goto target_false;
void convert_ifthenelse(const code_ifthenelset &code, goto_programt &dest, const irep_idt &mode)
void do_prob_coin(const exprt &lhs, const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest)
void convert_atomic_end(const codet &code, goto_programt &dest)
void unwind_destructor_stack(const source_locationt &source_location, goto_programt &dest, const irep_idt &mode, std::optional< node_indext > destructor_end_point={}, std::optional< node_indext > destructor_start_point={})
Unwinds the destructor stack and creates destructors for each node between destructor_start_point and...
std::string tmp_symbol_prefix
void convert_frontend_decl(const code_frontend_declt &, goto_programt &, const irep_idt &mode)
void convert_gcc_local_label(const codet &code, goto_programt &dest)
struct goto_convertt::targetst targets
void convert_break(const code_breakt &code, goto_programt &dest, const irep_idt &mode)
void convert_function_call(const code_function_callt &code, goto_programt &dest, const irep_idt &mode)
symbolt & new_tmp_symbol(const typet &type, const std::string &suffix, goto_programt &dest, const source_locationt &, const irep_idt &mode)
void do_atomic_end(const exprt &lhs, const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest)
void convert_goto(const code_gotot &code, goto_programt &dest)
symbol_exprt exception_flag(const irep_idt &mode)
clean_expr_resultt remove_assignment(side_effect_exprt &expr, bool result_is_used, bool address_taken, const irep_idt &mode)
exprt case_guard(const exprt &value, const caset &case_op)
void convert_CPROVER_try_catch(const codet &code, goto_programt &dest, const irep_idt &mode)
void convert_cpp_delete(const codet &code, goto_programt &dest)
void convert_switch(const code_switcht &code, goto_programt &dest, const irep_idt &mode)
clean_expr_resultt remove_malloc(side_effect_exprt &expr, const irep_idt &mode, bool result_is_used)
static void collect_operands(const exprt &expr, const irep_idt &id, std::list< exprt > &dest)
void do_java_new(const exprt &lhs, const side_effect_exprt &rhs, goto_programt &dest)
symbol_exprt make_compound_literal(const exprt &expr, goto_programt &dest, const irep_idt &mode)
void convert_decl_type(const codet &code, goto_programt &dest)
void convert_dowhile(const code_dowhilet &code, goto_programt &dest, const irep_idt &mode)
virtual void do_function_call_symbol(const exprt &lhs, const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest, const irep_idt &mode)
add function calls to function queue for later processing
void convert_skip(const codet &code, goto_programt &dest)
void convert_asm(const code_asmt &code, goto_programt &dest)
Definition goto_asm.cpp:14
void convert_switch_case(const code_switch_caset &code, goto_programt &dest, const irep_idt &mode)
void do_output(const exprt &rhs, const exprt::operandst &arguments, goto_programt &dest)
void convert_msc_try_except(const codet &code, goto_programt &dest, const irep_idt &mode)
clean_expr_resultt remove_side_effect(side_effect_exprt &expr, const irep_idt &mode, bool result_is_used, bool address_taken)
void convert_continue(const code_continuet &code, goto_programt &dest, const irep_idt &mode)
void convert_try_catch(const codet &code, goto_programt &dest, const irep_idt &mode)
void cpp_new_initializer(const exprt &lhs, const side_effect_exprt &rhs, goto_programt &dest)
builds a goto program for object initialization after new
goto_convertt(symbol_table_baset &_symbol_table, message_handlert &_message_handler)
std::map< irep_idt, std::pair< goto_programt::targett, node_indext > > labelst
void do_printf(const exprt &lhs, const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest)
exprt get_array_argument(const exprt &src)
irep_idt make_temp_symbol(exprt &expr, const std::string &suffix, goto_programt &, const irep_idt &mode)
void convert_assert(const code_assertt &code, goto_programt &dest, const irep_idt &mode)
clean_expr_resultt clean_function_call_operands(exprt &function, exprt::operandst &arguments, const irep_idt &mode)
Remove side effects from the function operand and the argument operands of a function call,...
static bool needs_cleaning(const exprt &expr)
Returns 'true' for expressions that may change the program state.
clean_expr_resultt remove_cpp_new(side_effect_exprt &expr, bool result_is_used)
void do_java_new_array(const exprt &lhs, const side_effect_exprt &rhs, goto_programt &dest)
virtual void do_function_call_symbol(const symbolt &)
void do_alloca(const exprt &lhs, const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest, const irep_idt &mode)
alloca allocates memory that is freed when leaving the function (and not the block,...
virtual void do_function_call_other(const exprt &lhs, const exprt &function, const exprt::operandst &arguments, goto_programt &dest)
void finish_computed_gotos(goto_programt &dest)
void do_scanf(const exprt &lhs, const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest)
void convert(const codet &code, goto_programt &dest, const irep_idt &mode)
converts 'code' and appends the result to 'dest'
clean_expr_resultt remove_temporary_object(side_effect_exprt &expr)
void do_create_thread(const exprt &lhs, const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest)
void convert_CPROVER_try_finally(const codet &code, goto_programt &dest, const irep_idt &mode)
std::list< std::pair< goto_programt::targett, goto_programt::instructiont > > declaration_hop_instrumentationt
virtual ~goto_convertt()
clean_expr_resultt remove_function_call(side_effect_expr_function_callt &expr, const irep_idt &mode, bool result_is_used)
std::list< std::pair< goto_programt::targett, node_indext > > gotost
exprt::operandst caset
void do_atomic_begin(const exprt &lhs, const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest)
void do_array_equal(const exprt &lhs, const symbol_exprt &rhs, const exprt::operandst &arguments, goto_programt &dest)
declaration_hop_instrumentationt build_declaration_hops(goto_programt &dest, std::unordered_map< irep_idt, symbolt, irep_id_hash > &label_flags, const build_declaration_hops_inputst &inputs)
static void replace_new_object(const exprt &object, exprt &dest)
clean_expr_resultt remove_cpp_delete(side_effect_exprt &expr)
clean_expr_resultt remove_statement_expression(side_effect_exprt &expr, const irep_idt &mode, bool result_is_used)
void convert_msc_leave(const codet &code, goto_programt &dest, const irep_idt &mode)
void convert_return(const code_frontend_returnt &, goto_programt &dest, const irep_idt &mode)
virtual void do_cpp_new(const exprt &lhs, const side_effect_exprt &rhs, goto_programt &dest)
clean_expr_resultt clean_expr(exprt &expr, const irep_idt &mode, bool result_is_used=true)
void convert_block(const code_blockt &code, goto_programt &dest, const irep_idt &mode)
clean_expr_resultt remove_overflow(side_effect_expr_overflowt &expr, bool result_is_used, const irep_idt &mode)
std::list< goto_programt::targett > computed_gotost
void generate_thread_block(const code_blockt &thread_body, goto_programt &dest, const irep_idt &mode)
Generates the necessary goto-instructions to represent a thread-block.
std::map< goto_programt::targett, casest::iterator, goto_programt::target_less_than > cases_mapt
void rewrite_boolean(exprt &dest)
re-write boolean operators into ?:
void do_prob_uniform(const exprt &lhs, const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest)
static bool assignment_lhs_needs_temporary(const exprt &lhs)
std::list< std::pair< goto_programt::targett, caset > > casest
void convert_end_thread(const codet &code, goto_programt &dest)
A generic container class for the GOTO intermediate representation of one function.
instructionst::iterator targett
void destructive_append(goto_programt &p)
Appends the given program p to *this. p is destroyed.
The trinary if-then-else operator.
Definition std_expr.h:2426
const irep_idt & id() const
Definition irep.h:388
Class that provides messages with a built-in verbosity 'level'.
Definition message.h:154
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition namespace.h:91
Tree to keep track of the destructors generated along each branch of a function.
Definition scope_tree.h:93
node_indext get_current_node() const
Gets the node that the next addition will be added to as a child.
A side_effect_exprt representation of a function call side effect.
Definition std_code.h:1692
A Boolean expression returning true, iff the result of performing operation kind on operands a and b ...
Definition c_expr.h:118
An expression containing a side effect.
Definition std_code.h:1450
Expression to hold a symbol (variable)
Definition std_expr.h:132
The symbol table base class interface.
Symbol table entry.
Definition symbol.h:28
The type of an expression, extends irept.
Definition type.h:29
Concrete Goto Program.
goto_program_instruction_typet
The type of an instruction in a GOTO program.
std::size_t node_indext
Definition scope_tree.h:19
break_continue_targetst(const targetst &targets)
break_switch_targetst(const targetst &targets)
std::list< irep_idt > temporaries
Identifiers of temporaries introduced while cleaning an expression.
void add(clean_expr_resultt &&other)
void add_temporary(const irep_idt &id)
goto_programt side_effects
Statements implementing side effects of the expression that was subject to cleaning.
void restore(targetst &targets)
leave_targett(const targetst &targets)
goto_programt::targett leave_target
goto_programt::targett continue_target
void set_leave(goto_programt::targett _leave_target)
void set_return(goto_programt::targett _return_target)
void set_break(goto_programt::targett _break_target)
goto_programt::targett default_target
goto_programt::targett return_target
goto_programt::targett leave_target
void set_throw(goto_programt::targett _throw_target)
void set_default(goto_programt::targett _default_target)
void set_continue(goto_programt::targett _continue_target)
goto_programt::targett throw_target
goto_programt::targett break_target
goto_programt::targett throw_target
throw_targett(const targetst &targets)
void restore(targetst &targets)
A total order over targett and const_targett.