1 | /* |
2 | * Copyright 2012,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/space.h> |
11 | |
12 | #include <isl_multi_macro.h> |
13 | |
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. |
22 | */ |
23 | __isl_give MULTI(BASE) *FN(FN(MULTI(BASE),from),BASE)(__isl_take EL *el) |
24 | { |
25 | isl_space *space; |
26 | MULTI(BASE) *multi; |
27 | |
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, type: isl_dim_set, n: 1); |
32 | } |
33 | multi = FN(MULTI(BASE),alloc)(space); |
34 | multi = FN(FN(MULTI(BASE),set),BASE)(multi, pos: 0, el); |
35 | |
36 | return multi; |
37 | } |
38 | |