cprover
Loading...
Searching...
No Matches
unwindset.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Loop unwinding setup
4
5Author: 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 <util/irep.h>
16#include <util/optional.h>
17
18#include <list>
19#include <map>
20#include <string>
21
24
26{
27public:
28 // We have
29 // 1) a global limit
30 // 2) a limit per loop, all threads
31 // 3) a limit for a particular thread.
32 // We use the most specific of the above.
36
37 // global limit for all loops
38 void parse_unwind(const std::string &unwind);
39
40 // limit for instances of a loop
41 void parse_unwindset(
42 const std::list<std::string> &unwindset,
43 message_handlert &message_handler);
44
45 // queries
46 optionalt<unsigned> get_limit(const irep_idt &loop, unsigned thread_id) const;
47
48 // read unwindset directives from a file
50 const std::string &file_name,
51 message_handlert &message_handler);
52
53protected:
55
57
58 // Limit for all instances of a loop.
59 // This may have 'no value'.
60 typedef std::map<irep_idt, optionalt<unsigned>> loop_mapt;
62
63 // separate limits per thread
65 std::map<std::pair<irep_idt, unsigned>, optionalt<unsigned>>;
67
69 std::string loop_limit,
70 message_handlert &message_handler);
71};
72
73#define OPT_UNWINDSET \
74 "(show-loops)" \
75 "(unwind):" \
76 "(unwindset):"
77
78#define HELP_UNWINDSET \
79 " {y--show-loops} \t show the loops in the program\n" \
80 " {y--unwind} {unr} \t unwind loops {unr} times\n" \
81 " {y--unwindset} [{uT}{y:}]{uL}{y:}{uB},... \t " \
82 "unwind loop {uL} with a bound of {uB} (optionally restricted to thread " \
83 "{uT}) (use {y--show-loops} to get the loop IDs)\n"
84
85#endif // CPROVER_GOTO_INSTRUMENT_UNWINDSET_H
Abstract interface to eager or lazy GOTO models.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:563
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:39
loop_mapt loop_map
Definition unwindset.h:61
void parse_unwindset_one_loop(std::string loop_limit, message_handlert &message_handler)
Definition unwindset.cpp:29
void parse_unwind(const std::string &unwind)
Definition unwindset.cpp:23
std::map< irep_idt, optionalt< unsigned > > loop_mapt
Definition unwindset.h:60
optionalt< unsigned > global_limit
Definition unwindset.h:56
thread_loop_mapt thread_loop_map
Definition unwindset.h:66
unwindsett(abstract_goto_modelt &goto_model)
Definition unwindset.h:33
std::map< std::pair< irep_idt, unsigned >, optionalt< unsigned > > thread_loop_mapt
Definition unwindset.h:64
void parse_unwindset_file(const std::string &file_name, message_handlert &message_handler)
abstract_goto_modelt & goto_model
Definition unwindset.h:54
optionalt< unsigned > get_limit(const irep_idt &loop, unsigned thread_id) const
void parse_unwindset(const std::list< std::string > &unwindset, message_handlert &message_handler)
const std::string thread_id