CBMC
data_dependency_context.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: analyses variable-sensitivity data_dependency_context
4 
5 Author: Diffblue Ltd
6 
7 \*******************************************************************/
8 
14 #ifndef CPROVER_ANALYSES_VARIABLE_SENSITIVITY_DATA_DEPENDENCY_CONTEXT_H
15 #define CPROVER_ANALYSES_VARIABLE_SENSITIVITY_DATA_DEPENDENCY_CONTEXT_H
16 
17 #include "write_location_context.h"
18 
20 {
21 public:
22  // These constructors mirror those in the base abstract_objectt, but with
23  // the addition of an extra argument which is the abstract_objectt to wrap.
25  const abstract_object_pointert child,
26  const typet &type)
28  {
29  }
30 
32  const abstract_object_pointert child,
33  const typet &type,
34  bool top,
35  bool bottom)
37  {
38  }
39 
41  const abstract_object_pointert child,
42  const exprt &expr,
43  const abstract_environmentt &environment,
44  const namespacet &ns)
45  : write_location_contextt(child, expr, environment, ns)
46  {
47  }
48 
50  abstract_environmentt &environment,
51  const namespacet &ns,
52  const std::stack<exprt> &stack,
53  const exprt &specifier,
54  const abstract_object_pointert &value,
55  bool merging_write) const override;
56 
57  bool has_been_modified(const abstract_object_pointert &before) const override;
58 
59  std::set<goto_programt::const_targett> get_data_dependencies() const;
60  std::set<goto_programt::const_targett> get_data_dominators() const;
61 
62  void output(std::ostream &out, const class ai_baset &ai, const namespacet &ns)
63  const override;
64 
65 protected:
67 
69  const abstract_object_pointert &other,
70  const widen_modet &widen_mode) const override;
72  meet(const abstract_object_pointert &other) const override;
73 
75  const abstract_object_pointert &other) const override;
76 
77 private:
79  std::shared_ptr<const data_dependency_contextt>;
80 
82  const data_dependency_context_ptrt &other,
83  const data_dependency_context_ptrt &parent) const;
84 
86  {
87  public:
88  bool operator()(
89  goto_programt::const_targett instruction,
90  goto_programt::const_targett other_instruction) const
91  {
92  return instruction->location_number > other_instruction->location_number;
93  }
94  };
95  typedef std::set<goto_programt::const_targett, location_ordert> dependenciest;
98 
100  insert_data_deps(const dependenciest &dependencies) const;
101 
103  update_location_context_internal(const locationst &locations) const override;
104 
105  void set_data_deps(const locationst &locations);
106  void set_data_deps(const dependenciest &dependences);
107 };
108 
109 #endif // CPROVER_ANALYSES_VARIABLE_SENSITIVITY_DATA_DEPENDENCY_CONTEXT_H
data_dependency_contextt::output
void output(std::ostream &out, const class ai_baset &ai, const namespacet &ns) const override
Output a representation of the value of this abstract object.
Definition: data_dependency_context.cpp:353
widen_modet
widen_modet
Definition: abstract_environment.h:32
abstract_object_pointert
sharing_ptrt< class abstract_objectt > abstract_object_pointert
Definition: abstract_object.h:69
data_dependency_contextt::data_dependency_context_ptrt
std::shared_ptr< const data_dependency_contextt > data_dependency_context_ptrt
Definition: data_dependency_context.h:79
data_dependency_contextt::location_ordert::operator()
bool operator()(goto_programt::const_targett instruction, goto_programt::const_targett other_instruction) const
Definition: data_dependency_context.h:88
typet
The type of an expression, extends irept.
Definition: type.h:28
data_dependency_contextt::data_dependency_contextt
data_dependency_contextt(const abstract_object_pointert child, const exprt &expr, const abstract_environmentt &environment, const namespacet &ns)
Definition: data_dependency_context.h:40
data_dependency_contextt::write
abstract_object_pointert write(abstract_environmentt &environment, const namespacet &ns, const std::stack< exprt > &stack, const exprt &specifier, const abstract_object_pointert &value, bool merging_write) const override
A helper function to evaluate writing to a component of an abstract object.
Definition: data_dependency_context.cpp:194
data_dependency_contextt::get_data_dependencies
std::set< goto_programt::const_targett > get_data_dependencies() const
Return the set of data dependencies associated with this node.
Definition: data_dependency_context.cpp:331
abstract_environmentt
Definition: abstract_environment.h:40
exprt
Base class for all expressions.
Definition: expr.h:55
write_location_context.h
data_dependency_contextt::abstract_object_merge_internal
abstract_object_pointert abstract_object_merge_internal(const abstract_object_pointert &other) const override
Helper function for abstract_objectt::abstract_object_merge to perform any additional actions after t...
Definition: data_dependency_context.cpp:308
data_dependency_contextt::location_ordert
Definition: data_dependency_context.h:85
CLONE
#define CLONE
Definition: abstract_object.h:41
data_dependency_contextt::data_deps
dependenciest data_deps
Definition: data_dependency_context.h:96
data_dependency_contextt::has_been_modified
bool has_been_modified(const abstract_object_pointert &before) const override
Determine whether 'this' abstract_object has been modified in comparison to a previous 'before' state...
Definition: data_dependency_context.cpp:28
data_dependency_contextt::data_dependency_contextt
data_dependency_contextt(const abstract_object_pointert child, const typet &type)
Definition: data_dependency_context.h:24
data_dependency_contextt::data_dependency_contextt
data_dependency_contextt(const abstract_object_pointert child, const typet &type, bool top, bool bottom)
Definition: data_dependency_context.h:31
data_dependency_contextt::combine
abstract_object_pointert combine(const data_dependency_context_ptrt &other, const data_dependency_context_ptrt &parent) const
Definition: data_dependency_context.cpp:260
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:90
data_dependency_contextt::dependenciest
std::set< goto_programt::const_targett, location_ordert > dependenciest
Definition: data_dependency_context.h:95
data_dependency_contextt::insert_data_deps
abstract_object_pointert insert_data_deps(const dependenciest &dependencies) const
Insert the given set of data dependencies into the data dependencies set for this data_dependency_con...
Definition: data_dependency_context.cpp:82
context_abstract_objectt::type
const typet & type() const override
Get the real type of the variable this abstract object is representing.
Definition: context_abstract_object.h:58
write_location_contextt
General implementation of an abstract_objectt which tracks the last written locations for a given abs...
Definition: write_location_context.h:34
context_abstract_objectt::context_abstract_object_ptrt
std::shared_ptr< context_abstract_objectt > context_abstract_object_ptrt
Definition: context_abstract_object.h:111
abstract_objectt::bottom
bool bottom
Definition: abstract_object.h:386
context_abstract_objectt::locationst
std::set< locationt > locationst
Definition: context_abstract_object.h:135
data_dependency_contextt
Definition: data_dependency_context.h:19
data_dependency_contextt::data_dominators
dependenciest data_dominators
Definition: data_dependency_context.h:97
data_dependency_contextt::set_data_deps
void set_data_deps(const locationst &locations)
Set the given set of data dependencies for from the locations.
Definition: data_dependency_context.cpp:146
data_dependency_contextt::get_data_dominators
std::set< goto_programt::const_targett > get_data_dominators() const
Return the set of data dominators associated with this node.
Definition: data_dependency_context.cpp:345
ai_baset
This is the basic interface of the abstract interpreter with default implementations of the core func...
Definition: ai.h:118
goto_programt::const_targett
instructionst::const_iterator const_targett
Definition: goto_program.h:587
abstract_objectt::top
bool top
Definition: abstract_object.h:387
data_dependency_contextt::update_location_context_internal
context_abstract_object_ptrt update_location_context_internal(const locationst &locations) const override
Definition: data_dependency_context.cpp:131
data_dependency_contextt::merge
abstract_object_pointert merge(const abstract_object_pointert &other, const widen_modet &widen_mode) const override
Create a new abstract object that is the result of merging this abstract object with a given abstract...
Definition: data_dependency_context.cpp:223
data_dependency_contextt::meet
abstract_object_pointert meet(const abstract_object_pointert &other) const override
Base implementation of the meet operation: only used if no more precise abstraction can be used,...
Definition: data_dependency_context.cpp:243