Polly 20.0.0git
isl_multi_pw_aff_pullback_templ.c
Go to the documentation of this file.
1/*
2 * Copyright 2013 Ecole Normale Superieure
3 *
4 * Use of this software is governed by the MIT license
5 *
6 * Written by Sven Verdoolaege,
7 * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
8 */
9
10#define xCAT(A,B) A ## B
11#define CAT(A,B) xCAT(A,B)
12#undef TYPE
13#define TYPE CAT(isl_,BASE)
14#define xFN(TYPE,NAME) TYPE ## _ ## NAME
15#define FN(TYPE,NAME) xFN(TYPE,NAME)
16
17#undef SUFFIX
18#define SUFFIX BASE
19#undef ARG1
20#define ARG1 isl_multi_pw_aff
21#undef ARG2
22#define ARG2 TYPE
23
24static
26
27/* Compute the pullback of "mpa" by the function represented by "fn".
28 * In other words, plug in "fn" in "mpa".
29 *
30 * If "mpa" has an explicit domain, then it is this domain
31 * that needs to undergo a pullback, i.e., a preimage.
32 */
33__isl_give isl_multi_pw_aff *FN(isl_multi_pw_aff_pullback,BASE)(
35{
36 int i;
37 isl_size n;
38 isl_space *space = NULL;
39
40 FN(isl_multi_pw_aff_align_params,BASE)(&mpa, &fn);
41 mpa = isl_multi_pw_aff_cow(mpa);
42 n = isl_multi_pw_aff_size(mpa);
43 if (n < 0 || !fn)
44 goto error;
45
46 space = isl_space_join(FN(TYPE,get_space)(fn),
47 isl_multi_pw_aff_get_space(mpa));
48
49 for (i = 0; i < n; ++i) {
50 isl_pw_aff *pa;
51
52 pa = isl_multi_pw_aff_take_at(mpa, i);
53 pa = FN(isl_pw_aff_pullback,BASE)(pa, FN(TYPE,copy)(fn));
54 mpa = isl_multi_pw_aff_restore_at(mpa, i, pa);
55 if (!mpa)
56 goto error;
57 }
58 if (isl_multi_pw_aff_has_explicit_domain(mpa)) {
59 mpa->u.dom = FN(isl_set_preimage,BASE)(mpa->u.dom,
60 FN(TYPE,copy)(fn));
61 if (!mpa->u.dom)
62 goto error;
63 }
64
65 FN(TYPE,free)(fn);
66 isl_multi_pw_aff_restore_space(mpa, space);
67 return mpa;
68error:
69 isl_space_free(space);
70 isl_multi_pw_aff_free(mpa);
71 FN(TYPE,free)(fn);
72 return NULL;
73}
struct isl_multi_pw_aff isl_multi_pw_aff
Definition: aff_type.h:43
#define __isl_take
Definition: ctx.h:22
#define __isl_give
Definition: ctx.h:19
int isl_size
Definition: ctx.h:96
#define BASE
Definition: flow_cmp.c:49
isl_stat isl_stat(* fn)(__isl_take ISL_KEY *key, __isl_take ISL_VAL *val, void *user)
Definition: hmap.h:37
__isl_give isl_set * isl_set_preimage(__isl_take isl_set *set, __isl_take isl_mat *mat)
Definition: isl_mat.c:1416
#define FN(TYPE, NAME)
__isl_null isl_space * isl_space_free(__isl_take isl_space *space)
Definition: isl_space.c:445
__isl_give isl_space * isl_space_join(__isl_take isl_space *left, __isl_take isl_space *right)
Definition: isl_space.c:1504
n
Definition: youcefn.c:8