Use isl_stat as return value for isl_val_get_num_isl_int
[isl.git] / isl_multi_union_pw_aff_explicit_domain.c
blob7ff9b12bb6448ee354e2b952777784b675d64779
1 /*
2 * Copyright 2017 Sven Verdoolaege
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege.
7 */
9 /* Initialize the explicit domain of "mupa".
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.
15 static __isl_give isl_multi_union_pw_aff *
16 isl_multi_union_pw_aff_init_explicit_domain(
17 __isl_take isl_multi_union_pw_aff *mupa)
19 isl_space *space;
21 if (isl_multi_union_pw_aff_check_has_explicit_domain(mupa) < 0)
22 return isl_multi_union_pw_aff_free(mupa);
23 space = isl_space_params(isl_multi_union_pw_aff_get_space(mupa));
24 mupa->u.dom = isl_union_set_from_set(isl_set_universe(space));
25 if (!mupa->u.dom)
26 return isl_multi_union_pw_aff_free(mupa);
27 return mupa;
30 /* Drop the "n" dimensions of type "type" starting at position "pos"
31 * of the explicit domain of "mupa".
33 static __isl_give isl_multi_union_pw_aff *
34 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)
38 if (isl_multi_union_pw_aff_check_has_explicit_domain(mupa) < 0)
39 return isl_multi_union_pw_aff_free(mupa);
40 if (type != isl_dim_param)
41 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 mupa = isl_multi_union_pw_aff_cow(mupa);
45 if (!mupa)
46 return NULL;
47 mupa->u.dom = isl_union_set_project_out(mupa->u.dom, type, pos, n);
48 if (!mupa->u.dom)
49 return isl_multi_union_pw_aff_free(mupa);
50 return mupa;