From c9a7ccccc68ffe1d4f36c2e2441e12dbdfead076 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Thu, 30 Jun 2016 16:22:37 +0200 Subject: [PATCH] python interface: expose isl_ast_build and isl_ast_expr construction We expose to the python bindings functionality to construct ast expressions from a set or pw_aff as well as call and access expressions from a pw_multi_aff or multi_pw_aff. This functionality is useful by itself to construct run-time guards and could in the future also be used to construct memory access functions for user statements during AST node generation. For isl_ast_build_from_context there is a choice of either using a named or an unnamed constructor. A named constructor is preferred as this is closer to isl's C interface and also more explicit for the user. isl_ast_build objects currently do not have a __str__ and __repr__ representation as we do not want to expose internal information to the user. isl_ast_expr uses the new YAML based representation which will allow us to support the re-construction of isl.ast_expr python objects later. Signed-off-by: Tobias Grosser Signed-off-by: Sven Verdoolaege --- include/isl/ast.h | 1 + include/isl/ast_build.h | 10 +++++++++- include/isl/ast_type.h | 2 +- interface/all.h | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/isl/ast.h b/include/isl/ast.h index aef070f6..db7ef90e 100644 --- a/include/isl/ast.h +++ b/include/isl/ast.h @@ -83,6 +83,7 @@ __isl_give isl_printer *isl_printer_print_ast_expr(__isl_take isl_printer *p, __isl_keep isl_ast_expr *expr); void isl_ast_expr_dump(__isl_keep isl_ast_expr *expr); __isl_give char *isl_ast_expr_to_str(__isl_keep isl_ast_expr *expr); +__isl_export __isl_give char *isl_ast_expr_to_C_str(__isl_keep isl_ast_expr *expr); __isl_give isl_ast_node *isl_ast_node_alloc_user(__isl_take isl_ast_expr *expr); diff --git a/include/isl/ast_build.h b/include/isl/ast_build.h index fa51873b..d84d15e5 100644 --- a/include/isl/ast_build.h +++ b/include/isl/ast_build.h @@ -10,7 +10,7 @@ extern "C" { #endif -struct isl_ast_build; +struct __isl_export isl_ast_build; typedef struct isl_ast_build isl_ast_build; @@ -45,7 +45,9 @@ int isl_options_get_ast_build_allow_or(isl_ctx *ctx); isl_ctx *isl_ast_build_get_ctx(__isl_keep isl_ast_build *build); +__isl_constructor __isl_give isl_ast_build *isl_ast_build_alloc(isl_ctx *ctx); +__isl_export __isl_give isl_ast_build *isl_ast_build_from_context(__isl_take isl_set *set); __isl_give isl_space *isl_ast_build_get_schedule_space( @@ -92,16 +94,22 @@ __isl_give isl_ast_build *isl_ast_build_set_create_leaf( __isl_give isl_ast_node *(*fn)(__isl_take isl_ast_build *build, void *user), void *user); +__isl_export __isl_give isl_ast_expr *isl_ast_build_expr_from_set( __isl_keep isl_ast_build *build, __isl_take isl_set *set); +__isl_export __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff( __isl_keep isl_ast_build *build, __isl_take isl_pw_aff *pa); +__isl_export __isl_give isl_ast_expr *isl_ast_build_access_from_pw_multi_aff( __isl_keep isl_ast_build *build, __isl_take isl_pw_multi_aff *pma); +__isl_export __isl_give isl_ast_expr *isl_ast_build_access_from_multi_pw_aff( __isl_keep isl_ast_build *build, __isl_take isl_multi_pw_aff *mpa); +__isl_export __isl_give isl_ast_expr *isl_ast_build_call_from_pw_multi_aff( __isl_keep isl_ast_build *build, __isl_take isl_pw_multi_aff *pma); +__isl_export __isl_give isl_ast_expr *isl_ast_build_call_from_multi_pw_aff( __isl_keep isl_ast_build *build, __isl_take isl_multi_pw_aff *mpa); diff --git a/include/isl/ast_type.h b/include/isl/ast_type.h index f18149ef..9ffc8a0a 100644 --- a/include/isl/ast_type.h +++ b/include/isl/ast_type.h @@ -7,7 +7,7 @@ extern "C" { #endif -struct isl_ast_expr; +struct __isl_export isl_ast_expr; typedef struct isl_ast_expr isl_ast_expr; struct isl_ast_node; diff --git a/interface/all.h b/interface/all.h index ebd2a547..ea0b4982 100644 --- a/interface/all.h +++ b/interface/all.h @@ -8,3 +8,4 @@ #include #include #include +#include -- 2.11.4.GIT