From 2ee3d5c549e73b893b8ade40c9b398d5968b9a4f Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 16 Apr 2018 14:29:21 +0200 Subject: [PATCH] add isl_map_project_onto This convenience function will be used in the implementation of isl_map_get_range_stride_info. Signed-off-by: Sven Verdoolaege --- isl_map.c | 16 ++++++++++++++++ isl_map_private.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/isl_map.c b/isl_map.c index 4ae03055..f949248c 100644 --- a/isl_map.c +++ b/isl_map.c @@ -4378,6 +4378,22 @@ error: return NULL; } +/* Turn all the dimensions of type "type", except the "n" starting at "first" + * into existentially quantified variables. + */ +__isl_give isl_map *isl_map_project_onto(__isl_take isl_map *map, + enum isl_dim_type type, unsigned first, unsigned n) +{ + unsigned dim; + + if (isl_map_check_range(map, type, first, n) < 0) + return isl_map_free(map); + dim = isl_map_dim(map, type); + map = isl_map_project_out(map, type, first + n, dim - (first + n)); + map = isl_map_project_out(map, type, 0, first); + return map; +} + /* Turn the n dimensions of type type, starting at first * into existentially quantified variables. */ diff --git a/isl_map_private.h b/isl_map_private.h index 46065fe3..b132619a 100644 --- a/isl_map_private.h +++ b/isl_map_private.h @@ -358,6 +358,8 @@ __isl_give isl_map *isl_map_eliminate(__isl_take isl_map *map, enum isl_dim_type type, unsigned first, unsigned n); __isl_give isl_set *isl_set_eliminate(__isl_take isl_set *set, enum isl_dim_type type, unsigned first, unsigned n); +__isl_give isl_map *isl_map_project_onto(__isl_take isl_map *map, + enum isl_dim_type type, unsigned first, unsigned n); int isl_basic_map_add_div_constraint(__isl_keep isl_basic_map *bmap, unsigned div, int sign); -- 2.11.4.GIT