Line data Source code
1 : /*
2 : * Copyright 2017 Sven Verdoolaege
3 : *
4 : * Use of this software is governed by the MIT license
5 : *
6 : * Written by Sven Verdoolaege.
7 : */
8 :
9 : /* Initialize the explicit domain of "mupa".
10 : *
11 : * The explicit domain is initialized to a universe parameter set.
12 : * It may later be specialized with constraints on the parameter or
13 : * specific domain instances.
14 : */
15 : static __isl_give isl_multi_union_pw_aff *
16 0 : isl_multi_union_pw_aff_init_explicit_domain(
17 : __isl_take isl_multi_union_pw_aff *mupa)
18 : {
19 : isl_space *space;
20 :
21 0 : if (isl_multi_union_pw_aff_check_has_explicit_domain(mupa) < 0)
22 0 : return isl_multi_union_pw_aff_free(mupa);
23 0 : space = isl_space_params(isl_multi_union_pw_aff_get_space(mupa));
24 0 : mupa->u.dom = isl_union_set_from_set(isl_set_universe(space));
25 0 : if (!mupa->u.dom)
26 0 : return isl_multi_union_pw_aff_free(mupa);
27 0 : return mupa;
28 : }
29 :
30 : /* Drop the "n" dimensions of type "type" starting at position "pos"
31 : * of the explicit domain of "mupa".
32 : */
33 : static __isl_give isl_multi_union_pw_aff *
34 0 : isl_multi_union_pw_aff_drop_explicit_domain_dims(
35 : __isl_take isl_multi_union_pw_aff *mupa,
36 : enum isl_dim_type type, unsigned pos, unsigned n)
37 : {
38 0 : if (isl_multi_union_pw_aff_check_has_explicit_domain(mupa) < 0)
39 0 : return isl_multi_union_pw_aff_free(mupa);
40 0 : if (type != isl_dim_param)
41 0 : isl_die(isl_multi_union_pw_aff_get_ctx(mupa), isl_error_invalid,
42 : "can only drop parameters",
43 : return isl_multi_union_pw_aff_free(mupa));
44 0 : mupa = isl_multi_union_pw_aff_cow(mupa);
45 0 : if (!mupa)
46 0 : return NULL;
47 0 : mupa->u.dom = isl_union_set_project_out(mupa->u.dom, type, pos, n);
48 0 : if (!mupa->u.dom)
49 0 : return isl_multi_union_pw_aff_free(mupa);
50 0 : return mupa;
51 : }
|