add isl_local_space_is_equal
authorSven Verdoolaege <skimo@kotnet.org>
Thu, 23 Jun 2011 12:26:03 +0000 (14:26 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sat, 25 Jun 2011 20:22:20 +0000 (22:22 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
doc/user.pod
include/isl/local_space.h
isl_local_space.c

index 3f0ac7f..c20c549 100644 (file)
@@ -610,6 +610,11 @@ They can be inspected, copied and freed using the following functions.
                __isl_keep isl_local_space *ls);
        void *isl_local_space_free(__isl_take isl_local_space *ls);
 
+Two local spaces can be compared using
+
+       int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
+               __isl_keep isl_local_space *ls2);
+
 Local spaces can be created from other local spaces
 using the following functions.
 
index e2bf9aa..f5e16cb 100644 (file)
@@ -32,6 +32,9 @@ __isl_give isl_local_space *isl_local_space_from_domain(
 __isl_give isl_local_space *isl_local_space_add_dim(
        __isl_take isl_local_space *ls, enum isl_dim_type type, unsigned n);
 
+int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
+       __isl_keep isl_local_space *ls2);
+
 __isl_give isl_printer *isl_printer_print_local_space(__isl_take isl_printer *p,
        __isl_keep isl_local_space *ls);
 void isl_local_space_dump(__isl_keep isl_local_space *ls);
index 296ef19..e098ee8 100644 (file)
@@ -112,6 +112,24 @@ void *isl_local_space_free(__isl_take isl_local_space *ls)
        return NULL;
 }
 
+/* Return true if the two local spaces are identical, with identical
+ * expressions for the integer divisions.
+ */
+int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
+       __isl_keep isl_local_space *ls2)
+{
+       int equal;
+
+       if (!ls1 || !ls2)
+               return -1;
+
+       equal = isl_dim_equal(ls1->dim, ls2->dim);
+       if (equal < 0 || !equal)
+               return equal;
+
+       return isl_mat_is_equal(ls1->div, ls2->div);
+}
+
 int isl_local_space_dim(__isl_keep isl_local_space *ls,
        enum isl_dim_type type)
 {