From 763ddc8c50b56d1b5f896804a1c215aef91c940d Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 27 Jun 2013 10:19:04 +0200 Subject: [PATCH] add pet_expr_from_index wrapper In order to be able to keep track of index expressions in the constructed pet_expr, we will gradually convert pet to use index expressions instead of access relation. As a first step, we introduce a wrapper that takes an index expression and converts it to an access relation. Signed-off-by: Sven Verdoolaege --- scop.c | 11 +++++++++++ scop.h | 1 + 2 files changed, 12 insertions(+) diff --git a/scop.c b/scop.c index ed33fbc..fc16821 100644 --- a/scop.c +++ b/scop.c @@ -159,6 +159,17 @@ error: return NULL; } +/* Construct an access pet_expr from an index expression. + * By default, the access is considered to be a read access. + */ +struct pet_expr *pet_expr_from_index(__isl_take isl_multi_pw_aff *index) +{ + isl_map *access; + + access = isl_map_from_multi_pw_aff(index); + return pet_expr_from_access(access); +} + /* Construct a pet_expr that kills the elements specified by "access". */ struct pet_expr *pet_expr_kill_from_access(__isl_take isl_map *access) diff --git a/scop.h b/scop.h index 44c4220..d76197c 100644 --- a/scop.h +++ b/scop.h @@ -20,6 +20,7 @@ enum pet_expr_type pet_str_type(const char *str); enum pet_op_type pet_str_op(const char *str); +struct pet_expr *pet_expr_from_index(__isl_take isl_multi_pw_aff *index); struct pet_expr *pet_expr_from_access(__isl_take isl_map *access); struct pet_expr *pet_expr_kill_from_access(__isl_take isl_map *access); struct pet_expr *pet_expr_new_unary(isl_ctx *ctx, enum pet_op_type op, -- 2.11.4.GIT