1#ifndef CPROVER_GOTO_PROGRAM_H
2#define CPROVER_GOTO_PROGRAM_H
15#define forall_goto_program_instructions(it, program) \
16 for (goto_programt::instructionst::const_iterator it = \
17 (program).instructions.begin(); \
18 it != (program).instructions.end(); \
21#define Forall_goto_program_instructions(it, program) \
22 for (goto_programt::instructionst::iterator it = \
23 (program).instructions.begin(); \
24 it != (program).instructions.end(); \
130 typedef std::list<class instructiont>::iterator
targett;
480 if (
this == &instruction)
519 : std::list<expr2tc>{};
530 : std::list<expr2tc>{};
585 bool show_location =
true)
const;
604 const auto next = std::next(target);
613 target->swap(instruction);
621 if (p.instructions.empty())
624 auto next = std::next(target);
625 p.instructions.erase(p.instructions.begin());
683 std::ostream &out)
const;
697 if (force || instruction.function.empty())
699 instruction.function = function_id;
711 instruction.location_number = nr++;
767 using hash_typet =
decltype(&(*t));
768 return std::hash<hash_typet>{}(&(*t));
776 template <
class A,
class B>
779 return &(*a) == &(*b);
Container for an instruction of the goto-program.
Definition goto_program.h:95
bool inductive_assertion
Definition goto_program.h:165
bool is_end_function() const
Definition goto_program.h:375
void make_atomic_end()
Definition goto_program.h:283
unsigned target_number
Definition goto_program.h:546
void make_atomic_begin()
Definition goto_program.h:278
void make_goto()
Definition goto_program.h:209
std::list< classinstructiont >::iterator targett
the targets for gotos and catch
Definition goto_program.h:130
void clear(goto_program_instruction_typet _type)
clear the node
Definition goto_program.h:196
std::list< expr2tc > get_loop_invariants() const
Definition goto_program.h:516
void make_goto(targett _target)
Definition goto_program.h:288
bool is_goto() const
Definition goto_program.h:300
void make_throw()
Definition goto_program.h:236
std::list< expr2tc > get_loop_assigns_targets() const
Definition goto_program.h:527
instructiont(instructiont &&other)
Definition goto_program.h:445
labelst labels
Definition goto_program.h:160
bool inductive_step_instruction
Definition goto_program.h:163
bool is_assert() const
Definition goto_program.h:355
void dump() const
Definition goto_program.cpp:5
void make_assertion(const expr2tc &g)
Definition goto_program.h:246
bool is_target() const
is this node a branch target?
Definition goto_program.h:190
void make_return()
Definition goto_program.h:220
expr2tc guard
guard for gotos, assume, assert
Definition goto_program.h:109
std::list< classinstructiont >::const_iterator const_targett
Definition goto_program.h:131
void set_target(targett t)
Sets the first (and only) successor for the usual case of a single target.
Definition goto_program.h:147
std::list< targett > targetst
Definition goto_program.h:132
void make_decl()
Definition goto_program.h:268
expr2tc code
Definition goto_program.h:97
instructiont(goto_program_instruction_typet _type)
Definition goto_program.h:395
void make_catch()
Definition goto_program.h:241
void make_function_call(const expr2tc &_code)
Definition goto_program.h:225
void add_loop_assigns_target(const expr2tc &target)
Definition goto_program.h:522
std::vector< std::string > switch_case_ids
Definition goto_program.h:187
void make_goto(targett _target, const expr2tc &g)
Definition goto_program.h:294
bool is_location() const
Definition goto_program.h:335
goto_program_instruction_typet type
what kind of instruction?
Definition goto_program.h:106
void make_skip()
Definition goto_program.h:231
void output_instruction(const class namespacet &ns, const irep_idt &identifier, std::ostream &out, bool show_location=true) const
Definition goto_program.cpp:12
bool is_return() const
Definition goto_program.h:305
unsigned int parent_scope_id
Id of the parent scope for the current "scope_id".
Definition goto_program.h:553
targetst targets
Definition goto_program.h:135
bool is_assume() const
Definition goto_program.h:350
unsigned loop_number
Number unique per function to identify loops.
Definition goto_program.h:539
bool has_target() const
Definition goto_program.h:153
bool is_skip() const
Definition goto_program.h:330
bool is_other() const
Definition goto_program.h:340
void make_other()
Definition goto_program.h:263
std::unique_ptr< loop_contract_datat > loop_contract_data
Definition goto_program.h:120
loop_contract_datat & loop_contract_payload()
Definition goto_program.h:122
bool is_atomic_end() const
Definition goto_program.h:370
unsigned int scope_id
Definition goto_program.h:550
instructiont & operator=(const instructiont &other)
Definition goto_program.h:439
void make_assumption(const expr2tc &g)
Definition goto_program.h:252
unsigned location_number
Definition goto_program.h:536
bool is_backwards_goto() const
Returns true if the instruction is a backwards branch.
Definition goto_program.h:556
bool is_decl() const
Definition goto_program.h:345
locationt location
the location of the instruction in the source file
Definition goto_program.h:103
bool is_atomic_begin() const
Definition goto_program.h:365
std::list< const_targett > const_targetst
Definition goto_program.h:133
bool loop_invariant_havoc
Definition goto_program.h:182
void add_loop_invariant(const expr2tc &invariant)
Definition goto_program.h:511
instructiont & operator=(instructiont &&other)
Definition goto_program.h:471
bool flipped_guard
Definition goto_program.h:171
targett get_target() const
Returns the first (and only) successor for the usual case of a single target.
Definition goto_program.h:139
bool operator<(const class instructiont i1) const
Definition goto_program.h:568
void make_assignment()
Definition goto_program.h:258
instructiont(const instructiont &other)
Definition goto_program.h:410
bool is_loop_invariant() const
Definition goto_program.h:360
bool is_throw() const
Definition goto_program.h:320
bool is_catch() const
Definition goto_program.h:325
bool is_function_call() const
Definition goto_program.h:315
void make_dead()
Definition goto_program.h:273
unsigned pragma_unroll_count
Pragma-specified unroll count (0 = not specified, UINT_MAX = unlimited).
Definition goto_program.h:542
void swap(instructiont &instruction)
swap two instructions
Definition goto_program.h:478
bool is_assign() const
Definition goto_program.h:310
instructiont()
Definition goto_program.h:380
std::list< irep_idt > labelst
goto target labels
Definition goto_program.h:159
void make_location(const locationt &l)
Definition goto_program.h:214
irep_idt function
function this belongs to
Definition goto_program.h:100
A generic container class for a control flow graph for one function, in the form of a goto-program.
Definition goto_program.h:63
instructionst instructions
The list of instructions in the goto program.
Definition goto_program.h:596
void copy_from(const goto_programt &src)
Copy a full goto program, preserving targets.
Definition goto_program.cpp:374
std::list< class instructiont > instructionst
Definition goto_program.h:588
void update_instructions_function(const irep_idt &function_id, bool force=false)
Sets the function member of each instruction if not yet set, or unconditionally when force is true (e...
Definition goto_program.h:693
void clear()
Clear the goto program.
Definition goto_program.h:746
virtual ~goto_programt()=default
void update()
Update all indices.
Definition goto_program.cpp:303
void insert_swap(targett target, instructiont &instruction)
Definition goto_program.h:610
instructionst::iterator targett
Definition goto_program.h:590
instructionst::const_iterator const_targett
Definition goto_program.h:591
targett add_instruction(goto_program_instruction_typet type)
Definition goto_program.h:669
targett add_instruction()
Definition goto_program.h:651
void destructive_append(goto_programt &p)
Appends the given program, which is destroyed.
Definition goto_program.h:637
void compute_loop_numbers(unsigned int &num)
Compute loop numbers.
Definition goto_program.cpp:224
void destructive_insert(targett target, goto_programt &p)
Definition goto_program.h:644
goto_programt()
Constructor.
Definition goto_program.h:734
goto_programt(const goto_programt &src)
copy constructor
Definition goto_program.h:68
std::set< irep_idt > decl_identifierst
Definition goto_program.h:754
std::list< const_targett > const_targetst
Definition goto_program.h:593
void get_successors(const_targett target, const_targetst &successors) const
Definition goto_program.cpp:242
void insert_swap(targett target)
Insertion that preserves jumps to "target".
Definition goto_program.h:601
void compute_location_numbers(unsigned &nr)
Compute location numbers.
Definition goto_program.h:708
void get_decl_identifiers(decl_identifierst &decl_identifiers) const
get the variables in decl statements
Definition goto_program.cpp:484
void dump() const
Output goto program to given stream.
Definition goto_program.cpp:477
goto_programt & operator=(const goto_programt &src)
assignment operator
Definition goto_program.h:81
std::ostream & output(const namespacet &ns, const irep_idt &identifier, std::ostream &out) const
Output goto-program to given stream.
Definition goto_program.cpp:309
void compute_location_numbers()
Compute location numbers.
Definition goto_program.h:715
bool hide
Definition goto_program.h:90
void insert_swap(targett target, goto_programt &p)
Definition goto_program.h:618
void swap(goto_programt &program)
Swap the goto program.
Definition goto_program.h:740
targett insert(targett target)
Definition goto_program.h:631
void compute_target_numbers()
Compute the target numbers.
Definition goto_program.cpp:322
bool empty() const
Is the program empty?
Definition goto_program.h:728
targett add_instruction(instructiont &instruction)
Definition goto_program.h:660
std::list< targett > targetst
Definition goto_program.h:592
Definition witnesses.h:80
friend void swap(irep_container &a, irep_container &b) noexcept
Definition irep2.h:300
void swap(irep_idt &b)
Definition irep_idt.h:150
void swap(irept &irep)
Definition irep.h:1224
Definition namespace.h:10
@ other
Definition converter_compare.cpp:887
bool operator<(const goto_programt::const_targett i1, const goto_programt::const_targett i2)
Definition goto_program.cpp:215
std::ostream & operator<<(std::ostream &, goto_program_instruction_typet)
Definition goto_program.cpp:414
goto_program_instruction_typet
Definition goto_program.h:28
@ FUNCTION_CALL
Definition goto_program.h:43
@ ATOMIC_END
Definition goto_program.h:38
@ DEAD
Definition goto_program.h:42
@ LOCATION
Definition goto_program.h:35
@ END_FUNCTION
Definition goto_program.h:36
@ RETURN
Definition goto_program.h:39
@ ASSIGN
Definition goto_program.h:40
@ ASSERT
Definition goto_program.h:32
@ ATOMIC_BEGIN
Definition goto_program.h:37
@ LOOP_INVARIANT
Definition goto_program.h:53
@ CATCH
Definition goto_program.h:45
@ SKIP
Definition goto_program.h:34
@ NO_INSTRUCTION_TYPE
Definition goto_program.h:29
@ THROW
Definition goto_program.h:44
@ DECL
Definition goto_program.h:41
@ OTHER
Definition goto_program.h:33
@ GOTO
Definition goto_program.h:30
@ ASSUME
Definition goto_program.h:31
irep_container< expr2t > expr2tc
Definition irep2.h:431
const expr2tc & gen_true_expr()
Definition irep2_utils.h:265
const irept & get_nil_irep()
Definition irep.cpp:18
#define A
Definition logf.c:22
Definition exception.cpp:51
struct _ESBMC_Mapping * next
Definition solidity_mapping.c:3
#define false
Definition stdbool.h:10
Definition goto_program.h:764
std::size_t operator()(const goto_programt::const_targett t) const
Definition goto_program.h:765
Definition goto_program.h:116
std::list< expr2tc > invariants
Definition goto_program.h:117
std::list< expr2tc > assigns_targets
Definition goto_program.h:118
Functor to check whether iterators from different collections point at the same object.
Definition goto_program.h:775
bool operator()(const A &a, const B &b) const
Definition goto_program.h:777