return list;
}
+/* Check that the domain space of "aff" matches "space".
+ *
+ * Return 0 on success and -1 on error.
+ */
+int isl_aff_check_match_domain_space(__isl_keep isl_aff *aff,
+ __isl_keep isl_space *space)
+{
+ isl_space *aff_space;
+ int match;
+
+ if (!aff || !space)
+ return -1;
+
+ aff_space = isl_aff_get_domain_space(aff);
+
+ match = isl_space_match(space, isl_dim_param, aff_space, isl_dim_param);
+ if (match < 0)
+ goto error;
+ if (!match)
+ isl_die(isl_aff_get_ctx(aff), isl_error_invalid,
+ "parameters don't match", goto error);
+ match = isl_space_tuple_match(space, isl_dim_in,
+ aff_space, isl_dim_set);
+ if (match < 0)
+ goto error;
+ if (!match)
+ isl_die(isl_aff_get_ctx(aff), isl_error_invalid,
+ "domains don't match", goto error);
+ isl_space_free(aff_space);
+ return 0;
+error:
+ isl_space_free(aff_space);
+ return -1;
+}
+
#undef BASE
#define BASE aff
return NULL;
}
+/* Check that the domain space of "pa" matches "space".
+ *
+ * Return 0 on success and -1 on error.
+ */
+int isl_pw_aff_check_match_domain_space(__isl_keep isl_pw_aff *pa,
+ __isl_keep isl_space *space)
+{
+ isl_space *pa_space;
+ int match;
+
+ if (!pa || !space)
+ return -1;
+
+ pa_space = isl_pw_aff_get_space(pa);
+
+ match = isl_space_match(space, isl_dim_param, pa_space, isl_dim_param);
+ if (match < 0)
+ goto error;
+ if (!match)
+ isl_die(isl_pw_aff_get_ctx(pa), isl_error_invalid,
+ "parameters don't match", goto error);
+ match = isl_space_tuple_match(space, isl_dim_in, pa_space, isl_dim_in);
+ if (match < 0)
+ goto error;
+ if (!match)
+ isl_die(isl_pw_aff_get_ctx(pa), isl_error_invalid,
+ "domains don't match", goto error);
+ isl_space_free(pa_space);
+ return 0;
+error:
+ isl_space_free(pa_space);
+ return -1;
+}
+
#undef BASE
#define BASE pw_aff
__isl_give isl_pw_aff_list *isl_pw_aff_list_set_rational(
__isl_take isl_pw_aff_list *list);
+int isl_aff_check_match_domain_space(__isl_keep isl_aff *aff,
+ __isl_keep isl_space *space);
+
#undef BASE
#define BASE aff
__isl_take isl_pw_multi_aff *pma, enum isl_dim_type type, unsigned pos,
__isl_keep isl_pw_aff *subs);
+int isl_pw_aff_check_match_domain_space(__isl_keep isl_pw_aff *pa,
+ __isl_keep isl_space *space);
+
#undef BASE
#define BASE pw_aff
goto error;
multi_space = FN(MULTI(BASE),get_space)(multi);
- el_space = FN(EL,get_space)(el);
-
- if (!isl_space_match(multi_space, isl_dim_param,
- el_space, isl_dim_param))
- isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
- "parameters don't match", goto error);
- if (!isl_space_tuple_match(multi_space, isl_dim_in,
- el_space, isl_dim_in))
- isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
- "domains don't match", goto error);
+ if (FN(EL,check_match_domain_space)(el, multi_space) < 0)
+ goto error;
if (pos < 0 || pos >= multi->n)
isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,