From faa9c37a251de4ab0a5ee6836ab8bc56edda48fb Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 23 Jun 2011 14:26:03 +0200 Subject: [PATCH] add isl_local_space_is_equal Signed-off-by: Sven Verdoolaege --- doc/user.pod | 5 +++++ include/isl/local_space.h | 3 +++ isl_local_space.c | 18 ++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/doc/user.pod b/doc/user.pod index 3f0ac7ff..c20c5496 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -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. diff --git a/include/isl/local_space.h b/include/isl/local_space.h index e2bf9aa7..f5e16cb3 100644 --- a/include/isl/local_space.h +++ b/include/isl/local_space.h @@ -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); diff --git a/isl_local_space.c b/isl_local_space.c index 296ef192..e098ee8e 100644 --- a/isl_local_space.c +++ b/isl_local_space.c @@ -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) { -- 2.11.4.GIT