Polly 23.0.0git
isl_pw_un_op_templ.c
Go to the documentation of this file.
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
13/* Data structure that specifies how isl_pw_*_un_op should
14 * modify its input.
15 *
16 * If "fn_space" is set, then it is applied to the space.
17 *
18 * If "fn_domain" is set, then it is applied to the cells.
19 *
20 * "fn_base" is applied to each base expression.
21 * This function is assumed to have no effect on the default value
22 * (i.e., zero for those objects with a default value).
23 */
24S(PW,un_op_control) {
25 __isl_give isl_space *(*fn_space)(__isl_take isl_space *space);
27 __isl_give EL *(*fn_base)(__isl_take EL *el);
28};
29
30/* Modify "pw" based on "control".
31 *
32 * If the cells are modified, then the corresponding base expressions
33 * may need to be adjusted to the possibly modified equality constraints.
34 */
36 S(PW,un_op_control) *control)
37{
38 isl_space *space;
39 isl_size n;
40 int i;
41
42 n = FN(PW,n_piece)(pw);
43 if (n < 0)
44 return FN(PW,free)(pw);
45
46 for (i = n - 1; i >= 0; --i) {
47 EL *el;
49
50 el = FN(PW,take_base_at)(pw, i);
51 el = control->fn_base(el);
52 pw = FN(PW,restore_base_at)(pw, i, el);
53
54 if (!control->fn_domain)
55 continue;
56
57 domain = FN(PW,take_domain_at)(pw, i);
58 domain = control->fn_domain(domain);
59 pw = FN(PW,restore_domain_at)(pw, i, domain);
60
61 pw = FN(PW,exploit_equalities_and_remove_if_empty)(pw, i);
62 }
63
64 if (!control->fn_space)
65 return pw;
66
67 space = FN(PW,take_space)(pw);
68 space = control->fn_space(space);
69 pw = FN(PW,restore_space)(pw, space);
70
71 return pw;
72}
#define FN(TYPE, NAME)
#define __isl_take
Definition ctx.h:22
#define __isl_give
Definition ctx.h:19
int isl_size
Definition ctx.h:97
#define PW
Definition isl_aff.c:2897
#define EL
#define S(TYPE, NAME)
#define isl_set
static std::vector< Signature > un_op
static Signature domain
n
Definition youcefn.c:8