From 1ca982a07f653e0b0e3fff2683b569998871dd97 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 1 Dec 2010 16:12:19 +0100 Subject: [PATCH] hide isl_map internals Signed-off-by: Sven Verdoolaege --- include/isl/map.h | 23 +---------------------- isl_flow.c | 21 +++++++++++++-------- isl_map_private.h | 22 ++++++++++++++++++++++ 3 files changed, 36 insertions(+), 30 deletions(-) diff --git a/include/isl/map.h b/include/isl/map.h index 13e225a..c823d89 100644 --- a/include/isl/map.h +++ b/include/isl/map.h @@ -42,28 +42,7 @@ struct isl_basic_map; typedef struct isl_basic_map isl_basic_map; struct isl_basic_set; typedef struct isl_basic_set isl_basic_set; - -/* A "map" is a (disjoint) union of basic maps. - * - * Currently, the isl_set structure is identical to the isl_map structure - * and the library depends on this correspondence internally. - * However, users should not depend on this correspondence. - */ -struct isl_map { - int ref; -#define ISL_MAP_DISJOINT (1 << 0) -#define ISL_MAP_NORMALIZED (1 << 1) - unsigned flags; - - struct isl_ctx *ctx; - - struct isl_dim *dim; - - int n; - - size_t size; - struct isl_basic_map *p[1]; -}; +struct isl_map; typedef struct isl_map isl_map; struct isl_set; typedef struct isl_set isl_set; diff --git a/isl_flow.c b/isl_flow.c index e9752fc..e8b9c58 100644 --- a/isl_flow.c +++ b/isl_flow.c @@ -58,14 +58,16 @@ struct isl_flow { __isl_give isl_access_info *isl_access_info_alloc(__isl_take isl_map *sink, void *sink_user, isl_access_level_before fn, int max_source) { + isl_ctx *ctx; struct isl_access_info *acc; if (!sink) return NULL; - isl_assert(sink->ctx, max_source >= 0, goto error); + ctx = isl_map_get_ctx(sink); + isl_assert(ctx, max_source >= 0, goto error); - acc = isl_alloc(sink->ctx, struct isl_access_info, + acc = isl_alloc(ctx, struct isl_access_info, sizeof(struct isl_access_info) + (max_source - 1) * sizeof(struct isl_labeled_map)); if (!acc) @@ -108,10 +110,12 @@ __isl_give isl_access_info *isl_access_info_add_source( __isl_take isl_access_info *acc, __isl_take isl_map *source, int must, void *source_user) { + isl_ctx *ctx; + if (!acc) return NULL; - isl_assert(acc->sink.map->ctx, - acc->n_must + acc->n_may < acc->max_source, goto error); + ctx = isl_map_get_ctx(acc->sink.map); + isl_assert(ctx, acc->n_must + acc->n_may < acc->max_source, goto error); if (must) { if (acc->n_may) @@ -180,6 +184,7 @@ static __isl_give isl_access_info *isl_access_info_sort_sources( __isl_take isl_access_info *acc) { int i; + isl_ctx *ctx; struct isl_access_sort_info *array; if (!acc) @@ -187,8 +192,8 @@ static __isl_give isl_access_info *isl_access_info_sort_sources( if (acc->n_must <= 1) return acc; - array = isl_alloc_array(acc->sink.map->ctx, - struct isl_access_sort_info, acc->n_must); + ctx = isl_map_get_ctx(acc->sink.map); + array = isl_alloc_array(ctx, struct isl_access_sort_info, acc->n_must); if (!array) goto error; @@ -233,7 +238,7 @@ static __isl_give isl_flow *isl_flow_alloc(__isl_keep isl_access_info *acc) if (!acc) return NULL; - ctx = acc->sink.map->ctx; + ctx = isl_map_get_ctx(acc->sink.map); dep = isl_calloc_type(ctx, struct isl_flow); if (!dep) return NULL; @@ -713,7 +718,7 @@ static __isl_give isl_flow *compute_val_based_dependences( res = isl_flow_alloc(acc); if (!res) goto error; - ctx = acc->sink.map->ctx; + ctx = isl_map_get_ctx(acc->sink.map); depth = 2 * isl_map_dim(acc->sink.map, isl_dim_in) + 1; mustdo = isl_map_domain(isl_map_copy(acc->sink.map)); diff --git a/isl_map_private.h b/isl_map_private.h index 9531fc0..526dbca 100644 --- a/isl_map_private.h +++ b/isl_map_private.h @@ -94,6 +94,28 @@ struct isl_basic_set { struct isl_blk block2; }; +/* A "map" is a (disjoint) union of basic maps. + * + * Currently, the isl_set structure is identical to the isl_map structure + * and the library depends on this correspondence internally. + * However, users should not depend on this correspondence. + */ +struct isl_map { + int ref; +#define ISL_MAP_DISJOINT (1 << 0) +#define ISL_MAP_NORMALIZED (1 << 1) + unsigned flags; + + struct isl_ctx *ctx; + + struct isl_dim *dim; + + int n; + + size_t size; + struct isl_basic_map *p[1]; +}; + /* A "set" is a (possibly disjoint) union of basic sets. * * See the documentation of isl_map. -- 2.7.4