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 #include <isl_multi_macro.h>
10
11 /* Does the space of "domain" correspond to that of the domain of "multi"?
12 * The parameters do not need to be aligned.
13 */
FN(MULTI (BASE),compatible_domain)14 static isl_bool FN(MULTI(BASE),compatible_domain)(
15 __isl_keep MULTI(BASE) *multi, __isl_keep DOM *domain)
16 {
17 isl_bool ok;
18 isl_space *space, *domain_space;
19
20 domain_space = FN(DOM,get_space)(domain);
21 space = FN(MULTI(BASE),get_space)(multi);
22 ok = isl_space_has_domain_tuples(domain_space, space);
23 isl_space_free(space);
24 isl_space_free(domain_space);
25
26 return ok;
27 }
28
29 /* Check that the space of "domain" corresponds to
30 * that of the domain of "multi", ignoring parameters.
31 */
FN(MULTI (BASE),check_compatible_domain)32 static isl_stat FN(MULTI(BASE),check_compatible_domain)(
33 __isl_keep MULTI(BASE) *multi, __isl_keep DOM *domain)
34 {
35 isl_bool ok;
36
37 ok = FN(MULTI(BASE),compatible_domain)(multi, domain);
38 if (ok < 0)
39 return isl_stat_error;
40 if (!ok)
41 isl_die(FN(DOM,get_ctx)(domain), isl_error_invalid,
42 "incompatible spaces", return isl_stat_error);
43
44 return isl_stat_ok;
45 }
46