From 078645863c8d9b779110c1a4f9549ee9fae92aff Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 15 Apr 2016 11:34:50 +0200 Subject: [PATCH] add pet_substituter::substitute(pet_expr *) This will be used to perform substitutions on size expressions. Signed-off-by: Sven Verdoolaege --- substituter.cc | 13 +++++++++++++ substituter.h | 1 + 2 files changed, 14 insertions(+) diff --git a/substituter.cc b/substituter.cc index 8ae6d2d..527325f 100644 --- a/substituter.cc +++ b/substituter.cc @@ -49,6 +49,19 @@ extern "C" { void *user); } +/* Perform the substitutions stored in "subs" on "expr" and return + * the results. + * In particular, perform the substitutions on each of the access + * subexpressions in "expr". + */ +__isl_give pet_expr *pet_substituter::substitute(__isl_take pet_expr *expr) +{ + if (subs.size() == 0) + return expr; + expr = pet_expr_map_access(expr, &substitute_access, this); + return expr; +} + /* Perform the substitutions stored in "subs" on "tree" and return * the results. * In particular, perform the substitutions on each of the access diff --git a/substituter.h b/substituter.h index 550e79e..5aa5624 100644 --- a/substituter.h +++ b/substituter.h @@ -16,6 +16,7 @@ struct pet_substituter { void add_sub(__isl_take isl_id *id, __isl_take pet_expr *expr); + __isl_give pet_expr *substitute(__isl_take pet_expr *expr); __isl_give pet_tree *substitute(__isl_take pet_tree *tree); ~pet_substituter(); -- 2.11.4.GIT