1*5971e316Smrg /*
2*5971e316Smrg * Copyright 2017 Sven Verdoolaege
3*5971e316Smrg *
4*5971e316Smrg * Use of this software is governed by the MIT license
5*5971e316Smrg *
6*5971e316Smrg * Written by Sven Verdoolaege.
7*5971e316Smrg */
8*5971e316Smrg
9*5971e316Smrg #include <isl_multi_macro.h>
10*5971e316Smrg
11*5971e316Smrg /* Does the space of "domain" correspond to that of the domain of "multi"?
12*5971e316Smrg * The parameters do not need to be aligned.
13*5971e316Smrg */
FN(MULTI (BASE),compatible_domain)14*5971e316Smrg static isl_bool FN(MULTI(BASE),compatible_domain)(
15*5971e316Smrg __isl_keep MULTI(BASE) *multi, __isl_keep DOM *domain)
16*5971e316Smrg {
17*5971e316Smrg isl_bool ok;
18*5971e316Smrg isl_space *space, *domain_space;
19*5971e316Smrg
20*5971e316Smrg domain_space = FN(DOM,get_space)(domain);
21*5971e316Smrg space = FN(MULTI(BASE),get_space)(multi);
22*5971e316Smrg ok = isl_space_has_domain_tuples(domain_space, space);
23*5971e316Smrg isl_space_free(space);
24*5971e316Smrg isl_space_free(domain_space);
25*5971e316Smrg
26*5971e316Smrg return ok;
27*5971e316Smrg }
28*5971e316Smrg
29*5971e316Smrg /* Check that the space of "domain" corresponds to
30*5971e316Smrg * that of the domain of "multi", ignoring parameters.
31*5971e316Smrg */
FN(MULTI (BASE),check_compatible_domain)32*5971e316Smrg static isl_stat FN(MULTI(BASE),check_compatible_domain)(
33*5971e316Smrg __isl_keep MULTI(BASE) *multi, __isl_keep DOM *domain)
34*5971e316Smrg {
35*5971e316Smrg isl_bool ok;
36*5971e316Smrg
37*5971e316Smrg ok = FN(MULTI(BASE),compatible_domain)(multi, domain);
38*5971e316Smrg if (ok < 0)
39*5971e316Smrg return isl_stat_error;
40*5971e316Smrg if (!ok)
41*5971e316Smrg isl_die(FN(DOM,get_ctx)(domain), isl_error_invalid,
42*5971e316Smrg "incompatible spaces", return isl_stat_error);
43*5971e316Smrg
44*5971e316Smrg return isl_stat_ok;
45*5971e316Smrg }
46