CBMC
data_dp.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: data dependencies
4 
5 Author: Vincent Nimal
6 
7 Date: 2012
8 
9 \*******************************************************************/
10 
13 
14 #ifndef CPROVER_GOTO_INSTRUMENT_WMM_DATA_DP_H
15 #define CPROVER_GOTO_INSTRUMENT_WMM_DATA_DP_H
16 
17 #include <set>
18 
19 #include <util/source_location.h>
20 
21 class abstract_eventt;
22 class messaget;
23 
24 struct datat
25 {
28  mutable unsigned eq_class;
29 
30  datat(irep_idt _id, source_locationt _loc, unsigned _eq_class)
31  : id(_id), loc(_loc), eq_class(_eq_class)
32  {
33  }
34 
36  : id(_id), loc(_loc), eq_class(0)
37  {
38  }
39 
40  bool operator==(const datat &d) const
41  {
42  return id==d.id && loc==d.loc;
43  }
44 
45  bool operator<(const datat &d2) const
46  {
47  return id<d2.id || (id==d2.id && loc<d2.loc);
48  }
49 };
50 
51 class data_dpt final
52 {
53  typedef std::set<datat> data_typet;
55  unsigned class_nb;
56 
57 public:
58  /* add this dependency in the structure */
59  void dp_analysis(const abstract_eventt &read, const abstract_eventt &write);
60  void dp_analysis(
61  const datat &read,
62  bool local_read,
63  const datat &write,
64  bool local_write);
65 
66  /* are these two events with a data dependency ? */
67  bool dp(const abstract_eventt &e1, const abstract_eventt &e2) const;
68 
69  /* routine to maintain partitioning */
70  void dp_merge();
71 
72  /* printing */
73  void print(messaget &message);
74 };
75 
76 #endif // CPROVER_GOTO_INSTRUMENT_WMM_DATA_DP_H
messaget
Class that provides messages with a built-in verbosity 'level'.
Definition: message.h:154
dstringt
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:36
data_dpt::dp_merge
void dp_merge()
merge in N^3
Definition: data_dp.cpp:121
datat::datat
datat(irep_idt _id, source_locationt _loc)
Definition: data_dp.h:35
datat::loc
source_locationt loc
Definition: data_dp.h:27
datat::operator<
bool operator<(const datat &d2) const
Definition: data_dp.h:45
data_dpt::data_typet
std::set< datat > data_typet
Definition: data_dp.h:53
datat::datat
datat(irep_idt _id, source_locationt _loc, unsigned _eq_class)
Definition: data_dp.h:30
datat::eq_class
unsigned eq_class
Definition: data_dp.h:28
data_dpt::data
data_typet data
Definition: data_dp.h:54
data_dpt::print
void print(messaget &message)
Definition: data_dp.cpp:164
datat::id
irep_idt id
Definition: data_dp.h:26
source_location.h
datat
Definition: data_dp.h:24
data_dpt::dp
bool dp(const abstract_eventt &e1, const abstract_eventt &e2) const
search in N^2
Definition: data_dp.cpp:76
abstract_eventt
Definition: abstract_event.h:22
source_locationt
Definition: source_location.h:18
data_dpt::class_nb
unsigned class_nb
Definition: data_dp.h:55
data_dpt::dp_analysis
void dp_analysis(const abstract_eventt &read, const abstract_eventt &write)
Definition: data_dp.cpp:66
data_dpt
Definition: data_dp.h:51
datat::operator==
bool operator==(const datat &d) const
Definition: data_dp.h:40