cprover
|
This class represents an instruction in the GOTO intermediate representation. More...
#include <goto_program.h>
Public Types | |
typedef std::list< instructiont >::iterator | targett |
The target for gotos and for start_thread nodes. More... | |
typedef std::list< instructiont >::const_iterator | const_targett |
typedef std::list< targett > | targetst |
typedef std::list< const_targett > | const_targetst |
typedef std::list< irep_idt > | labelst |
Goto target labels. More... | |
Public Member Functions | |
targett | get_target () const |
Returns the first (and only) successor for the usual case of a single target. More... | |
void | set_target (targett t) |
Sets the first (and only) successor for the usual case of a single target. More... | |
bool | has_target () const |
bool | is_target () const |
Is this node a branch target? More... | |
void | clear (goto_program_instruction_typet _type) |
Clear the node. More... | |
void | make_return () |
void | make_skip () |
void | make_location (const source_locationt &l) |
void | make_throw () |
void | make_catch () |
void | make_assertion (const exprt &g) |
void | make_assumption (const exprt &g) |
void | make_assignment () |
void | make_other (const codet &_code) |
void | make_decl () |
void | make_dead () |
void | make_atomic_begin () |
void | make_atomic_end () |
void | make_end_function () |
void | make_incomplete_goto (const code_gotot &_code) |
void | make_goto (targett _target) |
void | make_goto (targett _target, const exprt &g) |
void | complete_goto (targett _target) |
void | make_assignment (const codet &_code) |
void | make_decl (const codet &_code) |
void | make_function_call (const codet &_code) |
bool | is_goto () const |
bool | is_return () const |
bool | is_assign () const |
bool | is_function_call () const |
bool | is_throw () const |
bool | is_catch () const |
bool | is_skip () const |
bool | is_location () const |
bool | is_other () const |
bool | is_decl () const |
bool | is_dead () const |
bool | is_assume () const |
bool | is_assert () const |
bool | is_atomic_begin () const |
bool | is_atomic_end () const |
bool | is_start_thread () const |
bool | is_end_thread () const |
bool | is_end_function () const |
bool | is_incomplete_goto () const |
instructiont () | |
instructiont (goto_program_instruction_typet _type) | |
void | swap (instructiont &instruction) |
Swap two instructions. More... | |
bool | is_backwards_goto () const |
Returns true if the instruction is a backwards branch. More... | |
std::string | to_string () const |
bool | equals (const instructiont &other) const |
Syntactic equality: two instructiont are equal if they have the same type, code, guard, number of targets, and labels. More... | |
void | validate (const namespacet &ns, const validation_modet vm) const |
Check that the instruction is well-formed. More... | |
Public Attributes | |
codet | code |
irep_idt | function |
The function this instruction belongs to. More... | |
source_locationt | source_location |
The location of the instruction in the source file. More... | |
goto_program_instruction_typet | type |
What kind of instruction? More... | |
exprt | guard |
Guard for gotos, assume, assert. More... | |
targetst | targets |
The list of successor instructions. More... | |
labelst | labels |
std::set< targett > | incoming_edges |
unsigned | location_number |
A globally unique number to identify a program location. More... | |
unsigned | loop_number |
Number unique per function to identify loops. More... | |
unsigned | target_number |
A number to identify branch targets. More... | |
Static Public Attributes | |
static const unsigned | nil_target |
Uniquely identify an invalid target or location. More... | |
This class represents an instruction in the GOTO intermediate representation.
Three fields are key:
The meaning of an instruction node depends on the type
field. Different kinds of instructions make use of the fields guard
and code
for different purposes. We list below, using a mixture of pseudo code and plain English, the meaning of different kinds of instructions. We use guard
, code
, and targets
to mean the value of the respective fields in this class:
targets
if and only if guard
is true. More than one target is deprecated. Its semantics was a non-deterministic choice.code
(which shall be either nil or an instance of code_returnt) and then jump to the end of the function. Many analysis tools remove these instructions before they start.code
(an instance of code_declt), the life-time of which is bounded by a corresponding DEAD instruction. Non-static symbols must be DECL'd before they are used.code
. After a DEAD instruction the symbol must be DECL'd again before use.code
(an instance of code_function_callt).code
(an instance of code_assignt) to the value of the right-hand side.code
(an instance of codet of kind ID_fence, ID_printf, ID_array_copy, ID_array_set, ID_input, ID_output, ...).guard
to evaluate to true. Assume does not "retro-actively" affect the thread or any ASSERTs.guard
is true in all possible executions, otherwise it is false / unsafe. The status of the assertion does not affect execution in any way.exception1
, ..., exceptionN
where the list of exceptions is extracted from the code
field Many analysis tools remove these instructions before they start.exception1
is thrown, then goto target1
,exceptionN
is thrown, then goto targetN
. The list of exceptions is obtained from the code
field and the list of targets from the targets
field.Definition at line 178 of file goto_program.h.
typedef std::list<const_targett> goto_programt::instructiont::const_targetst |
Definition at line 200 of file goto_program.h.
typedef std::list<instructiont>::const_iterator goto_programt::instructiont::const_targett |
Definition at line 198 of file goto_program.h.
typedef std::list<irep_idt> goto_programt::instructiont::labelst |
Goto target labels.
Definition at line 227 of file goto_program.h.
typedef std::list<targett> goto_programt::instructiont::targetst |
Definition at line 199 of file goto_program.h.
typedef std::list<instructiont>::iterator goto_programt::instructiont::targett |
The target for gotos and for start_thread nodes.
Definition at line 197 of file goto_program.h.
|
inline |
Definition at line 328 of file goto_program.h.
|
inlineexplicit |
Definition at line 333 of file goto_program.h.
|
inline |
Clear the node.
Definition at line 238 of file goto_program.h.
|
inline |
Definition at line 280 of file goto_program.h.
bool goto_programt::instructiont::equals | ( | const instructiont & | other | ) | const |
Syntactic equality: two instructiont are equal if they have the same type, code, guard, number of targets, and labels.
All other members can only be evaluated in the context of a goto_programt (see goto_programt::equals).
Definition at line 662 of file goto_program.cpp.
|
inline |
Returns the first (and only) successor for the usual case of a single target.
Definition at line 207 of file goto_program.h.
|
inline |
Definition at line 221 of file goto_program.h.
|
inline |
Definition at line 317 of file goto_program.h.
|
inline |
Definition at line 307 of file goto_program.h.
|
inline |
Definition at line 316 of file goto_program.h.
|
inline |
Definition at line 318 of file goto_program.h.
|
inline |
Definition at line 319 of file goto_program.h.
|
inline |
Returns true if the instruction is a backwards branch.
Definition at line 379 of file goto_program.h.
|
inline |
Definition at line 310 of file goto_program.h.
|
inline |
Definition at line 315 of file goto_program.h.
|
inline |
Definition at line 314 of file goto_program.h.
|
inline |
Definition at line 322 of file goto_program.h.
|
inline |
Definition at line 321 of file goto_program.h.
|
inline |
Definition at line 308 of file goto_program.h.
|
inline |
Definition at line 305 of file goto_program.h.
|
inline |
Definition at line 323 of file goto_program.h.
|
inline |
Definition at line 312 of file goto_program.h.
|
inline |
Definition at line 313 of file goto_program.h.
|
inline |
Definition at line 306 of file goto_program.h.
|
inline |
Definition at line 311 of file goto_program.h.
|
inline |
Definition at line 320 of file goto_program.h.
|
inline |
Is this node a branch target?
Definition at line 234 of file goto_program.h.
|
inline |
Definition at line 309 of file goto_program.h.
|
inline |
Definition at line 252 of file goto_program.h.
|
inline |
Definition at line 254 of file goto_program.h.
|
inline |
Definition at line 287 of file goto_program.h.
|
inline |
Definition at line 253 of file goto_program.h.
|
inline |
Definition at line 258 of file goto_program.h.
|
inline |
Definition at line 259 of file goto_program.h.
|
inline |
Definition at line 251 of file goto_program.h.
|
inline |
Definition at line 257 of file goto_program.h.
|
inline |
Definition at line 256 of file goto_program.h.
|
inline |
Definition at line 293 of file goto_program.h.
|
inline |
Definition at line 260 of file goto_program.h.
|
inline |
Definition at line 299 of file goto_program.h.
|
inline |
Definition at line 268 of file goto_program.h.
Definition at line 274 of file goto_program.h.
|
inline |
Definition at line 262 of file goto_program.h.
|
inline |
Definition at line 248 of file goto_program.h.
|
inline |
Definition at line 255 of file goto_program.h.
|
inline |
Definition at line 246 of file goto_program.h.
|
inline |
Definition at line 247 of file goto_program.h.
|
inline |
Definition at line 250 of file goto_program.h.
|
inline |
Sets the first (and only) successor for the usual case of a single target.
Definition at line 215 of file goto_program.h.
|
inline |
Swap two instructions.
Definition at line 344 of file goto_program.h.
|
inline |
Definition at line 391 of file goto_program.h.
void goto_programt::instructiont::validate | ( | const namespacet & | ns, |
const validation_modet | vm | ||
) | const |
Check that the instruction is well-formed.
The validation mode indicates whether well-formedness check failures are reported via DATA_INVARIANT violations or exceptions.
Definition at line 674 of file goto_program.cpp.
codet goto_programt::instructiont::code |
Definition at line 181 of file goto_program.h.
irep_idt goto_programt::instructiont::function |
The function this instruction belongs to.
Definition at line 184 of file goto_program.h.
exprt goto_programt::instructiont::guard |
Guard for gotos, assume, assert.
Definition at line 193 of file goto_program.h.
std::set<targett> goto_programt::instructiont::incoming_edges |
Definition at line 231 of file goto_program.h.
labelst goto_programt::instructiont::labels |
Definition at line 228 of file goto_program.h.
unsigned goto_programt::instructiont::location_number |
A globally unique number to identify a program location.
It's guaranteed to be ordered in program order within one goto_program.
Definition at line 369 of file goto_program.h.
unsigned goto_programt::instructiont::loop_number |
Number unique per function to identify loops.
Definition at line 372 of file goto_program.h.
|
static |
Uniquely identify an invalid target or location.
Definition at line 362 of file goto_program.h.
source_locationt goto_programt::instructiont::source_location |
The location of the instruction in the source file.
Definition at line 187 of file goto_program.h.
unsigned goto_programt::instructiont::target_number |
A number to identify branch targets.
This is nil_target if it's not a target.
Definition at line 376 of file goto_program.h.
targetst goto_programt::instructiont::targets |
The list of successor instructions.
Definition at line 203 of file goto_program.h.
goto_program_instruction_typet goto_programt::instructiont::type |
What kind of instruction?
Definition at line 190 of file goto_program.h.