add isl_space_extend_domain_with_range
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 30 Aug 2011 12:26:18 +0000 (14:26 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sat, 3 Sep 2011 19:43:08 +0000 (21:43 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_space.c
isl_space_private.h

index 5667dca..7bac578 100644 (file)
@@ -1629,3 +1629,21 @@ error:
        isl_space_free(dim2);
        return NULL;
 }
+
+/* Given the space of set (domain), construct a space for a map
+ * with as domain the given space and as range the range of "model".
+ */
+__isl_give isl_space *isl_space_extend_domain_with_range(
+       __isl_take isl_space *domain, __isl_take isl_space *model)
+{
+       isl_space *space;
+
+       space = isl_space_from_domain(domain);
+       space = isl_space_add_dims(space, isl_dim_out,
+                                   isl_space_dim(model, isl_dim_out));
+       if (isl_space_has_tuple_id(model, isl_dim_out))
+               space = isl_space_set_tuple_id(space, isl_dim_out,
+                               isl_space_get_tuple_id(model, isl_dim_out));
+       isl_space_free(model);
+       return space;
+}
index 28cb586..73762de 100644 (file)
@@ -46,3 +46,6 @@ __isl_give isl_space *isl_space_replace(__isl_take isl_space *dst,
        enum isl_dim_type type, __isl_keep isl_space *src);
 
 __isl_give isl_space *isl_space_lift(__isl_take isl_space *dim, unsigned n_local);
+
+__isl_give isl_space *isl_space_extend_domain_with_range(
+       __isl_take isl_space *domain, __isl_take isl_space *model);