@@ -20,56 +20,6 @@ Date: August 2013
20
20
21
21
class dependence_grapht ;
22
22
23
- class dep_graph_domaint :public ai_domain_baset
24
- {
25
- public:
26
- dep_graph_domaint ():node_id((unsigned )-1 )
27
- {
28
- }
29
-
30
- bool merge (
31
- const dep_graph_domaint &src,
32
- goto_programt::const_targett from,
33
- goto_programt::const_targett to);
34
-
35
- void transform (
36
- goto_programt::const_targett from,
37
- goto_programt::const_targett to,
38
- ai_baset &ai,
39
- const namespacet &ns);
40
-
41
- virtual void output (
42
- std::ostream &out,
43
- const ai_baset &ai,
44
- const namespacet &ns) const ;
45
-
46
- void set_node_id (unsigned id)
47
- {
48
- node_id=id;
49
- }
50
-
51
- unsigned get_node_id () const
52
- {
53
- return node_id;
54
- }
55
-
56
- protected:
57
- unsigned node_id;
58
-
59
- typedef std::set<goto_programt::const_targett> depst;
60
- depst control_deps, data_deps;
61
-
62
- void control_dependencies (
63
- goto_programt::const_targett from,
64
- goto_programt::const_targett to,
65
- dependence_grapht &dep_graph);
66
- void data_dependencies (
67
- goto_programt::const_targett from,
68
- goto_programt::const_targett to,
69
- dependence_grapht &dep_graph,
70
- const namespacet &ns);
71
- };
72
-
73
23
class dep_edget
74
24
{
75
25
public:
@@ -114,6 +64,76 @@ struct dep_nodet:public graph_nodet<dep_edget>
114
64
goto_programt::const_targett PC;
115
65
};
116
66
67
+ class dep_graph_domaint :public ai_domain_baset
68
+ {
69
+ public:
70
+ typedef graph<dep_nodet>::node_indext node_indext;
71
+
72
+ dep_graph_domaint ():
73
+ node_id (std::numeric_limits<node_indext>::max())
74
+ {
75
+ }
76
+
77
+ bool merge (
78
+ const dep_graph_domaint &src,
79
+ goto_programt::const_targett from,
80
+ goto_programt::const_targett to);
81
+
82
+ void transform (
83
+ goto_programt::const_targett from,
84
+ goto_programt::const_targett to,
85
+ ai_baset &ai,
86
+ const namespacet &ns) final override ;
87
+
88
+ void output (
89
+ std::ostream &out,
90
+ const ai_baset &ai,
91
+ const namespacet &ns) const final override ;
92
+
93
+ void make_top () final override
94
+ {
95
+ node_id=std::numeric_limits<node_indext>::max ();
96
+ }
97
+
98
+ void make_bottom () final override
99
+ {
100
+ node_id=std::numeric_limits<node_indext>::max ();
101
+ }
102
+
103
+ void make_entry () final override
104
+ {
105
+ node_id=std::numeric_limits<node_indext>::max ();
106
+ }
107
+
108
+ void set_node_id (node_indext id)
109
+ {
110
+ node_id=id;
111
+ }
112
+
113
+ node_indext get_node_id () const
114
+ {
115
+ assert (node_id!=std::numeric_limits<node_indext>::max ());
116
+ return node_id;
117
+ }
118
+
119
+ protected:
120
+ node_indext node_id;
121
+
122
+ typedef std::set<goto_programt::const_targett> depst;
123
+ depst control_deps, data_deps;
124
+
125
+ void control_dependencies (
126
+ goto_programt::const_targett from,
127
+ goto_programt::const_targett to,
128
+ dependence_grapht &dep_graph);
129
+
130
+ void data_dependencies (
131
+ goto_programt::const_targett from,
132
+ goto_programt::const_targett to,
133
+ dependence_grapht &dep_graph,
134
+ const namespacet &ns);
135
+ };
136
+
117
137
class dependence_grapht :
118
138
public ait<dep_graph_domaint>,
119
139
public graph<dep_nodet>
@@ -161,7 +181,7 @@ class dependence_grapht:
161
181
162
182
if (entry.second )
163
183
{
164
- const unsigned node_id=add_node ();
184
+ const node_indext node_id=add_node ();
165
185
entry.first ->second .set_node_id (node_id);
166
186
nodes[node_id].PC =l;
167
187
}
0 commit comments