not needed
[prop.git] / prop-src / graphtype.h
blob367ba66f77be6024c43ba7742f3bd2a5646d191e
1 ///////////////////////////////////////////////////////////////////////////////
2 // This file is generated automatically using Prop (version 2.3.6),
3 // last updated on Nov 2, 1999.
4 // The original source file is "graphtype.ph".
5 ///////////////////////////////////////////////////////////////////////////////
7 #line 1 "graphtype.ph"
8 ///////////////////////////////////////////////////////////////////////////////
9 //
10 // This file implements the graph type generator
12 ///////////////////////////////////////////////////////////////////////////////
13 #ifndef graph_type_generator_h
14 #define graph_type_generator_h
16 #include "basics.h"
17 #include "ir.h"
18 #include "ast.h"
19 #include "codegen.h"
20 #include "classdef.h"
22 ///////////////////////////////////////////////////////////////////////////////
24 // Forward type definitions
26 ///////////////////////////////////////////////////////////////////////////////
27 class NodeDef;
28 class EdgeDef;
29 class GraphTypeDef;
31 #line 24 "graphtype.ph"
32 #line 26 "graphtype.ph"
33 ///////////////////////////////////////////////////////////////////////////////
34 // Definition of type NodeDefs
35 ///////////////////////////////////////////////////////////////////////////////
36 #line 24 "graphtype.ph"
37 typedef a_List<NodeDef *> * NodeDefs;
39 ///////////////////////////////////////////////////////////////////////////////
40 // Definition of type EdgeDefs
41 ///////////////////////////////////////////////////////////////////////////////
42 #line 25 "graphtype.ph"
43 typedef a_List<EdgeDef *> * EdgeDefs;
45 #line 26 "graphtype.ph"
46 #line 26 "graphtype.ph"
49 ///////////////////////////////////////////////////////////////////////////////
51 // Indexing options of graph types
53 ///////////////////////////////////////////////////////////////////////////////
54 enum { NOindex = 0,
55 DOMindex = 1<<0, // index on domain
56 RANindex = 1<<1, // index on range
57 COUNTindex = 1<<2, // counting index
58 FORWARDindex = 1<<3, // map from domain to range
59 INVERSEindex = 1<<4, // map from range to domain
60 BITMAPindex = 1<<5, // use bitmaps to represent index
61 UNIONFINDindex = 1<<6 // use union/find to represent index
64 enum { UNBASEDrep = 0, // unbased
65 WEAKLYBASEDrep = 1<<1, // weakly based
66 STRONGLYBASEDrep = 1<<2, // strongly based
67 TABLEDrep = 1<<3 // also allow address arithmetic on base
70 enum { NOgop = 0, // no operations
71 SIZEgop = 1<<0, // # f
72 DOMgop = 1<<1, // dom f
73 RANgop = 1<<2, // ran f
74 DOMSIZEgop = 1<<3, // # dom f
75 RANSIZEgop = 1<<4, // # ran f
76 IMAGEgop = 1<<5, // f(x)
77 IMAGESETgop = 1<<6, // f{x}
78 REVIMAGEgop = 1<<7, // (inv f)(x)
79 REVIMAGEMAPgop = 1<<8, // (inv f){x}
80 UNIONgop = 1<<9, // f union := g
81 BITSETgop = 1<<10, // bitvector operations
82 UNIONFINDgop = 1<<11, // union find operations
83 INDOMgop = 1<<12, // x in dom f
84 INRANgop = 1<<13, // x in ran f
85 INgop = 1<<14, // x in f
86 UPDATEIMAGEgop = 1<<15 // f(x) := y or f{x} with := y
89 #line 68 "graphtype.ph"
90 #line 68 "graphtype.ph"
91 ///////////////////////////////////////////////////////////////////////////////
92 // Definition of type GraphIndexing
93 ///////////////////////////////////////////////////////////////////////////////
94 #line 68 "graphtype.ph"
95 typedef int GraphIndexing;
97 #line 68 "graphtype.ph"
98 #line 68 "graphtype.ph"
100 #line 69 "graphtype.ph"
101 #line 69 "graphtype.ph"
102 ///////////////////////////////////////////////////////////////////////////////
103 // Definition of type GraphOps
104 ///////////////////////////////////////////////////////////////////////////////
105 #line 69 "graphtype.ph"
106 typedef int GraphOps;
108 #line 69 "graphtype.ph"
109 #line 69 "graphtype.ph"
111 #line 70 "graphtype.ph"
112 #line 70 "graphtype.ph"
113 ///////////////////////////////////////////////////////////////////////////////
114 // Definition of type GraphRep
115 ///////////////////////////////////////////////////////////////////////////////
116 #line 70 "graphtype.ph"
117 typedef int GraphRep;
119 #line 70 "graphtype.ph"
120 #line 70 "graphtype.ph"
123 ///////////////////////////////////////////////////////////////////////////////
125 // Class to represent a graph type definition.
127 ///////////////////////////////////////////////////////////////////////////////
128 class GraphTypeDef : public ClassDefinition
129 { GraphTypeDef(const GraphTypeDef&);
130 void operator = (const GraphTypeDef&);
131 protected:
132 friend class NodeDef;
133 friend class EdgeDef;
134 NodeDefs node_defs;
135 EdgeDefs edge_defs;
136 public:
137 GraphTypeDef(Id name, Inherits, TyQual,
138 NodeDefs=
139 #line 87 "graphtype.ph"
140 #line 87 "graphtype.ph"
141 nil_1_
142 #line 87 "graphtype.ph"
143 #line 87 "graphtype.ph"
144 , EdgeDefs=
145 #line 87 "graphtype.ph"
146 #line 87 "graphtype.ph"
147 nil_1_
148 #line 87 "graphtype.ph"
149 #line 87 "graphtype.ph"
150 , Decls=
151 #line 87 "graphtype.ph"
152 #line 87 "graphtype.ph"
153 nil_1_
154 #line 87 "graphtype.ph"
155 #line 87 "graphtype.ph"
157 virtual ~GraphTypeDef();
159 virtual NodeDef * lookup_node (Id);
160 virtual EdgeDef * lookup_edge (Id);
161 virtual void choose_representation();
162 virtual void print_report(CodeGen&);
163 void set_nodes (NodeDefs);
164 void set_edges (EdgeDefs);
165 void set_body (Decls);
166 protected:
167 virtual void gen_class_predefinition (CodeGen&);
168 virtual void gen_class_interface (CodeGen&);
169 virtual void gen_class_implementation (CodeGen&);
170 void gen_init_graph(CodeGen&);
171 void gen_lookup_node(CodeGen&);
172 void gen_insert_node(CodeGen&);
173 void gen_remove_node(CodeGen&);
176 ///////////////////////////////////////////////////////////////////////////////
178 // Class to represent a node definition.
180 ///////////////////////////////////////////////////////////////////////////////
181 class NodeDef : public Loc
182 { NodeDef(const NodeDef&);
183 void operator = (const NodeDef&);
184 protected:
185 friend class GraphTypeDef;
186 friend class EdgeDef;
187 GraphTypeDef * G; // the parent graph
188 Id node_name; // name of this node
189 Ty node_type; // node label is a value from this type
190 Id hash_fun; // hash function
191 Id eq_fun; // equality function
192 LabTys attributes; // additional attributes
193 GraphRep rep; // representation of this domain
194 public:
195 NodeDef(GraphTypeDef *, Id, Ty = NOty, Id = 0, Id = 0, LabTys =
196 #line 126 "graphtype.ph"
197 #line 126 "graphtype.ph"
198 nil_1_
199 #line 126 "graphtype.ph"
200 #line 126 "graphtype.ph"
202 virtual ~NodeDef();
204 inline Id name () const { return node_name; }
205 inline GraphTypeDef * graph () const { return G; }
206 virtual void choose_representation();
207 virtual void generate_forward_decls (CodeGen&);
208 virtual void generate_representation (CodeGen&);
209 virtual void generate_interface (CodeGen&);
210 virtual void generate_implementation (CodeGen&);
211 virtual void print_report(CodeGen&);
214 ///////////////////////////////////////////////////////////////////////////////
216 // Class to represent an edge definition.
218 ///////////////////////////////////////////////////////////////////////////////
219 class EdgeDef : public Loc
220 { EdgeDef(const EdgeDef&);
221 void operator = (const EdgeDef&);
222 protected:
223 friend class GraphTypeDef;
224 friend class NodeDef;
225 GraphTypeDef * graph; // our graph
226 Id edge_name; // name of this edge
227 NodeDef* domain_type; // domain of this type
228 NodeDef* range_type; // range of this type
229 GraphIndexing indexing; // indexing information
230 LabTys attributes; // additional attributes
231 GraphOps ops; // defined operations
233 protected:
234 EdgeDef(GraphTypeDef *, Id, NodeDef*, NodeDef*,
235 GraphIndexing, LabTys =
236 #line 160 "graphtype.ph"
237 #line 160 "graphtype.ph"
238 nil_1_
239 #line 160 "graphtype.ph"
240 #line 160 "graphtype.ph"
242 virtual ~EdgeDef();
243 public:
245 inline Id name () const { return edge_name; }
246 virtual void choose_representation ();
247 virtual void generate_node_representation (CodeGen&, NodeDef *);
248 virtual void generate_edge_representation (CodeGen&);
249 virtual void generate_interface (CodeGen&);
250 virtual void generate_implementation (CodeGen&);
251 virtual void print_report(CodeGen&);
253 protected:
255 virtual void generate_edge_rep(CodeGen&);
256 virtual void generate_dom_rep (CodeGen&);
257 virtual void generate_ran_rep (CodeGen&);
258 virtual void generate_interf (CodeGen&);
259 virtual void generate_impl (CodeGen&);
261 ////////////////////////////////////////////////////////////////////////////
263 // Methods to generate various methods to implement various set operations
265 ////////////////////////////////////////////////////////////////////////////
266 virtual void gen_dom (CodeGen&); // dom f
267 virtual void gen_ran (CodeGen&); // ran f
268 virtual void gen_in_dom (CodeGen&); // x in dom f
269 virtual void gen_in_ran (CodeGen&); // x in ran f
270 virtual void gen_in (CodeGen&) = 0; // x in f
271 virtual void gen_size (CodeGen&); // # f
272 virtual void gen_dom_size (CodeGen&); // # dom f
273 virtual void gen_ran_size (CodeGen&); // # ran f
274 virtual void gen_image (CodeGen&); // f(x) or f{x}
275 virtual void gen_update_image(CodeGen&); // f(x) := y or f{x} with := y
278 #endif
279 #line 198 "graphtype.ph"
281 ------------------------------- Statistics -------------------------------
282 Merge matching rules = yes
283 Number of DFA nodes merged = 0
284 Number of ifs generated = 0
285 Number of switches generated = 0
286 Number of labels = 0
287 Number of gotos = 0
288 Adaptive matching = enabled
289 Fast string matching = disabled
290 Inline downcasts = enabled
291 --------------------------------------------------------------------------