isl_scheduler.c: rename node_update_vmap to isl_sched_node_update_vmap
[isl.git] / isl_pw_lift_templ.c
blob0ffe09afd87bc5a183e98ff7201f513cba45b8a0
1 /*
2 * Copyright 2010 INRIA Saclay
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
7 * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
8 * 91893 Orsay, France
9 */
11 #include <isl_pw_macro.h>
13 static isl_stat foreach_lifted_subset(__isl_take isl_set *set,
14 __isl_take EL *el,
15 isl_stat (*fn)(__isl_take isl_set *set, __isl_take EL *el,
16 void *user), void *user)
18 int i;
20 if (!set || !el)
21 goto error;
23 for (i = 0; i < set->n; ++i) {
24 isl_set *lift;
25 EL *copy;
27 lift = isl_set_from_basic_set(isl_basic_set_copy(set->p[i]));
28 lift = isl_set_lift(lift);
30 copy = FN(EL,copy)(el);
31 copy = FN(EL,lift)(copy, isl_set_get_space(lift));
33 if (fn(lift, copy, user) < 0)
34 goto error;
37 isl_set_free(set);
38 FN(EL,free)(el);
40 return isl_stat_ok;
41 error:
42 isl_set_free(set);
43 FN(EL,free)(el);
44 return isl_stat_error;
47 isl_stat FN(PW,foreach_lifted_piece)(__isl_keep PW *pw,
48 isl_stat (*fn)(__isl_take isl_set *set, __isl_take EL *el,
49 void *user), void *user)
51 int i;
53 if (!pw)
54 return isl_stat_error;
56 for (i = 0; i < pw->n; ++i) {
57 isl_bool any;
58 isl_set *set;
59 EL *el;
61 any = isl_set_involves_locals(pw->p[i].set);
62 if (any < 0)
63 return isl_stat_error;
64 set = isl_set_copy(pw->p[i].set);
65 el = FN(EL,copy)(pw->p[i].FIELD);
66 if (!any) {
67 if (fn(set, el, user) < 0)
68 return isl_stat_error;
69 continue;
71 if (foreach_lifted_subset(set, el, fn, user) < 0)
72 return isl_stat_error;
75 return isl_stat_ok;