cprover
unwindset.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Loop unwinding setup
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_GOTO_INSTRUMENT_UNWINDSET_H
13 #define CPROVER_GOTO_INSTRUMENT_UNWINDSET_H
14 
15 #include <list>
16 #include <map>
17 #include <string>
18 
19 #include <util/irep.h>
20 #include <util/optional.h>
21 
23 {
24 public:
25  // We have
26  // 1) a global limit
27  // 2) a limit per loop, all threads
28  // 3) a limit for a particular thread.
29  // We use the most specific of the above.
30 
31  // global limit for all loops
32  void parse_unwind(const std::string &unwind);
33 
34  // limit for instances of a loop
35  void parse_unwindset(const std::list<std::string> &unwindset);
36 
37  // queries
38  optionalt<unsigned> get_limit(const irep_idt &loop, unsigned thread_id) const;
39 
40  // read unwindset directives from a file
41  void parse_unwindset_file(const std::string &file_name);
42 
43 protected:
45 
46  // Limit for all instances of a loop.
47  // This may have 'no value'.
48  typedef std::map<irep_idt, optionalt<unsigned>> loop_mapt;
50 
51  // separate limits per thread
53  std::map<std::pair<irep_idt, unsigned>, optionalt<unsigned>>;
55 
56  void parse_unwindset_one_loop(std::string loop_limit);
57 };
58 
59 #endif // CPROVER_GOTO_INSTRUMENT_UNWINDSET_H
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:37
loop_mapt loop_map
Definition: unwindset.h:49
void parse_unwind(const std::string &unwind)
Definition: unwindset.cpp:20
std::map< irep_idt, optionalt< unsigned > > loop_mapt
Definition: unwindset.h:48
optionalt< unsigned > global_limit
Definition: unwindset.h:44
void parse_unwindset(const std::list< std::string > &unwindset)
Definition: unwindset.cpp:59
void parse_unwindset_file(const std::string &file_name)
Definition: unwindset.cpp:93
std::map< std::pair< irep_idt, unsigned >, optionalt< unsigned > > thread_loop_mapt
Definition: unwindset.h:53
thread_loop_mapt thread_loop_map
Definition: unwindset.h:54
optionalt< unsigned > get_limit(const irep_idt &loop, unsigned thread_id) const
Definition: unwindset.cpp:72
void parse_unwindset_one_loop(std::string loop_limit)
Definition: unwindset.cpp:26
const std::string thread_id
nonstd::optional< T > optionalt
Definition: optional.h:35