Hi Tobias, I'm currently working on generation of GCC expression trees from isl ast expressions . Could you please answer a few questions about it?
1. How is it better to generate tree from isl_ast_expr_int? In the temporary variant I call isl_ast_expr_get_int to get isl_int from isl_ast_expr. After this, gmp_cst_to_tree (it was used in graphite-clast-to-gimple.c) is called to generate tree frome isl_int. It is possible now, because isl_int is mpz_t. However, it can be changed in the future, according to comments from its source code. +/* Converts a GMP constant VAL to a tree and returns it. */ + +static tree +gmp_cst_to_tree (tree type, mpz_t val) +{ + tree t = type ? type : integer_type_node; + mpz_t tmp; + + mpz_init (tmp); + mpz_set (tmp, val); + wide_int wi = wi::from_mpz (t, tmp, true); + mpz_clear (tmp); + + return wide_int_to_tree (t, wi); +} +/* Converts a isl_ast_expr_int expression E to a GCC expression tree of + type TYPE. */ + +static tree +gcc_expression_from_isl_expr_int (tree type, __isl_keep isl_ast_expr *expr) +{ + gcc_assert (isl_ast_expr_get_type (expr) == isl_ast_expr_int); + isl_int val; + isl_int_init (val); + if (isl_ast_expr_get_int (expr, &val) == -1) + { + isl_int_clear (val); + return NULL_TREE; + } + else + return gmp_cst_to_tree (type, val); +} + 2. As you said in previous messages, we can always use signed 64/128, until isl is able to give information about types. I haven't found them in types of Generic (https://gcc.gnu.org/onlinedocs/gccint/Types.html#Types). Could they be declared using build_nonstandard_integer_type (128, 1)? 3. If I am not mistaken, the structure ivs_params from graphite-clast-to-gimple.c is used to store induction variables and parameters, rename them according to SSA form. Could it be used in graphite-isl-ast-to-gimple.c, too? 4. Should we transform all isl_ast_expr_op types of isl ast expressions to GCC expression tree? For example, the following types are not transformed at all in Polly project: isl_ast_op_cond, isl_ast_op_and_then, isl_ast_op_or_else, isl_ast_op_call, isl_ast_op_member, isl_ast_op_access, isl_ast_op_pdiv_q, isl_ast_op_pdiv_r, isl_ast_op_div, isl_ast_op_fdiv_q. The first draft of generation of GCC expression trees from isl ast expressions can be found below: -- Cheers, Roman Gareev
patch
Description: Binary data