@@ -7285,6 +7285,14 @@ C<isl_schedule> objects may be copied and freed using the following functions.
__isl_null isl_schedule *isl_schedule_free(
__isl_take isl_schedule *sched);
+The following functions checks whether two C<isl_schedule> objects
+are obviously the same.
+
+ #include <isl/schedule.h>
+ int isl_schedule_plain_is_equal(
+ __isl_keep isl_schedule *schedule1,
+ __isl_keep isl_schedule *schedule2);
+
The domain of the schedule, i.e., the domain described by the root node,
can be obtained using the following function.
@@ -82,6 +82,8 @@ __isl_null isl_schedule *isl_schedule_free(__isl_take isl_schedule *sched);
__isl_give isl_union_map *isl_schedule_get_map(__isl_keep isl_schedule *sched);
isl_ctx *isl_schedule_get_ctx(__isl_keep isl_schedule *sched);
+int isl_schedule_plain_is_equal(__isl_keep isl_schedule *schedule1,
+ __isl_keep isl_schedule *schedule2);
__isl_give isl_schedule_node *isl_schedule_get_root(
__isl_keep isl_schedule *schedule);
@@ -177,6 +177,19 @@ __isl_keep isl_schedule_tree *isl_schedule_peek_leaf(
return schedule ? &schedule->leaf : NULL;
}
+/* Are "schedule1" and "schedule2" obviously equal to each other?
+ */
+int isl_schedule_plain_is_equal(__isl_keep isl_schedule *schedule1,
+ __isl_keep isl_schedule *schedule2)
+{
+ if (!schedule1 || !schedule2)
+ return -1;
+ if (schedule1 == schedule2)
+ return 1;
+ return isl_schedule_tree_plain_is_equal(schedule1->root,
+ schedule2->root);
+}
+
/* Return the (parameter) space of the schedule, i.e., the space
* of the root domain.
*/
@@ -142,6 +142,29 @@ __isl_null isl_schedule_band *isl_schedule_band_free(
return NULL;
}
+/* Are "band1" and "band2" obviously equal?
+ */
+int isl_schedule_band_plain_is_equal(__isl_keep isl_schedule_band *band1,
+ __isl_keep isl_schedule_band *band2)
+{
+ int i;
+
+ if (!band1 || !band2)
+ return -1;
+ if (band1 == band2)
+ return 1;
+
+ if (band1->n != band2->n)
+ return 0;
+ for (i = 0; i < band1->n; ++i)
+ if (band1->coincident[i] != band2->coincident[i])
+ return 0;
+ if (band1->permutable != band2->permutable)
+ return 0;
+
+ return isl_multi_union_pw_aff_plain_is_equal(band1->mupa, band2->mupa);
+}
+
/* Return the number of scheduling dimensions in the band.
*/
int isl_schedule_band_n_member(__isl_keep isl_schedule_band *band)
@@ -34,6 +34,9 @@ __isl_null isl_schedule_band *isl_schedule_band_free(
isl_ctx *isl_schedule_band_get_ctx(__isl_keep isl_schedule_band *band);
+int isl_schedule_band_plain_is_equal(__isl_keep isl_schedule_band *band1,
+ __isl_keep isl_schedule_band *band2);
+
__isl_give isl_space *isl_schedule_band_get_space(
__isl_keep isl_schedule_band *band);
__isl_give isl_multi_union_pw_aff *isl_schedule_band_get_partial_schedule(
@@ -302,6 +302,64 @@ enum isl_schedule_node_type isl_schedule_tree_get_type(
return tree ? tree->type : isl_schedule_node_error;
}
+/* Are "tree1" and "tree2" obviously equal to each other?
+ */
+int isl_schedule_tree_plain_is_equal(__isl_keep isl_schedule_tree *tree1,
+ __isl_keep isl_schedule_tree *tree2)
+{
+ int equal;
+ int i, n;
+
+ if (!tree1 || !tree2)
+ return -1;
+ if (tree1 == tree2)
+ return 1;
+ if (tree1->type != tree2->type)
+ return 0;
+
+ switch (tree1->type) {
+ case isl_schedule_node_band:
+ equal = isl_schedule_band_plain_is_equal(tree1->band,
+ tree2->band);
+ break;
+ case isl_schedule_node_domain:
+ equal = isl_union_set_is_equal(tree1->domain, tree2->domain);
+ break;
+ case isl_schedule_node_filter:
+ equal = isl_union_set_is_equal(tree1->filter, tree2->filter);
+ break;
+ case isl_schedule_node_leaf:
+ case isl_schedule_node_sequence:
+ case isl_schedule_node_set:
+ equal = 1;
+ break;
+ case isl_schedule_node_error:
+ equal = -1;
+ break;
+ }
+
+ if (equal < 0 || !equal)
+ return equal;
+
+ n = isl_schedule_tree_n_children(tree1);
+ if (n != isl_schedule_tree_n_children(tree2))
+ return 0;
+ for (i = 0; i < n; ++i) {
+ isl_schedule_tree *child1, *child2;
+
+ child1 = isl_schedule_tree_get_child(tree1, i);
+ child2 = isl_schedule_tree_get_child(tree2, i);
+ equal = isl_schedule_tree_plain_is_equal(child1, child2);
+ isl_schedule_tree_free(child1);
+ isl_schedule_tree_free(child2);
+
+ if (equal < 0 || !equal)
+ return equal;
+ }
+
+ return 1;
+}
+
/* Does "tree" have any children, other than an implicit leaf.
*/
int isl_schedule_tree_has_children(__isl_keep isl_schedule_tree *tree)
@@ -49,6 +49,9 @@ enum isl_schedule_node_type isl_schedule_tree_get_type(
__isl_give isl_schedule_tree *isl_schedule_tree_leaf(isl_ctx *ctx);
int isl_schedule_tree_is_leaf(__isl_keep isl_schedule_tree *tree);
+int isl_schedule_tree_plain_is_equal(__isl_keep isl_schedule_tree *tree1,
+ __isl_keep isl_schedule_tree *tree2);
+
__isl_give isl_schedule_tree *isl_schedule_tree_copy(
__isl_keep isl_schedule_tree *tree);
__isl_null isl_schedule_tree *isl_schedule_tree_free(