From 5da715c44880353c726513295e851ead8e26a261 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 7 Mar 2014 12:00:48 +0100 Subject: [PATCH] move pet_nested_extract_expr to nest.c We were unable to move this function to nest.c before because until the previous commit, the nested expression could be a clang expression. Signed-off-by: Sven Verdoolaege --- nest.c | 9 +++++++++ nest.h | 1 + scan.cc | 13 ++----------- scan.h | 1 - 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/nest.c b/nest.c index f0fd820..7263a61 100644 --- a/nest.c +++ b/nest.c @@ -57,6 +57,15 @@ __isl_give isl_id *pet_nested_pet_expr(__isl_take pet_expr *expr) return id; } +/* Extract a pet_expr from an isl_id created by pet_nested_pet_expr. + * Such an isl_id has name "__pet_expr" and + * the user pointer points to a pet_expr object. + */ +__isl_give pet_expr *pet_nested_extract_expr(__isl_keep isl_id *id) +{ + return pet_expr_copy((pet_expr *) isl_id_get_user(id)); +} + /* Does "id" refer to a nested access created by pet_nested_pet_expr? */ int pet_nested_in_id(__isl_keep isl_id *id) diff --git a/nest.h b/nest.h index 193d3ce..08e2aae 100644 --- a/nest.h +++ b/nest.h @@ -14,6 +14,7 @@ extern "C" { #endif __isl_give isl_id *pet_nested_pet_expr(__isl_take pet_expr *expr); +__isl_give pet_expr *pet_nested_extract_expr(__isl_keep isl_id *id); int pet_nested_in_id(__isl_keep isl_id *id); int pet_nested_in_map(__isl_keep isl_map *map, int pos); diff --git a/scan.cc b/scan.cc index ddd13b7..29d3f65 100644 --- a/scan.cc +++ b/scan.cc @@ -2793,15 +2793,6 @@ struct pet_scop *PetScan::extract(CompoundStmt *stmt, bool skip_declarations) return extract(stmt->children(), !skip_declarations, skip_declarations); } -/* Extract a pet_expr from an isl_id created by pet_nested_pet_expr. - * Such an isl_id has name "__pet_expr" and - * the user pointer points to a pet_expr object. - */ -__isl_give pet_expr *PetScan::extract_expr(__isl_keep isl_id *id) -{ - return pet_expr_copy((pet_expr *) isl_id_get_user(id)); -} - /* For each nested access parameter in "space", * construct a corresponding pet_expr, place it in args and * record its position in "param2pos". @@ -2828,7 +2819,7 @@ int PetScan::extract_nested(__isl_keep isl_space *space, continue; } - args[n_arg] = extract_expr(id); + args[n_arg] = pet_nested_extract_expr(id); isl_id_free(id); if (!args[n_arg]) return -1; @@ -3563,7 +3554,7 @@ bool PetScan::is_nested_allowed(__isl_keep isl_pw_aff *pa, pet_scop *scop) continue; } - expr = extract_expr(id); + expr = pet_nested_extract_expr(id); allowed = pet_expr_get_type(expr) == pet_expr_access && !is_assigned(expr, scop); diff --git a/scan.h b/scan.h index 4c78472..a53960f 100644 --- a/scan.h +++ b/scan.h @@ -172,7 +172,6 @@ private: __isl_give pet_expr *extract_assume(clang::Expr *expr); __isl_give pet_expr *extract_argument(clang::FunctionDecl *fd, int pos, clang::Expr *expr); - __isl_give pet_expr *extract_expr(__isl_keep isl_id *id); __isl_give pet_expr *extract_expr(clang::Expr *expr); __isl_give pet_expr *extract_expr(clang::UnaryOperator *expr); __isl_give pet_expr *extract_expr(clang::BinaryOperator *expr); -- 2.11.4.GIT