add isl_mat_get_hash
[isl.git] / isl_obj.c
blobe12035fcf8dcb4eb4c02a3cdc13fc4ccf79e3490
1 /*
2 * Copyright 2010 INRIA Saclay
3 * Copyright 2014 Ecole Normale Superieure
4 * Copyright 2014 INRIA Rocquencourt
6 * Use of this software is governed by the MIT license
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
16 #include <isl/aff.h>
17 #include <isl/set.h>
18 #include <isl/map.h>
19 #include <isl/union_set.h>
20 #include <isl/union_map.h>
21 #include <isl/polynomial.h>
22 #include <isl/schedule.h>
23 #include <isl/obj.h>
25 static void *isl_obj_val_copy(void *v)
27 return isl_val_copy((isl_val *)v);
30 static void isl_obj_val_free(void *v)
32 isl_val_free((isl_val *)v);
35 static __isl_give isl_printer *isl_obj_val_print(__isl_take isl_printer *p,
36 void *v)
38 return isl_printer_print_val(p, (isl_val *)v);
41 static void *isl_obj_val_add(void *v1, void *v2)
43 return isl_val_add((isl_val *) v1, (isl_val *) v2);
46 struct isl_obj_vtable isl_obj_val_vtable = {
47 isl_obj_val_copy,
48 isl_obj_val_add,
49 isl_obj_val_print,
50 isl_obj_val_free
53 static void *isl_obj_map_copy(void *v)
55 return isl_map_copy((struct isl_map *)v);
58 static void isl_obj_map_free(void *v)
60 isl_map_free((struct isl_map *)v);
63 static __isl_give isl_printer *isl_obj_map_print(__isl_take isl_printer *p,
64 void *v)
66 return isl_printer_print_map(p, (struct isl_map *)v);
69 static void *isl_obj_map_add(void *v1, void *v2)
71 return isl_map_union((struct isl_map *)v1, (struct isl_map *)v2);
74 struct isl_obj_vtable isl_obj_map_vtable = {
75 isl_obj_map_copy,
76 isl_obj_map_add,
77 isl_obj_map_print,
78 isl_obj_map_free
81 static void *isl_obj_union_map_copy(void *v)
83 return isl_union_map_copy((isl_union_map *)v);
86 static void isl_obj_union_map_free(void *v)
88 isl_union_map_free((isl_union_map *)v);
91 static __isl_give isl_printer *isl_obj_union_map_print(__isl_take isl_printer *p,
92 void *v)
94 return isl_printer_print_union_map(p, (isl_union_map *)v);
97 static void *isl_obj_union_map_add(void *v1, void *v2)
99 return isl_union_map_union((isl_union_map *)v1, (isl_union_map *)v2);
102 struct isl_obj_vtable isl_obj_union_map_vtable = {
103 isl_obj_union_map_copy,
104 isl_obj_union_map_add,
105 isl_obj_union_map_print,
106 isl_obj_union_map_free
109 static void *isl_obj_set_copy(void *v)
111 return isl_set_copy((struct isl_set *)v);
114 static void isl_obj_set_free(void *v)
116 isl_set_free((struct isl_set *)v);
119 static __isl_give isl_printer *isl_obj_set_print(__isl_take isl_printer *p,
120 void *v)
122 return isl_printer_print_set(p, (struct isl_set *)v);
125 static void *isl_obj_set_add(void *v1, void *v2)
127 return isl_set_union((struct isl_set *)v1, (struct isl_set *)v2);
130 struct isl_obj_vtable isl_obj_set_vtable = {
131 isl_obj_set_copy,
132 isl_obj_set_add,
133 isl_obj_set_print,
134 isl_obj_set_free
137 static void *isl_obj_union_set_copy(void *v)
139 return isl_union_set_copy((isl_union_set *)v);
142 static void isl_obj_union_set_free(void *v)
144 isl_union_set_free((isl_union_set *)v);
147 static __isl_give isl_printer *isl_obj_union_set_print(__isl_take isl_printer *p,
148 void *v)
150 return isl_printer_print_union_set(p, (isl_union_set *)v);
153 static void *isl_obj_union_set_add(void *v1, void *v2)
155 return isl_union_set_union((isl_union_set *)v1, (isl_union_set *)v2);
158 struct isl_obj_vtable isl_obj_union_set_vtable = {
159 isl_obj_union_set_copy,
160 isl_obj_union_set_add,
161 isl_obj_union_set_print,
162 isl_obj_union_set_free
165 static void *isl_obj_pw_multi_aff_copy(void *v)
167 return isl_pw_multi_aff_copy((isl_pw_multi_aff *) v);
170 static void isl_obj_pw_multi_aff_free(void *v)
172 isl_pw_multi_aff_free((isl_pw_multi_aff *) v);
175 static __isl_give isl_printer *isl_obj_pw_multi_aff_print(
176 __isl_take isl_printer *p, void *v)
178 return isl_printer_print_pw_multi_aff(p, (isl_pw_multi_aff *) v);
181 static void *isl_obj_pw_multi_aff_add(void *v1, void *v2)
183 return isl_pw_multi_aff_add((isl_pw_multi_aff *) v1,
184 (isl_pw_multi_aff *) v2);
187 struct isl_obj_vtable isl_obj_pw_multi_aff_vtable = {
188 isl_obj_pw_multi_aff_copy,
189 isl_obj_pw_multi_aff_add,
190 isl_obj_pw_multi_aff_print,
191 isl_obj_pw_multi_aff_free
194 static void *isl_obj_none_copy(void *v)
196 return v;
199 static void isl_obj_none_free(void *v)
203 static __isl_give isl_printer *isl_obj_none_print(__isl_take isl_printer *p,
204 void *v)
206 return p;
209 static void *isl_obj_none_add(void *v1, void *v2)
211 return NULL;
214 struct isl_obj_vtable isl_obj_none_vtable = {
215 isl_obj_none_copy,
216 isl_obj_none_add,
217 isl_obj_none_print,
218 isl_obj_none_free
221 static void *isl_obj_pw_qp_copy(void *v)
223 return isl_pw_qpolynomial_copy((struct isl_pw_qpolynomial *)v);
226 static void isl_obj_pw_qp_free(void *v)
228 isl_pw_qpolynomial_free((struct isl_pw_qpolynomial *)v);
231 static __isl_give isl_printer *isl_obj_pw_qp_print(__isl_take isl_printer *p,
232 void *v)
234 return isl_printer_print_pw_qpolynomial(p,
235 (struct isl_pw_qpolynomial *)v);
238 static void *isl_obj_pw_qp_add(void *v1, void *v2)
240 return isl_pw_qpolynomial_add((struct isl_pw_qpolynomial *)v1,
241 (struct isl_pw_qpolynomial *)v2);
244 struct isl_obj_vtable isl_obj_pw_qpolynomial_vtable = {
245 isl_obj_pw_qp_copy,
246 isl_obj_pw_qp_add,
247 isl_obj_pw_qp_print,
248 isl_obj_pw_qp_free
251 static void *isl_obj_union_pw_qp_copy(void *v)
253 return isl_union_pw_qpolynomial_copy((struct isl_union_pw_qpolynomial *)v);
256 static void isl_obj_union_pw_qp_free(void *v)
258 isl_union_pw_qpolynomial_free((struct isl_union_pw_qpolynomial *)v);
261 static __isl_give isl_printer *isl_obj_union_pw_qp_print(
262 __isl_take isl_printer *p, void *v)
264 return isl_printer_print_union_pw_qpolynomial(p,
265 (struct isl_union_pw_qpolynomial *)v);
268 static void *isl_obj_union_pw_qp_add(void *v1, void *v2)
270 return isl_union_pw_qpolynomial_add(
271 (struct isl_union_pw_qpolynomial *)v1,
272 (struct isl_union_pw_qpolynomial *)v2);
275 struct isl_obj_vtable isl_obj_union_pw_qpolynomial_vtable = {
276 isl_obj_union_pw_qp_copy,
277 isl_obj_union_pw_qp_add,
278 isl_obj_union_pw_qp_print,
279 isl_obj_union_pw_qp_free
282 static void *isl_obj_pw_qpf_copy(void *v)
284 return isl_pw_qpolynomial_fold_copy((struct isl_pw_qpolynomial_fold *)v);
287 static void isl_obj_pw_qpf_free(void *v)
289 isl_pw_qpolynomial_fold_free((struct isl_pw_qpolynomial_fold *)v);
292 static __isl_give isl_printer *isl_obj_pw_qpf_print(__isl_take isl_printer *p,
293 void *v)
295 return isl_printer_print_pw_qpolynomial_fold(p,
296 (struct isl_pw_qpolynomial_fold *)v);
299 static void *isl_obj_pw_qpf_add(void *v1, void *v2)
301 return isl_pw_qpolynomial_fold_fold((struct isl_pw_qpolynomial_fold *)v1,
302 (struct isl_pw_qpolynomial_fold *)v2);
305 struct isl_obj_vtable isl_obj_pw_qpolynomial_fold_vtable = {
306 isl_obj_pw_qpf_copy,
307 isl_obj_pw_qpf_add,
308 isl_obj_pw_qpf_print,
309 isl_obj_pw_qpf_free
312 static void *isl_obj_union_pw_qpf_copy(void *v)
314 return isl_union_pw_qpolynomial_fold_copy((struct isl_union_pw_qpolynomial_fold *)v);
317 static void isl_obj_union_pw_qpf_free(void *v)
319 isl_union_pw_qpolynomial_fold_free((struct isl_union_pw_qpolynomial_fold *)v);
322 static __isl_give isl_printer *isl_obj_union_pw_qpf_print(
323 __isl_take isl_printer *p, void *v)
325 return isl_printer_print_union_pw_qpolynomial_fold(p,
326 (struct isl_union_pw_qpolynomial_fold *)v);
329 static void *isl_obj_union_pw_qpf_add(void *v1, void *v2)
331 return isl_union_pw_qpolynomial_fold_fold(
332 (struct isl_union_pw_qpolynomial_fold *)v1,
333 (struct isl_union_pw_qpolynomial_fold *)v2);
336 struct isl_obj_vtable isl_obj_union_pw_qpolynomial_fold_vtable = {
337 isl_obj_union_pw_qpf_copy,
338 isl_obj_union_pw_qpf_add,
339 isl_obj_union_pw_qpf_print,
340 isl_obj_union_pw_qpf_free
343 static void *isl_obj_schedule_copy(void *v)
345 return isl_schedule_copy((isl_schedule *) v);
348 static void isl_obj_schedule_free(void *v)
350 isl_schedule_free((isl_schedule *) v);
353 static __isl_give isl_printer *isl_obj_schedule_print(
354 __isl_take isl_printer *p, void *v)
356 return isl_printer_print_schedule(p, (isl_schedule *) v);
359 struct isl_obj_vtable isl_obj_schedule_vtable = {
360 isl_obj_schedule_copy,
361 NULL,
362 isl_obj_schedule_print,
363 isl_obj_schedule_free