isl_obj.c 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  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. #include <isl/val.h>
  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>
  24. static void *isl_obj_val_copy(void *v)
  25. {
  26. return isl_val_copy((isl_val *)v);
  27. }
  28. static void isl_obj_val_free(void *v)
  29. {
  30. isl_val_free((isl_val *)v);
  31. }
  32. static __isl_give isl_printer *isl_obj_val_print(__isl_take isl_printer *p,
  33. void *v)
  34. {
  35. return isl_printer_print_val(p, (isl_val *)v);
  36. }
  37. static void *isl_obj_val_add(void *v1, void *v2)
  38. {
  39. return isl_val_add((isl_val *) v1, (isl_val *) v2);
  40. }
  41. struct isl_obj_vtable isl_obj_val_vtable = {
  42. isl_obj_val_copy,
  43. isl_obj_val_add,
  44. isl_obj_val_print,
  45. isl_obj_val_free
  46. };
  47. static void *isl_obj_map_copy(void *v)
  48. {
  49. return isl_map_copy((struct isl_map *)v);
  50. }
  51. static void isl_obj_map_free(void *v)
  52. {
  53. isl_map_free((struct isl_map *)v);
  54. }
  55. static __isl_give isl_printer *isl_obj_map_print(__isl_take isl_printer *p,
  56. void *v)
  57. {
  58. return isl_printer_print_map(p, (struct isl_map *)v);
  59. }
  60. static void *isl_obj_map_add(void *v1, void *v2)
  61. {
  62. return isl_map_union((struct isl_map *)v1, (struct isl_map *)v2);
  63. }
  64. struct isl_obj_vtable isl_obj_map_vtable = {
  65. isl_obj_map_copy,
  66. isl_obj_map_add,
  67. isl_obj_map_print,
  68. isl_obj_map_free
  69. };
  70. static void *isl_obj_union_map_copy(void *v)
  71. {
  72. return isl_union_map_copy((isl_union_map *)v);
  73. }
  74. static void isl_obj_union_map_free(void *v)
  75. {
  76. isl_union_map_free((isl_union_map *)v);
  77. }
  78. static __isl_give isl_printer *isl_obj_union_map_print(__isl_take isl_printer *p,
  79. void *v)
  80. {
  81. return isl_printer_print_union_map(p, (isl_union_map *)v);
  82. }
  83. static void *isl_obj_union_map_add(void *v1, void *v2)
  84. {
  85. return isl_union_map_union((isl_union_map *)v1, (isl_union_map *)v2);
  86. }
  87. struct isl_obj_vtable isl_obj_union_map_vtable = {
  88. isl_obj_union_map_copy,
  89. isl_obj_union_map_add,
  90. isl_obj_union_map_print,
  91. isl_obj_union_map_free
  92. };
  93. static void *isl_obj_set_copy(void *v)
  94. {
  95. return isl_set_copy((struct isl_set *)v);
  96. }
  97. static void isl_obj_set_free(void *v)
  98. {
  99. isl_set_free((struct isl_set *)v);
  100. }
  101. static __isl_give isl_printer *isl_obj_set_print(__isl_take isl_printer *p,
  102. void *v)
  103. {
  104. return isl_printer_print_set(p, (struct isl_set *)v);
  105. }
  106. static void *isl_obj_set_add(void *v1, void *v2)
  107. {
  108. return isl_set_union((struct isl_set *)v1, (struct isl_set *)v2);
  109. }
  110. struct isl_obj_vtable isl_obj_set_vtable = {
  111. isl_obj_set_copy,
  112. isl_obj_set_add,
  113. isl_obj_set_print,
  114. isl_obj_set_free
  115. };
  116. static void *isl_obj_union_set_copy(void *v)
  117. {
  118. return isl_union_set_copy((isl_union_set *)v);
  119. }
  120. static void isl_obj_union_set_free(void *v)
  121. {
  122. isl_union_set_free((isl_union_set *)v);
  123. }
  124. static __isl_give isl_printer *isl_obj_union_set_print(__isl_take isl_printer *p,
  125. void *v)
  126. {
  127. return isl_printer_print_union_set(p, (isl_union_set *)v);
  128. }
  129. static void *isl_obj_union_set_add(void *v1, void *v2)
  130. {
  131. return isl_union_set_union((isl_union_set *)v1, (isl_union_set *)v2);
  132. }
  133. struct isl_obj_vtable isl_obj_union_set_vtable = {
  134. isl_obj_union_set_copy,
  135. isl_obj_union_set_add,
  136. isl_obj_union_set_print,
  137. isl_obj_union_set_free
  138. };
  139. static void *isl_obj_pw_multi_aff_copy(void *v)
  140. {
  141. return isl_pw_multi_aff_copy((isl_pw_multi_aff *) v);
  142. }
  143. static void isl_obj_pw_multi_aff_free(void *v)
  144. {
  145. isl_pw_multi_aff_free((isl_pw_multi_aff *) v);
  146. }
  147. static __isl_give isl_printer *isl_obj_pw_multi_aff_print(
  148. __isl_take isl_printer *p, void *v)
  149. {
  150. return isl_printer_print_pw_multi_aff(p, (isl_pw_multi_aff *) v);
  151. }
  152. static void *isl_obj_pw_multi_aff_add(void *v1, void *v2)
  153. {
  154. return isl_pw_multi_aff_add((isl_pw_multi_aff *) v1,
  155. (isl_pw_multi_aff *) v2);
  156. }
  157. struct isl_obj_vtable isl_obj_pw_multi_aff_vtable = {
  158. isl_obj_pw_multi_aff_copy,
  159. isl_obj_pw_multi_aff_add,
  160. isl_obj_pw_multi_aff_print,
  161. isl_obj_pw_multi_aff_free
  162. };
  163. static void *isl_obj_none_copy(void *v)
  164. {
  165. return v;
  166. }
  167. static void isl_obj_none_free(void *v)
  168. {
  169. }
  170. static __isl_give isl_printer *isl_obj_none_print(__isl_take isl_printer *p,
  171. void *v)
  172. {
  173. return p;
  174. }
  175. static void *isl_obj_none_add(void *v1, void *v2)
  176. {
  177. return NULL;
  178. }
  179. struct isl_obj_vtable isl_obj_none_vtable = {
  180. isl_obj_none_copy,
  181. isl_obj_none_add,
  182. isl_obj_none_print,
  183. isl_obj_none_free
  184. };
  185. static void *isl_obj_pw_qp_copy(void *v)
  186. {
  187. return isl_pw_qpolynomial_copy((struct isl_pw_qpolynomial *)v);
  188. }
  189. static void isl_obj_pw_qp_free(void *v)
  190. {
  191. isl_pw_qpolynomial_free((struct isl_pw_qpolynomial *)v);
  192. }
  193. static __isl_give isl_printer *isl_obj_pw_qp_print(__isl_take isl_printer *p,
  194. void *v)
  195. {
  196. return isl_printer_print_pw_qpolynomial(p,
  197. (struct isl_pw_qpolynomial *)v);
  198. }
  199. static void *isl_obj_pw_qp_add(void *v1, void *v2)
  200. {
  201. return isl_pw_qpolynomial_add((struct isl_pw_qpolynomial *)v1,
  202. (struct isl_pw_qpolynomial *)v2);
  203. }
  204. struct isl_obj_vtable isl_obj_pw_qpolynomial_vtable = {
  205. isl_obj_pw_qp_copy,
  206. isl_obj_pw_qp_add,
  207. isl_obj_pw_qp_print,
  208. isl_obj_pw_qp_free
  209. };
  210. static void *isl_obj_union_pw_qp_copy(void *v)
  211. {
  212. return isl_union_pw_qpolynomial_copy((struct isl_union_pw_qpolynomial *)v);
  213. }
  214. static void isl_obj_union_pw_qp_free(void *v)
  215. {
  216. isl_union_pw_qpolynomial_free((struct isl_union_pw_qpolynomial *)v);
  217. }
  218. static __isl_give isl_printer *isl_obj_union_pw_qp_print(
  219. __isl_take isl_printer *p, void *v)
  220. {
  221. return isl_printer_print_union_pw_qpolynomial(p,
  222. (struct isl_union_pw_qpolynomial *)v);
  223. }
  224. static void *isl_obj_union_pw_qp_add(void *v1, void *v2)
  225. {
  226. return isl_union_pw_qpolynomial_add(
  227. (struct isl_union_pw_qpolynomial *)v1,
  228. (struct isl_union_pw_qpolynomial *)v2);
  229. }
  230. struct isl_obj_vtable isl_obj_union_pw_qpolynomial_vtable = {
  231. isl_obj_union_pw_qp_copy,
  232. isl_obj_union_pw_qp_add,
  233. isl_obj_union_pw_qp_print,
  234. isl_obj_union_pw_qp_free
  235. };
  236. static void *isl_obj_pw_qpf_copy(void *v)
  237. {
  238. return isl_pw_qpolynomial_fold_copy((struct isl_pw_qpolynomial_fold *)v);
  239. }
  240. static void isl_obj_pw_qpf_free(void *v)
  241. {
  242. isl_pw_qpolynomial_fold_free((struct isl_pw_qpolynomial_fold *)v);
  243. }
  244. static __isl_give isl_printer *isl_obj_pw_qpf_print(__isl_take isl_printer *p,
  245. void *v)
  246. {
  247. return isl_printer_print_pw_qpolynomial_fold(p,
  248. (struct isl_pw_qpolynomial_fold *)v);
  249. }
  250. static void *isl_obj_pw_qpf_add(void *v1, void *v2)
  251. {
  252. return isl_pw_qpolynomial_fold_fold((struct isl_pw_qpolynomial_fold *)v1,
  253. (struct isl_pw_qpolynomial_fold *)v2);
  254. }
  255. struct isl_obj_vtable isl_obj_pw_qpolynomial_fold_vtable = {
  256. isl_obj_pw_qpf_copy,
  257. isl_obj_pw_qpf_add,
  258. isl_obj_pw_qpf_print,
  259. isl_obj_pw_qpf_free
  260. };
  261. static void *isl_obj_union_pw_qpf_copy(void *v)
  262. {
  263. return isl_union_pw_qpolynomial_fold_copy((struct isl_union_pw_qpolynomial_fold *)v);
  264. }
  265. static void isl_obj_union_pw_qpf_free(void *v)
  266. {
  267. isl_union_pw_qpolynomial_fold_free((struct isl_union_pw_qpolynomial_fold *)v);
  268. }
  269. static __isl_give isl_printer *isl_obj_union_pw_qpf_print(
  270. __isl_take isl_printer *p, void *v)
  271. {
  272. return isl_printer_print_union_pw_qpolynomial_fold(p,
  273. (struct isl_union_pw_qpolynomial_fold *)v);
  274. }
  275. static void *isl_obj_union_pw_qpf_add(void *v1, void *v2)
  276. {
  277. return isl_union_pw_qpolynomial_fold_fold(
  278. (struct isl_union_pw_qpolynomial_fold *)v1,
  279. (struct isl_union_pw_qpolynomial_fold *)v2);
  280. }
  281. struct isl_obj_vtable isl_obj_union_pw_qpolynomial_fold_vtable = {
  282. isl_obj_union_pw_qpf_copy,
  283. isl_obj_union_pw_qpf_add,
  284. isl_obj_union_pw_qpf_print,
  285. isl_obj_union_pw_qpf_free
  286. };
  287. static void *isl_obj_schedule_copy(void *v)
  288. {
  289. return isl_schedule_copy((isl_schedule *) v);
  290. }
  291. static void isl_obj_schedule_free(void *v)
  292. {
  293. isl_schedule_free((isl_schedule *) v);
  294. }
  295. static __isl_give isl_printer *isl_obj_schedule_print(
  296. __isl_take isl_printer *p, void *v)
  297. {
  298. return isl_printer_print_schedule(p, (isl_schedule *) v);
  299. }
  300. struct isl_obj_vtable isl_obj_schedule_vtable = {
  301. isl_obj_schedule_copy,
  302. NULL,
  303. isl_obj_schedule_print,
  304. isl_obj_schedule_free
  305. };