1/*
2 * Copyright 2019 Cerebras Systems
3 *
4 * Use of this software is governed by the MIT license
5 *
6 * Written by Sven Verdoolaege,
7 * Cerebras Systems, 175 S San Antonio Rd, Los Altos, CA, USA
8 */
9
10/* Given a function defined over a parameter domain,
11 * convert it to a function defined over a domain corresponding
12 * to "domain".
13 */
14__isl_give TYPE *FN(TYPE,insert_domain)(__isl_take TYPE *obj,
15 __isl_take isl_space *domain)
16{
17 isl_size dim;
18 isl_space *obj_space;
19
20 obj_space = FN(TYPE,peek_space)(pw: obj);
21 if (isl_space_check_is_set(space: domain) < 0 ||
22 isl_space_check_is_set(space: obj_space) < 0)
23 goto error;
24 dim = isl_space_dim(space: domain, type: isl_dim_set);
25 if (dim < 0)
26 goto error;
27
28 domain = isl_space_replace_params(dst: domain, src: obj_space);
29
30 obj = FN(TYPE,from_range)(obj);
31 obj = FN(TYPE,add_dims)(pw: obj, type: isl_dim_in, n: dim);
32 obj = FN(TYPE,reset_domain_space)(pw: obj, domain);
33
34 return obj;
35error:
36 isl_space_free(space: domain);
37 FN(TYPE,free)(pw: obj);
38 return NULL;
39}
40

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