From 8d69c00d02f13acd58f7ee04cedf8ffbd765c576 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 3 Dec 2013 15:16:48 +0100 Subject: [PATCH] add isl_multi_*_find_dim_by_name Signed-off-by: Sven Verdoolaege --- doc/user.pod | 9 +++++++++ include/isl/multi.h | 3 +++ isl_multi_templ.c | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/doc/user.pod b/doc/user.pod index 419a4d1a..e4d25eb0 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -1243,6 +1243,9 @@ its position can be obtained from the following functions. int isl_multi_val_find_dim_by_id( __isl_keep isl_multi_val *mv, enum isl_dim_type type, __isl_keep isl_id *id); + int isl_multi_val_find_dim_by_name( + __isl_keep isl_multi_val *mv, + enum isl_dim_type type, const char *name); #include int isl_set_find_dim_by_id(__isl_keep isl_set *set, @@ -1271,6 +1274,12 @@ its position can be obtained from the following functions. enum isl_dim_type type, __isl_keep isl_id *id); int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff, enum isl_dim_type type, const char *name); + int isl_multi_aff_find_dim_by_name( + __isl_keep isl_multi_aff *ma, + enum isl_dim_type type, const char *name); + int isl_multi_pw_aff_find_dim_by_name( + __isl_keep isl_multi_pw_aff *mpa, + enum isl_dim_type type, const char *name); The identifiers or names of entire spaces may be set or read off using the following functions. diff --git a/include/isl/multi.h b/include/isl/multi.h index 99c12870..ddcdc20f 100644 --- a/include/isl/multi.h +++ b/include/isl/multi.h @@ -18,6 +18,9 @@ __isl_give isl_space *isl_multi_##BASE##_get_space( \ __isl_keep isl_multi_##BASE *multi); \ __isl_give isl_space *isl_multi_##BASE##_get_domain_space( \ __isl_keep isl_multi_##BASE *multi); \ +int isl_multi_##BASE##_find_dim_by_name( \ + __isl_keep isl_multi_##BASE *multi, \ + enum isl_dim_type type, const char *name); \ __isl_give isl_multi_##BASE *isl_multi_##BASE##_from_##BASE##_list( \ __isl_take isl_space *space, __isl_take isl_##BASE##_list *list); \ __isl_give isl_multi_##BASE *isl_multi_##BASE##_zero( \ diff --git a/isl_multi_templ.c b/isl_multi_templ.c index d3a13989..69dc93c3 100644 --- a/isl_multi_templ.c +++ b/isl_multi_templ.c @@ -34,6 +34,18 @@ __isl_give isl_space *FN(MULTI(BASE),get_space)(__isl_keep MULTI(BASE) *multi) return multi ? isl_space_copy(multi->space) : NULL; } +/* Return the position of the dimension of the given type and name + * in "multi". + * Return -1 if no such dimension can be found. + */ +int FN(MULTI(BASE),find_dim_by_name)(__isl_keep MULTI(BASE) *multi, + enum isl_dim_type type, const char *name) +{ + if (!multi) + return -1; + return isl_space_find_dim_by_name(multi->space, type, name); +} + __isl_give isl_space *FN(MULTI(BASE),get_domain_space)( __isl_keep MULTI(BASE) *multi) { -- 2.11.4.GIT