1 | /* |
2 | * Copyright 2018 Sven Verdoolaege |
3 | * |
4 | * Use of this software is governed by the MIT license |
5 | * |
6 | * Written by Sven Verdoolaege. |
7 | */ |
8 | |
9 | /* Given a function "obj" defined over a parameter domain, |
10 | * convert it to a function defined over a domain corresponding |
11 | * to "domain". |
12 | * Any parameters with identifiers in "domain" are reinterpreted |
13 | * as the corresponding domain dimensions. |
14 | */ |
15 | __isl_give TYPE *FN(TYPE,unbind_params_insert_domain)( |
16 | __isl_take TYPE *obj, __isl_take isl_multi_id *domain) |
17 | { |
18 | isl_bool is_params; |
19 | isl_space *space; |
20 | isl_reordering *r; |
21 | |
22 | space = FN(TYPE,get_domain_space)(aff: obj); |
23 | is_params = isl_space_is_params(space); |
24 | if (is_params < 0) |
25 | domain = isl_multi_id_free(multi: domain); |
26 | else if (!is_params) |
27 | isl_die(FN(TYPE,get_ctx)(obj), isl_error_invalid, |
28 | "expecting function with parameter domain" , |
29 | domain = isl_multi_id_free(domain)); |
30 | r = isl_reordering_unbind_params_insert_domain(space, tuple: domain); |
31 | isl_space_free(space); |
32 | isl_multi_id_free(multi: domain); |
33 | |
34 | return FN(TYPE,realign_domain)(aff: obj, r); |
35 | } |
36 | |