CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
abstract_environment.h
Go to the documentation of this file.
1/*******************************************************************\
2
3 Module: analyses variable-sensitivity
4
5 Author: Thomas Kiley, thomas.kiley@diffblue.com
6
7\*******************************************************************/
8
16
17#ifndef CPROVER_ANALYSES_VARIABLE_SENSITIVITY_ABSTRACT_ENVIROMENT_H
18#define CPROVER_ANALYSES_VARIABLE_SENSITIVITY_ABSTRACT_ENVIROMENT_H
19
20#include "abstract_object.h"
21
23bool is_ptr_diff(const exprt &expr);
24bool is_ptr_comparison(const exprt &expr);
25
28 std::shared_ptr<variable_sensitivity_object_factoryt>;
29
30enum class widen_modet
31{
32 no,
34};
35
36struct vsd_configt;
37
39{
40public:
42
44
50
52
60 eval(const exprt &expr, const namespacet &ns) const;
61
89 virtual bool assign(
90 const exprt &expr,
91 const abstract_object_pointert &value,
92 const namespacet &ns);
93
108 virtual bool assume(const exprt &expr, const namespacet &ns);
109 exprt do_assume(const exprt &e, const namespacet &ns);
110
132 const abstract_object_pointert &lhs,
133 const abstract_object_pointert &rhs,
134 std::stack<exprt> remaining_stack,
135 const namespacet &ns,
136 bool merge_write);
137
142 void erase(const symbol_exprt &expr);
143
155 const typet &type,
156 const namespacet &ns,
157 bool top,
158 bool bottom) const;
159
173 const typet &type,
174 const exprt &e,
175 const namespacet &ns) const;
176
178 const vsd_configt &configuration() const;
179
187 virtual bool merge(
191
199 virtual void havoc(const std::string &havoc_string);
200
202 void make_top();
203
205 void make_bottom();
206
208 bool is_bottom() const;
209
211 bool is_top() const;
212
218 void output(std::ostream &out, const class ai_baset &ai, const namespacet &ns)
219 const;
220
225 exprt to_predicate() const;
226
229 bool verify() const;
230
244 static std::vector<abstract_environmentt::map_keyt> modified_symbols(
245 const abstract_environmentt &first,
246 const abstract_environmentt &second);
247
249
250protected:
251 bool bottom;
252
253 // We may need to break out more of these cases into these
255 eval_expression(const exprt &e, const namespacet &ns) const;
256
258 resolve_symbol(const exprt &e, const namespacet &ns) const;
259
261
262private:
278 const typet &type,
279 bool top,
280 bool bottom,
281 const exprt &e,
282 const abstract_environmentt &environment,
283 const namespacet &ns) const;
284
286};
287
288#endif // CPROVER_ANALYSES_VARIABLE_SENSITIVITY_ABSTRACT_ENVIROMENT_H
exprt simplify_vsd_expr(exprt src, const namespacet &ns)
bool is_ptr_comparison(const exprt &expr)
std::shared_ptr< variable_sensitivity_object_factoryt > variable_sensitivity_object_factory_ptrt
bool is_ptr_diff(const exprt &expr)
abstract_objectt is the top of the inheritance heirarchy of objects used to represent individual vari...
sharing_ptrt< class abstract_objectt > abstract_object_pointert
virtual bool assume(const exprt &expr, const namespacet &ns)
Reduces the domain based on a condition.
void output(std::ostream &out, const class ai_baset &ai, const namespacet &ns) const
Print out all the values in the abstract object map.
bool is_bottom() const
Gets whether the domain is bottom.
abstract_object_pointert resolve_symbol(const exprt &e, const namespacet &ns) const
exprt to_predicate() const
Gives a boolean condition that is true for all values represented by the environment.
abstract_environmentt(variable_sensitivity_object_factory_ptrt _object_factory)
void make_top()
Set the domain to top (i.e. everything)
virtual abstract_object_pointert eval(const exprt &expr, const namespacet &ns) const
These three are really the heart of the method.
void erase(const symbol_exprt &expr)
Delete a symbol from the map.
static std::vector< abstract_environmentt::map_keyt > modified_symbols(const abstract_environmentt &first, const abstract_environmentt &second)
For our implementation of variable sensitivity domains, we need to be able to efficiently find symbol...
bool verify() const
Check the structural invariants are maintained.
virtual void havoc(const std::string &havoc_string)
This should be used as a default case / everything else has failed The string is so that I can easily...
exprt do_assume(const exprt &e, const namespacet &ns)
const vsd_configt & configuration() const
Exposes the environment configuration.
variable_sensitivity_object_factory_ptrt object_factory
virtual abstract_object_pointert write(const abstract_object_pointert &lhs, const abstract_object_pointert &rhs, std::stack< exprt > remaining_stack, const namespacet &ns, bool merge_write)
Used within assign to do the actual dispatch.
abstract_object_statisticst gather_statistics(const namespacet &ns) const
virtual bool merge(const abstract_environmentt &env, const goto_programt::const_targett &merge_location, widen_modet widen_mode)
Computes the join between "this" and "b".
void make_bottom()
Set the domain to top (i.e. no possible states / unreachable)
bool is_top() const
Gets whether the domain is top.
virtual abstract_object_pointert abstract_object_factory(const typet &type, const namespacet &ns, bool top, bool bottom) const
Look at the configuration for the sensitivity and create an appropriate abstract_object.
virtual abstract_object_pointert eval_expression(const exprt &e, const namespacet &ns) const
abstract_environmentt()=delete
virtual bool assign(const exprt &expr, const abstract_object_pointert &value, const namespacet &ns)
Assign a value to an expression.
sharing_mapt< map_keyt, abstract_object_pointert > map
This is the basic interface of the abstract interpreter with default implementations of the core func...
Definition ai.h:117
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
Base class for all expressions.
Definition expr.h:56
instructionst::const_iterator const_targett
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition namespace.h:91
Expression to hold a symbol (variable)
Definition std_expr.h:131
The type of an expression, extends irept.
Definition type.h:29
STL namespace.
dstringt irep_idt