cprover
scratch_program.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Loop Acceleration
4 
5 Author: Matt Lewis
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_GOTO_INSTRUMENT_ACCELERATE_SCRATCH_PROGRAM_H
13 #define CPROVER_GOTO_INSTRUMENT_ACCELERATE_SCRATCH_PROGRAM_H
14 
15 #include <memory>
16 #include <string>
17 
18 #include <util/make_unique.h>
19 #include <util/message.h>
20 #include <util/symbol_table.h>
21 
24 
25 #include <goto-symex/goto_symex.h>
28 
29 #include <solvers/smt2/smt2_dec.h>
30 
32 #include <solvers/sat/satcheck.h>
33 
34 #include "path.h"
35 
37 {
38 public:
40  symbol_tablet &_symbol_table,
41  message_handlert &mh,
42  guard_managert &guard_manager)
43  : constant_propagation(true),
44  symbol_table(_symbol_table),
47  equation(mh),
48  path_storage(),
50  symex(mh, symbol_table, equation, options, path_storage, guard_manager),
51  satcheck(util_make_unique<satcheckt>(mh)),
52  satchecker(ns, *satcheck, mh),
53  z3(ns, "accelerate", "", "", smt2_dect::solvert::Z3, mh),
54  checker(&z3) // checker(&satchecker)
55  {
56  }
57 
59  void append(goto_programt &program);
60  void append_path(patht &path);
61  void append_loop(goto_programt &program, goto_programt::targett loop_header);
62 
63  targett assign(const exprt &lhs, const exprt &rhs);
64  targett assume(const exprt &guard);
65 
66  bool check_sat(bool do_slice, guard_managert &guard_manager);
67 
68  bool check_sat(guard_managert &guard_manager)
69  {
70  return check_sat(true, guard_manager);
71  }
72 
73  exprt eval(const exprt &e);
74 
75  void fix_types();
76 
78 
79 protected:
80  std::unique_ptr<goto_symex_statet> symex_state;
89 
90  std::unique_ptr<propt> satcheck;
95 };
96 
97 #endif // CPROVER_GOTO_INSTRUMENT_ACCELERATE_SCRATCH_PROGRAM_H
Base class for all expressions.
Definition: expr.h:54
A collection of goto functions.
A generic container class for the GOTO intermediate representation of one function.
Definition: goto_program.h:74
instructionst instructions
The list of instructions in the goto program.
Definition: goto_program.h:556
instructionst::iterator targett
Definition: goto_program.h:550
std::list< instructiont > instructionst
Definition: goto_program.h:548
The main class for the forward symbolic simulator.
Definition: goto_symex.h:48
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:92
FIFO save queue: paths are resumed in the order that they were saved.
Definition: path_storage.h:184
scratch_programt(symbol_tablet &_symbol_table, message_handlert &mh, guard_managert &guard_manager)
goto_functionst functions
bool check_sat(guard_managert &guard_manager)
bool check_sat(bool do_slice, guard_managert &guard_manager)
symbol_tablet & symbol_table
targett assume(const exprt &guard)
void append_loop(goto_programt &program, goto_programt::targett loop_header)
targett assign(const exprt &lhs, const exprt &rhs)
symbol_tablet symex_symbol_table
static optionst get_default_options()
void append(goto_programt::instructionst &instructions)
decision_proceduret * checker
std::unique_ptr< goto_symex_statet > symex_state
bv_pointerst satchecker
exprt eval(const exprt &e)
void append_path(patht &path)
path_fifot path_storage
std::unique_ptr< propt > satcheck
goto_symext symex
symex_target_equationt equation
Decision procedure interface for various SMT 2.x solvers.
Definition: smt2_dec.h:28
The symbol table.
Definition: symbol_table.h:20
Inheriting the interface of symex_targett this class represents the SSA form of the input program as ...
Goto Programs with Functions.
Concrete Goto Program.
Symbolic Execution.
std::unique_ptr< T > util_make_unique(Ts &&... ts)
Definition: make_unique.h:19
Loop Acceleration.
std::list< path_nodet > patht
Definition: path.h:45
Storage of symbolic execution paths to resume.
This is unused by this implementation of guards, but can be used by other implementations of the same...
Definition: guard_expr.h:23
Author: Diffblue Ltd.
Generate Equation using Symbolic Execution.