Polly 20.0.0git
isl_multi_from_tuple_templ.c
Go to the documentation of this file.
1/*
2 * Copyright 2011 Sven Verdoolaege
3 * Copyright 2012 Ecole Normale Superieure
4 *
5 * Use of this software is governed by the MIT license
6 *
7 * Written by Sven Verdoolaege,
8 * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
9 */
10
11#include <isl_multi_macro.h>
12
13/* Extract a multi expression with domain space "dom_space"
14 * from a tuple "tuple" that was read by read_tuple.
15 *
16 * Check that none of the expressions depend on any other output/set dimensions.
17 */
18static MULTI(BASE) *FN(MULTI(BASE),from_tuple)(
20{
21 int i;
22 isl_size dim, n;
23 isl_space *space;
24 MULTI(BASE) *multi;
25
26 n = isl_multi_pw_aff_dim(tuple, isl_dim_out);
27 dim = isl_space_dim(dom_space, isl_dim_all);
28 if (n < 0 || dim < 0)
29 dom_space = isl_space_free(dom_space);
30 space = isl_space_range(isl_multi_pw_aff_get_space(tuple));
31 space = isl_space_align_params(space, isl_space_copy(dom_space));
32 if (!isl_space_is_params(dom_space))
34 isl_space_copy(dom_space), space);
35 isl_space_free(dom_space);
36 multi = FN(MULTI(BASE),alloc)(space);
37
38 for (i = 0; i < n; ++i) {
39 isl_pw_aff *pa;
40 pa = isl_multi_pw_aff_get_pw_aff(tuple, i);
41 multi = FN(MULTI(BASE),set_tuple_entry)(multi, pa, i, dim, n);
42 }
43
44 isl_multi_pw_aff_free(tuple);
45 return multi;
46}
struct isl_multi_pw_aff isl_multi_pw_aff
Definition: aff_type.h:43
#define FN(TYPE, NAME)
#define __isl_take
Definition: ctx.h:22
int isl_size
Definition: ctx.h:96
#define BASE
Definition: flow_cmp.c:49
#define MULTI(BASE)
const char * tuple
Definition: isl_test.c:7008
__isl_null isl_space * isl_space_free(__isl_take isl_space *space)
Definition: isl_space.c:445
__isl_give isl_space * isl_space_copy(__isl_keep isl_space *space)
Definition: isl_space.c:436
__isl_give isl_space * isl_space_align_params(__isl_take isl_space *space1, __isl_take isl_space *space2)
Definition: isl_space.c:3262
__isl_give isl_space * isl_space_map_from_domain_and_range(__isl_take isl_space *domain, __isl_take isl_space *range)
Definition: isl_space.c:1934
__isl_export __isl_give isl_space * isl_space_range(__isl_take isl_space *space)
Definition: isl_space.c:2163
isl_bool isl_space_is_params(__isl_keep isl_space *space)
Definition: isl_space.c:179
isl_size isl_space_dim(__isl_keep isl_space *space, enum isl_dim_type type)
Definition: isl_space.c:340
@ isl_dim_all
Definition: space_type.h:20
@ isl_dim_out
Definition: space_type.h:17
n
Definition: youcefn.c:8