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
140 [[nodiscard]] clean_expr_resultt remove_side_effect(
141 side_effect_exprt &expr,
142 const irep_idt &mode,
143 bool result_is_used,
144 bool address_taken);
145 [[nodiscard]] clean_expr_resultt remove_assignment(
146 side_effect_exprt &expr,
147 bool result_is_used,
148 bool address_taken,
149 const irep_idt &mode);
150 [[nodiscard]] clean_expr_resultt remove_pre(
151 side_effect_exprt &expr,
152 bool result_is_used,
153 bool address_taken,
154 const irep_idt &mode);
155 [[nodiscard]] clean_expr_resultt remove_post(
156 side_effect_exprt &expr,
157 const irep_idt &mode,
158 bool result_is_used);
159 [[nodiscard]] clean_expr_resultt remove_function_call(
161 const irep_idt &mode,
162 bool result_is_used);
163 [[nodiscard]] clean_expr_resultt
165 [[nodiscard]] clean_expr_resultt remove_cpp_delete(side_effect_exprt &expr);
166 [[nodiscard]] clean_expr_resultt remove_malloc(
167 side_effect_exprt &expr,
168 const irep_idt &mode,
169 bool result_is_used);
170 [[nodiscard]] clean_expr_resultt
172 [[nodiscard]] clean_expr_resultt remove_statement_expression(
173 side_effect_exprt &expr,
174 const irep_idt &mode,
175 bool result_is_used);
176 [[nodiscard]] clean_expr_resultt
178 [[nodiscard]] clean_expr_resultt remove_overflow(
180 bool result_is_used,
181 const irep_idt &mode);
182
183 virtual void do_cpp_new(
184 const exprt &lhs,
185 const side_effect_exprt &rhs,
186 goto_programt &dest);
187
189 const exprt &lhs,
190 const side_effect_exprt &rhs,
191 goto_programt &dest);
192
194 const exprt &lhs,
195 const side_effect_exprt &rhs,
196 goto_programt &dest);
197
198 static void replace_new_object(const exprt &object, exprt &dest);
199
201 const exprt &lhs,
202 const side_effect_exprt &rhs,
203 goto_programt &dest);
204
205 //
206 // function calls
207 //
208
209 virtual void do_function_call(
210 const exprt &lhs,
211 const exprt &function,
212 const exprt::operandst &arguments,
213 goto_programt &dest,
214 const irep_idt &mode);
215
216 virtual void do_function_call_if(
217 const exprt &lhs,
218 const if_exprt &function,
219 const exprt::operandst &arguments,
220 goto_programt &dest,
221 const irep_idt &mode);
222
223 virtual void do_function_call_symbol(
224 const exprt &lhs,
225 const symbol_exprt &function,
226 const exprt::operandst &arguments,
227 goto_programt &dest,
228 const irep_idt &mode);
229
230 virtual void do_function_call_symbol(const symbolt &)
231 {
232 }
233
234 virtual void do_function_call_other(
235 const exprt &lhs,
236 const exprt &function,
237 const exprt::operandst &arguments,
238 goto_programt &dest);
239
240 //
241 // conversion
242 //
243 void convert_block(
244 const code_blockt &code,
245 goto_programt &dest,
246 const irep_idt &mode);
248 const code_frontend_declt &,
250 const irep_idt &mode);
251 void convert_decl_type(const codet &code, goto_programt &dest);
253 const code_expressiont &code,
254 goto_programt &dest,
255 const irep_idt &mode);
256 void convert_assign(
257 const code_assignt &code,
258 goto_programt &dest,
259 const irep_idt &mode);
260 void convert_cpp_delete(const codet &code, goto_programt &dest);
262 void
263 convert_for(const code_fort &code, goto_programt &dest, const irep_idt &mode);
264 void convert_while(
265 const code_whilet &code,
266 goto_programt &dest,
267 const irep_idt &mode);
268 void convert_dowhile(
269 const code_dowhilet &code,
270 goto_programt &dest,
271 const irep_idt &mode);
272 void convert_assume(
273 const code_assumet &code,
274 goto_programt &dest,
275 const irep_idt &mode);
276 void convert_assert(
277 const code_assertt &code,
278 goto_programt &dest,
279 const irep_idt &mode);
280 void convert_switch(
281 const code_switcht &code,
282 goto_programt &dest,
283 const irep_idt &mode);
284 void convert_break(
285 const code_breakt &code,
286 goto_programt &dest,
287 const irep_idt &mode);
288 void convert_return(
289 const code_frontend_returnt &,
290 goto_programt &dest,
291 const irep_idt &mode);
292 void convert_continue(
293 const code_continuet &code,
294 goto_programt &dest,
295 const irep_idt &mode);
297 const code_ifthenelset &code,
298 goto_programt &dest,
299 const irep_idt &mode);
300 void convert_goto(const code_gotot &code, goto_programt &dest);
301 void convert_gcc_computed_goto(const codet &code, goto_programt &dest);
302 void convert_skip(const codet &code, goto_programt &dest);
303 void convert_label(
304 const code_labelt &code,
305 goto_programt &dest,
306 const irep_idt &mode);
307 void convert_gcc_local_label(const codet &code, goto_programt &dest);
309 const code_switch_caset &code,
310 goto_programt &dest,
311 const irep_idt &mode);
314 goto_programt &dest,
315 const irep_idt &mode);
317 const code_function_callt &code,
318 goto_programt &dest,
319 const irep_idt &mode);
320 void convert_start_thread(const codet &code, goto_programt &dest);
321 void convert_end_thread(const codet &code, goto_programt &dest);
322 void convert_atomic_begin(const codet &code, goto_programt &dest);
323 void convert_atomic_end(const codet &code, goto_programt &dest);
325 const codet &code,
326 goto_programt &dest,
327 const irep_idt &mode);
329 const codet &code,
330 goto_programt &dest,
331 const irep_idt &mode);
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);
352 void convert_asm(const code_asmt &code, goto_programt &dest);
353
354 void convert(const codet &code, goto_programt &dest, const irep_idt &mode);
355
356 void copy(
357 const codet &code,
359 goto_programt &dest);
360
361 //
362 // exceptions
363 //
364
366
368 const source_locationt &source_location,
369 goto_programt &dest,
370 const irep_idt &mode,
371 std::optional<node_indext> destructor_end_point = {},
372 std::optional<node_indext> destructor_start_point = {});
373
374 typedef std::list<
375 std::pair<goto_programt::targett, goto_programt::instructiont>>
378 goto_programt &dest,
379 std::unordered_map<irep_idt, symbolt, irep_id_hash> &label_flags,
380 const build_declaration_hops_inputst &inputs);
381
382 //
383 // gotos
384 //
385
386 void finish_gotos(goto_programt &dest, const irep_idt &mode);
389
390 typedef std::map<irep_idt, std::pair<goto_programt::targett, node_indext>>
392 typedef std::list<std::pair<goto_programt::targett, node_indext>> gotost;
393 typedef std::list<goto_programt::targett> computed_gotost;
395 typedef std::list<std::pair<goto_programt::targett, caset>> casest;
396 typedef std::map<
398 casest::iterator,
401
402 struct targetst
403 {
406
409
414
417
420
423
438
445
452
458
464
471
479
481 {
482 // for 'while', 'for', 'dowhile'
483
485 {
486 break_set = targets.break_set;
487 continue_set = targets.continue_set;
488 break_target = targets.break_target;
489 continue_target = targets.continue_target;
490 }
491
493 {
494 targets.break_set = break_set;
495 targets.continue_set = continue_set;
496 targets.break_target = break_target;
497 targets.continue_target = continue_target;
498 }
499
503 };
504
506 {
507 // for 'switch'
508
510 {
511 break_set = targets.break_set;
512 default_set = targets.default_set;
513 break_target = targets.break_target;
514 default_target = targets.default_target;
515 break_stack_node = targets.scope_stack.get_current_node();
516 cases = targets.cases;
517 cases_map = targets.cases_map;
518 }
519
521 {
522 targets.break_set = break_set;
523 targets.default_set = default_set;
524 targets.break_target = break_target;
525 targets.default_target = default_target;
526 targets.cases = cases;
527 targets.cases_map = cases_map;
528 }
529
534
537 };
538
540 {
541 // for 'try...catch' and the like
542
544 {
545 throw_set = targets.throw_set;
546 throw_target = targets.throw_target;
547 throw_stack_node = targets.scope_stack.get_current_node();
548 }
549
551 {
552 targets.throw_set = throw_set;
553 targets.throw_target = throw_target;
554 }
555
559 };
560
562 {
563 // for 'try...leave...finally'
564
566 {
567 leave_set = targets.leave_set;
568 leave_target = targets.leave_target;
569 leave_stack_node = targets.scope_stack.get_current_node();
570 }
571
573 {
574 targets.leave_set = leave_set;
575 targets.leave_target = leave_target;
576 }
577
581 };
582
583 exprt case_guard(const exprt &value, const caset &case_op);
584
585 // if(cond) { true_case } else { false_case }
587 const exprt &cond,
588 const source_locationt &,
589 goto_programt &true_case,
590 const source_locationt &,
591 goto_programt &false_case,
592 const source_locationt &,
593 goto_programt &dest,
594 const irep_idt &mode);
595
596 // if(guard) goto target_true; else goto target_false;
598 const exprt &guard,
601 const source_locationt &,
602 goto_programt &dest,
603 const irep_idt &mode);
604
605 // if(guard) goto target;
607 const exprt &guard,
609 const source_locationt &,
610 goto_programt &dest,
611 const irep_idt &mode);
612
613 // turn a OP b OP c into a list a, b, c
614 static void collect_operands(
615 const exprt &expr,
616 const irep_idt &id,
617 std::list<exprt> &dest);
618
619 // START_THREAD; ... END_THREAD;
622 goto_programt &dest,
623 const irep_idt &mode);
624
625 //
626 // misc
627 //
629 bool get_string_constant(const exprt &expr, irep_idt &);
630 exprt get_constant(const exprt &expr);
631
632 // some built-in functions
633 void do_atomic_begin(
634 const exprt &lhs,
635 const symbol_exprt &function,
636 const exprt::operandst &arguments,
637 goto_programt &dest);
638 void do_atomic_end(
639 const exprt &lhs,
640 const symbol_exprt &function,
641 const exprt::operandst &arguments,
642 goto_programt &dest);
644 const exprt &lhs,
645 const symbol_exprt &function,
646 const exprt::operandst &arguments,
647 goto_programt &dest);
649 const exprt &lhs,
650 const symbol_exprt &rhs,
651 const exprt::operandst &arguments,
652 goto_programt &dest);
653 void do_array_op(
654 const irep_idt &id,
655 const exprt &lhs,
656 const symbol_exprt &function,
657 const exprt::operandst &arguments,
658 goto_programt &dest);
659 void do_printf(
660 const exprt &lhs,
661 const symbol_exprt &function,
662 const exprt::operandst &arguments,
663 goto_programt &dest);
664 void do_scanf(
665 const exprt &lhs,
666 const symbol_exprt &function,
667 const exprt::operandst &arguments,
668 goto_programt &dest);
669 void do_input(
670 const exprt &rhs,
671 const exprt::operandst &arguments,
672 goto_programt &dest);
673 void do_output(
674 const exprt &rhs,
675 const exprt::operandst &arguments,
676 goto_programt &dest);
677 void do_prob_coin(
678 const exprt &lhs,
679 const symbol_exprt &function,
680 const exprt::operandst &arguments,
681 goto_programt &dest);
682 void do_prob_uniform(
683 const exprt &lhs,
684 const symbol_exprt &function,
685 const exprt::operandst &arguments,
686 goto_programt &dest);
687 void do_havoc_slice(
688 const exprt &lhs,
689 const symbol_exprt &function,
690 const exprt::operandst &arguments,
691 goto_programt &dest,
692 const irep_idt &mode);
693 void do_alloca(
694 const exprt &lhs,
695 const symbol_exprt &function,
696 const exprt::operandst &arguments,
697 goto_programt &dest,
698 const irep_idt &mode);
699
700 exprt get_array_argument(const exprt &src);
701};
702
703#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)
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:2416
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.