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 <map>
16 #include <string>
17 
18 #include <util/irep.h>
19 #include <util/optional.h>
20 
22 {
23 public:
24  // We have
25  // 1) a global limit
26  // 2) a limit per loop, all threads
27  // 3) a limit for a particular thread.
28  // We use the most specific of the above.
29 
30  // global limit for all loops
31  void parse_unwind(const std::string &unwind);
32 
33  // limit for instances of a loop
34  void parse_unwindset(const std::string &unwindset);
35 
36  // queries
37  optionalt<unsigned> get_limit(const irep_idt &loop, unsigned thread_id) const;
38 
39  // read unwindset directives from a file
40  void parse_unwindset_file(const std::string &file_name);
41 
42 protected:
44 
45  // Limit for all instances of a loop.
46  // This may have 'no value'.
47  typedef std::map<irep_idt, optionalt<unsigned>> loop_mapt;
49 
50  // separate limits per thread
51  using thread_loop_mapt =
52  std::map<std::pair<irep_idt, unsigned>, optionalt<unsigned>>;
54 };
55 
56 #endif // CPROVER_GOTO_INSTRUMENT_UNWINDSET_H
loop_mapt loop_map
Definition: unwindset.h:48
std::map< irep_idt, optionalt< unsigned > > loop_mapt
Definition: unwindset.h:47
std::map< std::pair< irep_idt, unsigned >, optionalt< unsigned > > thread_loop_mapt
Definition: unwindset.h:52
const std::string thread_id
nonstd::optional< T > optionalt
Definition: optional.h:35
optionalt< unsigned > global_limit
Definition: unwindset.h:43
void parse_unwindset_file(const std::string &file_name)
Definition: unwindset.cpp:85
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:35
void parse_unwindset(const std::string &unwindset)
Definition: unwindset.cpp:24
thread_loop_mapt thread_loop_map
Definition: unwindset.h:53
void parse_unwind(const std::string &unwind)
Definition: unwindset.cpp:18
optionalt< unsigned > get_limit(const irep_idt &loop, unsigned thread_id) const
Definition: unwindset.cpp:64