isl_coalesce.c: add_subs: return isl_stat
[isl.git] / isl_multi_from_base_templ.c
blob2a2a6b1ecfe81f8b123db789922f67134788cc36
1 /*
2 * Copyright 2012,2014 Ecole Normale Superieure
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege,
7 * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
8 */
10 #include <isl/space.h>
12 #include <isl_multi_macro.h>
14 /* Create a multiple expression with a single output/set dimension
15 * equal to "el".
16 * For most multiple expression types, the base type has a single
17 * output/set dimension and the space of the result is therefore
18 * the same as the space of the input.
19 * In the case of isl_multi_union_pw_aff, however, the base type
20 * lives in a parameter space and we therefore need to add
21 * a single set dimension.
23 __isl_give MULTI(BASE) *FN(FN(MULTI(BASE),from),BASE)(__isl_take EL *el)
25 isl_space *space;
26 MULTI(BASE) *multi;
28 space = FN(EL,get_space(el));
29 if (isl_space_is_params(space)) {
30 space = isl_space_set_from_params(space);
31 space = isl_space_add_dims(space, isl_dim_set, 1);
33 multi = FN(MULTI(BASE),alloc)(space);
34 multi = FN(FN(MULTI(BASE),set),BASE)(multi, 0, el);
36 return multi;