CBMC
Loading...
Searching...
No Matches
is_threaded.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Over-approximate Concurrency for Threaded Goto Programs
4
5Author: Daniel Kroening
6
7Date: October 2012
8
9\*******************************************************************/
10
13
14#include "is_threaded.h"
15
16#include "ai.h"
17
19{
20public:
23
27 {
28 // this is bottom
29 }
30
32 {
34 "Abstract states are only merged at reachable locations");
35
38
39 reachable=true;
41
42 return old_reachable!=reachable ||
44 }
45
47 const irep_idt &,
49 const irep_idt &,
51 ai_baset &,
52 const namespacet &) override
53 {
54 locationt from{trace_from->current_location()};
55
57 "Transformers are only applied at reachable locations");
58
59 if(from->is_start_thread())
60 is_threaded=true;
61 }
62
63 void make_bottom() final override
64 {
65 reachable=false;
66 is_threaded=false;
67 }
68
69 void make_top() final override
70 {
71 reachable=true;
72 is_threaded=true;
73 }
74
75 void make_entry() final override
76 {
77 reachable=true;
78 is_threaded=false;
79 }
80
82 {
84 "A location cannot be threaded if it is not reachable.");
85
86 return !reachable;
87 }
88
89 bool is_top() const override final
90 {
91 return reachable && is_threaded;
92 }
93};
94
95void is_threadedt::compute(const goto_functionst &goto_functions)
96{
97 // the analysis doesn't actually use the namespace, fake one
98 symbol_tablet symbol_table;
99 const namespacet ns(symbol_table);
100
102
103 is_threaded_analysis(goto_functions, ns);
104
105 for(const auto &gf_entry : goto_functions.function_map)
106 {
108 {
110 if(static_cast<const is_threaded_domaint &>(*domain_ptr).is_threaded)
111 is_threaded_set.insert(i_it);
112 }
113 }
114}
Abstract Interpretation.
This is the basic interface of the abstract interpreter with default implementations of the core func...
Definition ai.h:117
virtual cstate_ptrt abstract_state_before(locationt l) const
Get a copy of the abstract state before the given instruction, without needing to know what kind of d...
Definition ai.h:221
The interface offered by a domain, allows code to manipulate domains without knowing their exact type...
Definition ai_domain.h:54
ai_history_baset::trace_ptrt trace_ptrt
Definition ai_domain.h:73
goto_programt::const_targett locationt
Definition ai_domain.h:72
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:38
A collection of goto functions.
function_mapt function_map
bool is_bottom() const override final
void transform(const irep_idt &, trace_ptrt trace_from, const irep_idt &, trace_ptrt, ai_baset &, const namespacet &) override
how function calls are treated: a) there is an edge from each call site to the function head b) there...
bool merge(const is_threaded_domaint &src, trace_ptrt, trace_ptrt)
void make_bottom() final override
no states
void make_entry() final override
Make this domain a reasonable entry-point state For most domains top is sufficient.
void make_top() final override
all states – the analysis doesn't use this directly (see make_entry) and domains may refuse to implem...
bool is_top() const override final
void compute(const goto_functionst &goto_functions)
is_threaded_sett is_threaded_set
Definition is_threaded.h:50
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition namespace.h:91
The symbol table.
#define forall_goto_program_instructions(it, program)
Over-approximate Concurrency for Threaded Goto Programs.
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
Definition invariant.h:534
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
Definition invariant.h:423