CBMC
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
17#include <list>
18#include <map>
19#include <optional>
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.
33 unwindsett() = default;
34
35 // global limit for all loops
36 void parse_unwind(const std::string &unwind);
37
38 // limit for instances of a loop
39 void parse_unwindset(
40 const std::list<std::string> &unwindset,
41 abstract_goto_modelt &goto_model,
42 message_handlert &message_handler);
43
44 // queries
45 std::optional<unsigned>
46 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 abstract_goto_modelt &goto_model,
52 message_handlert &message_handler);
53
54protected:
55 std::optional<unsigned> global_limit;
56
57 // Limit for all instances of a loop.
58 // This may have 'no value'.
59 typedef std::map<irep_idt, std::optional<unsigned>> loop_mapt;
61
62 // separate limits per thread
64 std::map<std::pair<irep_idt, unsigned>, std::optional<unsigned>>;
66
68 std::string loop_limit,
69 abstract_goto_modelt &goto_model,
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.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:38
loop_mapt loop_map
Definition unwindset.h:60
unwindsett()=default
std::optional< unsigned > get_limit(const irep_idt &loop, unsigned thread_id) const
void parse_unwindset_one_loop(std::string loop_limit, abstract_goto_modelt &goto_model, message_handlert &message_handler)
Definition unwindset.cpp:29
void parse_unwind(const std::string &unwind)
Definition unwindset.cpp:23
void parse_unwindset(const std::list< std::string > &unwindset, abstract_goto_modelt &goto_model, message_handlert &message_handler)
void parse_unwindset_file(const std::string &file_name, abstract_goto_modelt &goto_model, message_handlert &message_handler)
std::map< std::pair< irep_idt, unsigned >, std::optional< unsigned > > thread_loop_mapt
Definition unwindset.h:64
std::optional< unsigned > global_limit
Definition unwindset.h:55
thread_loop_mapt thread_loop_map
Definition unwindset.h:65
std::map< irep_idt, std::optional< unsigned > > loop_mapt
Definition unwindset.h:59
const std::string thread_id