1/*
2 * Copyright 2010 INRIA Saclay
3 *
4 * Use of this software is governed by the MIT license
5 *
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 */
10
11#include <isl_pw_macro.h>
12
13static 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)
17{
18 int i;
19
20 if (!set || !el)
21 goto error;
22
23 for (i = 0; i < set->n; ++i) {
24 isl_set *lift;
25 EL *copy;
26
27 lift = isl_set_from_basic_set(bset: isl_basic_set_copy(bset: set->p[i]));
28 lift = isl_set_lift(set: lift);
29
30 copy = FN(EL,copy)(qp: el);
31 copy = FN(EL,lift)(qp: copy, space: isl_set_get_space(set: lift));
32
33 if (fn(lift, copy, user) < 0)
34 goto error;
35 }
36
37 isl_set_free(set);
38 FN(EL,free)(qp: el);
39
40 return isl_stat_ok;
41error:
42 isl_set_free(set);
43 FN(EL,free)(qp: el);
44 return isl_stat_error;
45}
46
47isl_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)
50{
51 int i;
52
53 if (!pw)
54 return isl_stat_error;
55
56 for (i = 0; i < pw->n; ++i) {
57 isl_bool any;
58 isl_set *set;
59 EL *el;
60
61 any = isl_set_involves_locals(set: pw->p[i].set);
62 if (any < 0)
63 return isl_stat_error;
64 set = isl_set_copy(set: pw->p[i].set);
65 el = FN(EL,copy)(qp: pw->p[i].FIELD);
66 if (!any) {
67 if (fn(set, el, user) < 0)
68 return isl_stat_error;
69 continue;
70 }
71 if (foreach_lifted_subset(set, el, fn, user) < 0)
72 return isl_stat_error;
73 }
74
75 return isl_stat_ok;
76}
77

source code of polly/lib/External/isl/isl_pw_lift_templ.c