1 | /* |
2 | * Copyright 2010 INRIA Saclay |
3 | * Copyright 2014 Ecole Normale Superieure |
4 | * Copyright 2014 INRIA Rocquencourt |
5 | * |
6 | * Use of this software is governed by the MIT license |
7 | * |
8 | * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France, |
9 | * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod, |
10 | * 91893 Orsay, France |
11 | * and Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France |
12 | * and Inria Paris - Rocquencourt, Domaine de Voluceau - Rocquencourt, |
13 | * B.P. 105 - 78153 Le Chesnay, France |
14 | */ |
15 | |
16 | #include <isl/val.h> |
17 | #include <isl/aff.h> |
18 | #include <isl/set.h> |
19 | #include <isl/map.h> |
20 | #include <isl/union_set.h> |
21 | #include <isl/union_map.h> |
22 | #include <isl/polynomial.h> |
23 | #include <isl/schedule.h> |
24 | #include <isl/obj.h> |
25 | |
26 | static void *isl_obj_val_copy(void *v) |
27 | { |
28 | return isl_val_copy(v: (isl_val *)v); |
29 | } |
30 | |
31 | static void isl_obj_val_free(void *v) |
32 | { |
33 | isl_val_free(v: (isl_val *)v); |
34 | } |
35 | |
36 | static __isl_give isl_printer *isl_obj_val_print(__isl_take isl_printer *p, |
37 | void *v) |
38 | { |
39 | return isl_printer_print_val(p, v: (isl_val *)v); |
40 | } |
41 | |
42 | static void *isl_obj_val_add(void *v1, void *v2) |
43 | { |
44 | return isl_val_add(v1: (isl_val *) v1, v2: (isl_val *) v2); |
45 | } |
46 | |
47 | struct isl_obj_vtable isl_obj_val_vtable = { |
48 | isl_obj_val_copy, |
49 | isl_obj_val_add, |
50 | isl_obj_val_print, |
51 | isl_obj_val_free |
52 | }; |
53 | |
54 | static void *isl_obj_map_copy(void *v) |
55 | { |
56 | return isl_map_copy(map: (struct isl_map *)v); |
57 | } |
58 | |
59 | static void isl_obj_map_free(void *v) |
60 | { |
61 | isl_map_free(map: (struct isl_map *)v); |
62 | } |
63 | |
64 | static __isl_give isl_printer *isl_obj_map_print(__isl_take isl_printer *p, |
65 | void *v) |
66 | { |
67 | return isl_printer_print_map(printer: p, map: (struct isl_map *)v); |
68 | } |
69 | |
70 | static void *isl_obj_map_add(void *v1, void *v2) |
71 | { |
72 | return isl_map_union(map1: (struct isl_map *)v1, map2: (struct isl_map *)v2); |
73 | } |
74 | |
75 | struct isl_obj_vtable isl_obj_map_vtable = { |
76 | isl_obj_map_copy, |
77 | isl_obj_map_add, |
78 | isl_obj_map_print, |
79 | isl_obj_map_free |
80 | }; |
81 | |
82 | static void *isl_obj_union_map_copy(void *v) |
83 | { |
84 | return isl_union_map_copy(umap: (isl_union_map *)v); |
85 | } |
86 | |
87 | static void isl_obj_union_map_free(void *v) |
88 | { |
89 | isl_union_map_free(umap: (isl_union_map *)v); |
90 | } |
91 | |
92 | static __isl_give isl_printer *isl_obj_union_map_print(__isl_take isl_printer *p, |
93 | void *v) |
94 | { |
95 | return isl_printer_print_union_map(p, umap: (isl_union_map *)v); |
96 | } |
97 | |
98 | static void *isl_obj_union_map_add(void *v1, void *v2) |
99 | { |
100 | return isl_union_map_union(umap1: (isl_union_map *)v1, umap2: (isl_union_map *)v2); |
101 | } |
102 | |
103 | struct isl_obj_vtable isl_obj_union_map_vtable = { |
104 | isl_obj_union_map_copy, |
105 | isl_obj_union_map_add, |
106 | isl_obj_union_map_print, |
107 | isl_obj_union_map_free |
108 | }; |
109 | |
110 | static void *isl_obj_set_copy(void *v) |
111 | { |
112 | return isl_set_copy(set: (struct isl_set *)v); |
113 | } |
114 | |
115 | static void isl_obj_set_free(void *v) |
116 | { |
117 | isl_set_free(set: (struct isl_set *)v); |
118 | } |
119 | |
120 | static __isl_give isl_printer *isl_obj_set_print(__isl_take isl_printer *p, |
121 | void *v) |
122 | { |
123 | return isl_printer_print_set(printer: p, map: (struct isl_set *)v); |
124 | } |
125 | |
126 | static void *isl_obj_set_add(void *v1, void *v2) |
127 | { |
128 | return isl_set_union(set1: (struct isl_set *)v1, set2: (struct isl_set *)v2); |
129 | } |
130 | |
131 | struct isl_obj_vtable isl_obj_set_vtable = { |
132 | isl_obj_set_copy, |
133 | isl_obj_set_add, |
134 | isl_obj_set_print, |
135 | isl_obj_set_free |
136 | }; |
137 | |
138 | static void *isl_obj_union_set_copy(void *v) |
139 | { |
140 | return isl_union_set_copy(uset: (isl_union_set *)v); |
141 | } |
142 | |
143 | static void isl_obj_union_set_free(void *v) |
144 | { |
145 | isl_union_set_free(uset: (isl_union_set *)v); |
146 | } |
147 | |
148 | static __isl_give isl_printer *isl_obj_union_set_print(__isl_take isl_printer *p, |
149 | void *v) |
150 | { |
151 | return isl_printer_print_union_set(p, uset: (isl_union_set *)v); |
152 | } |
153 | |
154 | static void *isl_obj_union_set_add(void *v1, void *v2) |
155 | { |
156 | return isl_union_set_union(uset1: (isl_union_set *)v1, uset2: (isl_union_set *)v2); |
157 | } |
158 | |
159 | struct isl_obj_vtable isl_obj_union_set_vtable = { |
160 | isl_obj_union_set_copy, |
161 | isl_obj_union_set_add, |
162 | isl_obj_union_set_print, |
163 | isl_obj_union_set_free |
164 | }; |
165 | |
166 | static void *isl_obj_pw_multi_aff_copy(void *v) |
167 | { |
168 | return isl_pw_multi_aff_copy(pma: (isl_pw_multi_aff *) v); |
169 | } |
170 | |
171 | static void isl_obj_pw_multi_aff_free(void *v) |
172 | { |
173 | isl_pw_multi_aff_free(pma: (isl_pw_multi_aff *) v); |
174 | } |
175 | |
176 | static __isl_give isl_printer *isl_obj_pw_multi_aff_print( |
177 | __isl_take isl_printer *p, void *v) |
178 | { |
179 | return isl_printer_print_pw_multi_aff(p, pma: (isl_pw_multi_aff *) v); |
180 | } |
181 | |
182 | static void *isl_obj_pw_multi_aff_add(void *v1, void *v2) |
183 | { |
184 | return isl_pw_multi_aff_add(pma1: (isl_pw_multi_aff *) v1, |
185 | pma2: (isl_pw_multi_aff *) v2); |
186 | } |
187 | |
188 | struct isl_obj_vtable isl_obj_pw_multi_aff_vtable = { |
189 | isl_obj_pw_multi_aff_copy, |
190 | isl_obj_pw_multi_aff_add, |
191 | isl_obj_pw_multi_aff_print, |
192 | isl_obj_pw_multi_aff_free |
193 | }; |
194 | |
195 | static void *isl_obj_none_copy(void *v) |
196 | { |
197 | return v; |
198 | } |
199 | |
200 | static void isl_obj_none_free(void *v) |
201 | { |
202 | } |
203 | |
204 | static __isl_give isl_printer *isl_obj_none_print(__isl_take isl_printer *p, |
205 | void *v) |
206 | { |
207 | return p; |
208 | } |
209 | |
210 | static void *isl_obj_none_add(void *v1, void *v2) |
211 | { |
212 | return NULL; |
213 | } |
214 | |
215 | struct isl_obj_vtable isl_obj_none_vtable = { |
216 | isl_obj_none_copy, |
217 | isl_obj_none_add, |
218 | isl_obj_none_print, |
219 | isl_obj_none_free |
220 | }; |
221 | |
222 | static void *isl_obj_pw_qp_copy(void *v) |
223 | { |
224 | return isl_pw_qpolynomial_copy(pwqp: (struct isl_pw_qpolynomial *)v); |
225 | } |
226 | |
227 | static void isl_obj_pw_qp_free(void *v) |
228 | { |
229 | isl_pw_qpolynomial_free(pwqp: (struct isl_pw_qpolynomial *)v); |
230 | } |
231 | |
232 | static __isl_give isl_printer *isl_obj_pw_qp_print(__isl_take isl_printer *p, |
233 | void *v) |
234 | { |
235 | return isl_printer_print_pw_qpolynomial(p, |
236 | pwqp: (struct isl_pw_qpolynomial *)v); |
237 | } |
238 | |
239 | static void *isl_obj_pw_qp_add(void *v1, void *v2) |
240 | { |
241 | return isl_pw_qpolynomial_add(pwqp1: (struct isl_pw_qpolynomial *)v1, |
242 | pwqp2: (struct isl_pw_qpolynomial *)v2); |
243 | } |
244 | |
245 | struct isl_obj_vtable isl_obj_pw_qpolynomial_vtable = { |
246 | isl_obj_pw_qp_copy, |
247 | isl_obj_pw_qp_add, |
248 | isl_obj_pw_qp_print, |
249 | isl_obj_pw_qp_free |
250 | }; |
251 | |
252 | static void *isl_obj_union_pw_qp_copy(void *v) |
253 | { |
254 | return isl_union_pw_qpolynomial_copy(upwqp: (struct isl_union_pw_qpolynomial *)v); |
255 | } |
256 | |
257 | static void isl_obj_union_pw_qp_free(void *v) |
258 | { |
259 | isl_union_pw_qpolynomial_free(upwqp: (struct isl_union_pw_qpolynomial *)v); |
260 | } |
261 | |
262 | static __isl_give isl_printer *isl_obj_union_pw_qp_print( |
263 | __isl_take isl_printer *p, void *v) |
264 | { |
265 | return isl_printer_print_union_pw_qpolynomial(p, |
266 | upwqp: (struct isl_union_pw_qpolynomial *)v); |
267 | } |
268 | |
269 | static void *isl_obj_union_pw_qp_add(void *v1, void *v2) |
270 | { |
271 | return isl_union_pw_qpolynomial_add( |
272 | upwqp1: (struct isl_union_pw_qpolynomial *)v1, |
273 | upwqp2: (struct isl_union_pw_qpolynomial *)v2); |
274 | } |
275 | |
276 | struct isl_obj_vtable isl_obj_union_pw_qpolynomial_vtable = { |
277 | isl_obj_union_pw_qp_copy, |
278 | isl_obj_union_pw_qp_add, |
279 | isl_obj_union_pw_qp_print, |
280 | isl_obj_union_pw_qp_free |
281 | }; |
282 | |
283 | static void *isl_obj_pw_qpf_copy(void *v) |
284 | { |
285 | return isl_pw_qpolynomial_fold_copy(pwf: (struct isl_pw_qpolynomial_fold *)v); |
286 | } |
287 | |
288 | static void isl_obj_pw_qpf_free(void *v) |
289 | { |
290 | isl_pw_qpolynomial_fold_free(pwf: (struct isl_pw_qpolynomial_fold *)v); |
291 | } |
292 | |
293 | static __isl_give isl_printer *isl_obj_pw_qpf_print(__isl_take isl_printer *p, |
294 | void *v) |
295 | { |
296 | return isl_printer_print_pw_qpolynomial_fold(p, |
297 | pwf: (struct isl_pw_qpolynomial_fold *)v); |
298 | } |
299 | |
300 | static void *isl_obj_pw_qpf_add(void *v1, void *v2) |
301 | { |
302 | return isl_pw_qpolynomial_fold_fold(pwf1: (struct isl_pw_qpolynomial_fold *)v1, |
303 | pwf2: (struct isl_pw_qpolynomial_fold *)v2); |
304 | } |
305 | |
306 | struct isl_obj_vtable isl_obj_pw_qpolynomial_fold_vtable = { |
307 | isl_obj_pw_qpf_copy, |
308 | isl_obj_pw_qpf_add, |
309 | isl_obj_pw_qpf_print, |
310 | isl_obj_pw_qpf_free |
311 | }; |
312 | |
313 | static void *isl_obj_union_pw_qpf_copy(void *v) |
314 | { |
315 | return isl_union_pw_qpolynomial_fold_copy(upwf: (struct isl_union_pw_qpolynomial_fold *)v); |
316 | } |
317 | |
318 | static void isl_obj_union_pw_qpf_free(void *v) |
319 | { |
320 | isl_union_pw_qpolynomial_fold_free(upwf: (struct isl_union_pw_qpolynomial_fold *)v); |
321 | } |
322 | |
323 | static __isl_give isl_printer *isl_obj_union_pw_qpf_print( |
324 | __isl_take isl_printer *p, void *v) |
325 | { |
326 | return isl_printer_print_union_pw_qpolynomial_fold(p, |
327 | upwf: (struct isl_union_pw_qpolynomial_fold *)v); |
328 | } |
329 | |
330 | static void *isl_obj_union_pw_qpf_add(void *v1, void *v2) |
331 | { |
332 | return isl_union_pw_qpolynomial_fold_fold( |
333 | upwf1: (struct isl_union_pw_qpolynomial_fold *)v1, |
334 | upwf2: (struct isl_union_pw_qpolynomial_fold *)v2); |
335 | } |
336 | |
337 | struct isl_obj_vtable isl_obj_union_pw_qpolynomial_fold_vtable = { |
338 | isl_obj_union_pw_qpf_copy, |
339 | isl_obj_union_pw_qpf_add, |
340 | isl_obj_union_pw_qpf_print, |
341 | isl_obj_union_pw_qpf_free |
342 | }; |
343 | |
344 | static void *isl_obj_schedule_copy(void *v) |
345 | { |
346 | return isl_schedule_copy(sched: (isl_schedule *) v); |
347 | } |
348 | |
349 | static void isl_obj_schedule_free(void *v) |
350 | { |
351 | isl_schedule_free(sched: (isl_schedule *) v); |
352 | } |
353 | |
354 | static __isl_give isl_printer *isl_obj_schedule_print( |
355 | __isl_take isl_printer *p, void *v) |
356 | { |
357 | return isl_printer_print_schedule(p, schedule: (isl_schedule *) v); |
358 | } |
359 | |
360 | struct isl_obj_vtable isl_obj_schedule_vtable = { |
361 | isl_obj_schedule_copy, |
362 | NULL, |
363 | isl_obj_schedule_print, |
364 | isl_obj_schedule_free |
365 | }; |
366 | |