Polly 23.0.0git
isl_multi_un_op_templ.c
Go to the documentation of this file.
1/*
2 * Copyright 2014 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#include <isl_multi_macro.h>
11
12/* Data structure that specifies how isl_multi_*_un_op should
13 * modify its input.
14 *
15 * If "fn_space" is set, then it is applied to the space.
16 *
17 * "fn_el" is applied to each base expression.
18 */
19S(MULTI(BASE),un_op_control) {
20 __isl_give isl_space *(*fn_space)(__isl_take isl_space *space);
21 __isl_give EL *(*fn_el)(__isl_take EL *el);
22};
23
24/* Modify "multi" based on "control".
25 */
27 __isl_take MULTI(BASE) *multi, S(MULTI(BASE),un_op_control) *control)
28{
29 int i;
30 isl_size n;
31 isl_space *space;
32
33 n = FN(MULTI(BASE),size)(multi);
34 if (n < 0)
35 return FN(MULTI(BASE),free)(multi);
36
37 for (i = 0; i < n; ++i) {
38 EL *el;
39
40 el = FN(MULTI(BASE),take_at)(multi, i);
41 el = control->fn_el(el);
42 multi = FN(MULTI(BASE),restore_at)(multi, i, el);
43 }
44
45 if (!control->fn_space)
46 return multi;
47
48 space = FN(MULTI(BASE),take_space)(multi);
49 space = control->fn_space(space);
50 multi = FN(MULTI(BASE),restore_space)(multi, space);
51
52 return multi;
53}
#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 BASE
Definition flow_cmp.c:49
#define EL
#define S(TYPE, NAME)
#define MULTI(BASE)
const char * size
Definition isl_test.c:1578
static std::vector< Signature > un_op
n
Definition youcefn.c:8