add isl_dim_map_range
authorSven Verdoolaege <skimo@kotnet.org>
Mon, 21 Mar 2011 11:59:18 +0000 (12:59 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Thu, 21 Apr 2011 11:12:59 +0000 (13:12 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_dim_map.c
isl_dim_map.h

index 20dca99..bf4491f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright 2008-2009 Katholieke Universiteit Leuven
- * Copyright 2010      INRIA Saclay
+ * Copyright 2010-2011 INRIA Saclay
  *
  * Use of this software is governed by the GNU LGPLv2.1 license
  *
@@ -42,6 +42,24 @@ __isl_give isl_dim_map *isl_dim_map_alloc(isl_ctx *ctx, unsigned len)
        return dim_map;
 }
 
+void isl_dim_map_range(__isl_keep isl_dim_map *dim_map,
+       unsigned dst_pos, unsigned dst_stride,
+       unsigned src_pos, unsigned src_stride,
+       unsigned n, int sign)
+{
+       int i;
+
+       if (!dim_map)
+               return;
+
+       for (i = 0; i < n; ++i) {
+               unsigned d = 1 + dst_pos + dst_stride * i;
+               unsigned s = 1 + src_pos + src_stride * i;
+               dim_map->m[d].pos = s;
+               dim_map->m[d].sgn = sign;
+       }
+}
+
 void isl_dim_map_dim_range(__isl_keep isl_dim_map *dim_map,
        struct isl_dim *dim, enum isl_dim_type type,
        unsigned first, unsigned n, unsigned dst_pos)
index 943b521..754e5b1 100644 (file)
@@ -9,6 +9,10 @@ struct isl_dim_map;
 typedef struct isl_dim_map isl_dim_map;
 
 __isl_give isl_dim_map *isl_dim_map_alloc(isl_ctx *ctx, unsigned len);
+void isl_dim_map_range(__isl_keep isl_dim_map *dim_map,
+       unsigned dst_pos, unsigned dst_stride,
+       unsigned src_pos, unsigned src_stride,
+       unsigned n, int sign);
 void isl_dim_map_dim_range(__isl_keep isl_dim_map *dim_map,
        struct isl_dim *dim, enum isl_dim_type type,
        unsigned first, unsigned n, unsigned dst_pos);