CBMC
invariant_propagation.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Invariant Propagation
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_ANALYSES_INVARIANT_PROPAGATION_H
13 #define CPROVER_ANALYSES_INVARIANT_PROPAGATION_H
14 
15 #include "ai.h"
16 #include "invariant_set_domain.h"
17 
19 class value_setst;
20 
22  ait<invariant_set_domaint>
23 {
24 public:
25  invariant_propagationt(const namespacet &_ns, value_setst &_value_sets);
26 
28  {
29  return (*this)[l].invariant_set;
30  }
31 
32  void initialize(const irep_idt &function, const goto_programt &goto_program)
33  override;
34 
35  void make_all_true();
36  void make_all_false();
37 
38  void simplify(goto_programt &goto_program);
39  void simplify(goto_functionst &goto_functions);
40 
42 
43 protected:
44  // Each invariant_set_domain needs access to a few of the fields of the
45  // invariant_propagation object. This is a historic design that predates
46  // the current interfaces. Removing it would require a substantial refactor.
47  // A minimally-intrusive work around is for the domain factory to be a
48  // friend of the analyser object and create domains with references to the
49  // relevant fields.
51 
52  const namespacet &ns;
54 
56 
57  typedef std::list<unsigned> object_listt;
58 
59  void add_objects(const goto_programt &goto_program);
60  void add_objects(const goto_functionst &goto_functions);
61 
62  void get_objects(
63  const symbolt &symbol,
64  object_listt &dest);
65 
66  void get_objects_rec(
67  const exprt &src,
68  std::list<exprt> &dest);
69 
70  void get_globals(object_listt &globals);
71 
72  bool check_type(const typet &type) const;
73 };
74 
75 #endif // CPROVER_ANALYSES_INVARIANT_PROPAGATION_H
Abstract Interpretation.
goto_programt::const_targett locationt
Definition: ai.h:124
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
A collection of goto functions.
A generic container class for the GOTO intermediate representation of one function.
Definition: goto_program.h:73
void add_objects(const goto_programt &goto_program)
void simplify(goto_programt &goto_program)
void get_objects(const symbolt &symbol, object_listt &dest)
const invariant_sett & lookup(locationt l) const
void initialize(const irep_idt &function, const goto_programt &goto_program) override
Initialize all the abstract states for a single function.
void get_objects_rec(const exprt &src, std::list< exprt > &dest)
std::list< unsigned > object_listt
inv_object_storet object_store
bool check_type(const typet &type) const
void get_globals(object_listt &globals)
invariant_propagationt(const namespacet &_ns, value_setst &_value_sets)
ait< invariant_set_domaint > baset
Pass the necessary arguments to the invariant_set_domaint's when constructed.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:94
Symbol table entry.
Definition: symbol.h:28
The type of an expression, extends irept.
Definition: type.h:29