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)(
19 __isl_take isl_space *dom_space, __isl_take isl_multi_pw_aff *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(multi: tuple, type: isl_dim_out);
27 dim = isl_space_dim(space: dom_space, type: isl_dim_all);
28 if (n < 0 || dim < 0)
29 dom_space = isl_space_free(space: dom_space);
30 space = isl_space_range(space: isl_multi_pw_aff_get_space(multi: tuple));
31 space = isl_space_align_params(space1: space, space2: isl_space_copy(space: dom_space));
32 if (!isl_space_is_params(space: dom_space))
33 space = isl_space_map_from_domain_and_range(
34 domain: isl_space_copy(space: dom_space), range: space);
35 isl_space_free(space: 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(multi: tuple, pos: i);
41 multi = FN(MULTI(BASE),set_tuple_entry)(mpa: multi, tuple_el: pa, pos: i, first: dim, n);
42 }
43
44 isl_multi_pw_aff_free(multi: tuple);
45 return multi;
46}
47

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