From be52df8904d4fd59e0276afdbc2d2e2f75463f9f Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 27 Jun 2013 12:07:48 +0200 Subject: [PATCH] scan.cc: add create_test_index This function will eventually replace create_test_access, but it introduced alongside create_test_access for now so that users can be moved gradually. Signed-off-by: Sven Verdoolaege --- scan.cc | 16 ++++++++++++---- scop.c | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/scan.cc b/scan.cc index 6ed92d9..f3da6e5 100644 --- a/scan.cc +++ b/scan.cc @@ -2205,15 +2205,15 @@ struct pet_scop *PetScan::extract_infinite_for(ForStmt *stmt) return extract_infinite_loop(stmt->getBody()); } -/* Create an access to a virtual array representing the result - * of a condition. +/* Create an index expression for an access to a virtual array + * representing the result of a condition. * Unlike other accessed data, the id of the array is NULL as * there is no ValueDecl in the program corresponding to the virtual * array. * The array starts out as a scalar, but grows along with the * statement writing to the array in pet_scop_embed. */ -static __isl_give isl_map *create_test_access(isl_ctx *ctx, int test_nr) +static __isl_give isl_multi_pw_aff *create_test_index(isl_ctx *ctx, int test_nr) { isl_space *dim = isl_space_alloc(ctx, 0, 0, 0); isl_id *id; @@ -2222,7 +2222,15 @@ static __isl_give isl_map *create_test_access(isl_ctx *ctx, int test_nr) snprintf(name, sizeof(name), "__pet_test_%d", test_nr); id = isl_id_alloc(ctx, name, NULL); dim = isl_space_set_tuple_id(dim, isl_dim_out, id); - return isl_map_universe(dim); + return isl_multi_pw_aff_zero(dim); +} + +/* Create an access to a virtual array representing the result + * of a condition. + */ +static __isl_give isl_map *create_test_access(isl_ctx *ctx, int test_nr) +{ + return isl_map_from_multi_pw_aff(create_test_index(ctx, test_nr)); } /* Add an array with the given extent ("access") to the list diff --git a/scop.c b/scop.c index 211d2bf..fd062ba 100644 --- a/scop.c +++ b/scop.c @@ -1573,7 +1573,7 @@ struct pet_embed_access { * domain dimension and subsequently projected out. * * Similarly, if the accessed array is a virtual array (with user - * pointer equal to NULL), as created by create_test_access, + * pointer equal to NULL), as created by create_test_index, * then it is extended along with the domain of the access. */ static struct pet_expr *embed_access(struct pet_expr *expr, void *user) -- 2.11.4.GIT