cprover
disjunctive_polynomial_acceleration.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_DISJUNCTIVE_POLYNOMIAL_ACCELERATION_H
13 #define CPROVER_GOTO_INSTRUMENT_ACCELERATE_DISJUNCTIVE_POLYNOMIAL_ACCELERATION_H
14 
15 #include <map>
16 #include <set>
17 
18 #include <util/symbol_table.h>
19 #include <util/message.h>
20 
23 
24 #include <analyses/natural_loops.h>
25 
26 #include "scratch_program.h"
27 #include "polynomial.h"
28 #include "path.h"
29 #include "accelerator.h"
30 #include "loop_acceleration.h"
31 #include "cone_of_influence.h"
32 #include "acceleration_utils.h"
33 
35 {
36 public:
39  symbol_tablet &_symbol_table,
40  goto_functionst &_goto_functions,
41  goto_programt &_goto_program,
43  goto_programt::targett _loop_header)
45  symbol_table(_symbol_table),
47  goto_functions(_goto_functions),
48  goto_program(_goto_program),
49  loop(_loop),
50  loop_header(_loop_header),
52  {
55  build_fixed();
57  }
58 
59  virtual bool accelerate(path_acceleratort &accelerator);
60 
61  bool fit_polynomial(
62  exprt &target,
63  polynomialt &polynomial,
64  patht &path);
65 
66  bool find_path(patht &path);
67 
68 protected:
70 
71  void assert_for_values(
72  scratch_programt &program,
73  std::map<exprt, exprt> &values,
74  std::set<std::pair<expr_listt, exprt> > &coefficients,
75  int num_unwindings,
76  goto_programt &loop_body,
77  exprt &target);
78  void cone_of_influence(const exprt &target, expr_sett &cone);
79 
81 
82  void build_path(scratch_programt &scratch_program, patht &path);
83  void build_fixed();
84 
85  void record_path(scratch_programt &scratch_program);
86 
87  bool depends_on_array(const exprt &e, exprt &array);
88 
95 
96  typedef std::map<goto_programt::targett, exprt> distinguish_mapt;
97  typedef std::map<exprt, bool> distinguish_valuest;
98 
102  std::list<exprt> distinguishers;
105  std::list<distinguish_valuest> accelerated_paths;
106 };
107 
108 // NOLINTNEXTLINE(whitespace/line_length)
109 #endif // CPROVER_GOTO_INSTRUMENT_ACCELERATE_DISJUNCTIVE_POLYNOMIAL_ACCELERATION_H
void build_path(scratch_programt &scratch_program, patht &path)
Goto Programs with Functions.
void record_path(scratch_programt &scratch_program)
disjunctive_polynomial_accelerationt(message_handlert &message_handler, symbol_tablet &_symbol_table, goto_functionst &_goto_functions, goto_programt &_goto_program, natural_loops_mutablet::natural_loopt &_loop, goto_programt::targett _loop_header)
void assert_for_values(scratch_programt &program, std::map< exprt, exprt > &values, std::set< std::pair< expr_listt, exprt > > &coefficients, int num_unwindings, goto_programt &loop_body, exprt &target)
Loop Acceleration.
virtual bool accelerate(path_acceleratort &accelerator)
std::unordered_set< exprt, irep_hash > expr_sett
instructionst::iterator targett
Definition: goto_program.h:397
The NIL expression.
Definition: std_expr.h:4510
std::list< path_nodet > patht
Definition: path.h:45
The symbol table.
Definition: symbol_table.h:19
TO_BE_DOCUMENTED.
Definition: namespace.h:74
void find_modified(const patht &path, expr_sett &modified)
Loop Acceleration.
Author: Diffblue Ltd.
std::map< goto_programt::targett, exprt > distinguish_mapt
A generic container class for the GOTO intermediate representation of one function.
Definition: goto_program.h:70
Loop Acceleration.
Loop Acceleration.
Loop Acceleration.
Loop Acceleration.
Base class for all expressions.
Definition: expr.h:42
natural_loops_mutablet::natural_loopt & loop
bool fit_polynomial(exprt &target, polynomialt &polynomial, patht &path)
void cone_of_influence(const exprt &target, expr_sett &cone)
Compute natural loops in a goto_function.
Loop Acceleration.
Concrete Goto Program.