/* Translation of CLAST (CLooG AST) to Gimple.
- Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
Contributed by Sebastian Pop <sebastian.pop@amd.com>.
This file is part of GCC.
#include "graphite-dependences.h"
#include "graphite-cloog-compat.h"
+#ifndef CLOOG_LANGUAGE_C
+#define CLOOG_LANGUAGE_C LANGUAGE_C
+#endif
+
/* This flag is set when an error occurred during the translation of
CLAST to Gimple. */
static bool gloog_error;
}
/* Stores the INDEX in a vector and the loop nesting LEVEL for a given
- clast NAME. */
+ clast NAME. BOUND_ONE and BOUND_TWO represent the exact lower and
+ upper bounds that can be inferred from the polyhedral representation. */
typedef struct clast_name_index {
int index;
int level;
+ mpz_t bound_one, bound_two;
const char *name;
} *clast_name_index_p;
/* Returns a pointer to a new element of type clast_name_index_p built
- from NAME, LEVEL, and INDEX. */
+ from NAME, INDEX, LEVEL, BOUND_ONE, and BOUND_TWO. */
static inline clast_name_index_p
-new_clast_name_index (const char *name, int index, int level)
+new_clast_name_index (const char *name, int index, int level,
+ mpz_t bound_one, mpz_t bound_two)
{
clast_name_index_p res = XNEW (struct clast_name_index);
res->name = name;
res->level = level;
res->index = index;
+ mpz_init (res->bound_one);
+ mpz_init (res->bound_two);
+ mpz_set (res->bound_one, bound_one);
+ mpz_set (res->bound_two, bound_two);
return res;
}
+/* Free the memory taken by a clast_name_index struct. */
+
+static void
+free_clast_name_index (void *ptr)
+{
+ struct clast_name_index *c = (struct clast_name_index *) ptr;
+ mpz_clear (c->bound_one);
+ mpz_clear (c->bound_two);
+ free (ptr);
+}
+
/* For a given clast NAME, returns -1 if NAME is not in the
INDEX_TABLE, otherwise returns the loop level for the induction
variable NAME, or if it is a parameter, the parameter number in the
return -1;
}
+/* For a given clast NAME, initializes the lower and upper bounds BOUND_ONE
+ and BOUND_TWO stored in the INDEX_TABLE. Returns true when NAME has been
+ found in the INDEX_TABLE, false otherwise. */
+
+static inline bool
+clast_name_to_lb_ub (clast_name_p name, htab_t index_table, mpz_t bound_one,
+ mpz_t bound_two)
+{
+ struct clast_name_index tmp;
+ PTR *slot;
+
+#ifdef CLOOG_ORG
+ gcc_assert (name->type == clast_expr_name);
+ tmp.name = ((const struct clast_name *) name)->name;
+#else
+ tmp.name = name;
+#endif
+
+ slot = htab_find_slot (index_table, &tmp, NO_INSERT);
+
+ if (slot && *slot)
+ {
+ mpz_set (bound_one, ((struct clast_name_index *) *slot)->bound_one);
+ mpz_set (bound_two, ((struct clast_name_index *) *slot)->bound_two);
+ return true;
+ }
+
+ return false;
+}
+
/* Records in INDEX_TABLE the INDEX and LEVEL for NAME. */
static inline void
save_clast_name_index (htab_t index_table, const char *name,
- int index, int level)
+ int index, int level, mpz_t bound_one, mpz_t bound_two)
{
struct clast_name_index tmp;
PTR *slot;
{
free (*slot);
- *slot = new_clast_name_index (name, index, level);
+ *slot = new_clast_name_index (name, index, level, bound_one, bound_two);
}
}
return VEC_index (tree, *(ip->newivs), index);
}
-/* Returns the signed maximal precision type for expressions TYPE1 and TYPE2. */
+/* Returns the maximal precision type for expressions TYPE1 and TYPE2. */
static tree
-max_signed_precision_type (tree type1, tree type2)
+max_precision_type (tree type1, tree type2)
{
- int p1 = TYPE_PRECISION (type1);
- int p2 = TYPE_PRECISION (type2);
- int precision;
- tree type;
enum machine_mode mode;
+ int p1, p2, precision;
+ tree type;
+
+ if (POINTER_TYPE_P (type1))
+ return type1;
+
+ if (POINTER_TYPE_P (type2))
+ return type2;
+
+ if (TYPE_UNSIGNED (type1)
+ && TYPE_UNSIGNED (type2))
+ return TYPE_PRECISION (type1) > TYPE_PRECISION (type2) ? type1 : type2;
+
+ p1 = TYPE_PRECISION (type1);
+ p2 = TYPE_PRECISION (type2);
if (p1 > p2)
precision = TYPE_UNSIGNED (type1) ? p1 * 2 : p1;
return type;
}
-/* Returns the maximal precision type for expressions TYPE1 and TYPE2. */
-
-static tree
-max_precision_type (tree type1, tree type2)
-{
- if (POINTER_TYPE_P (type1))
- return type1;
-
- if (POINTER_TYPE_P (type2))
- return type2;
-
- if (!TYPE_UNSIGNED (type1)
- || !TYPE_UNSIGNED (type2))
- return max_signed_precision_type (type1, type2);
-
- return TYPE_PRECISION (type1) > TYPE_PRECISION (type2) ? type1 : type2;
-}
-
static tree
clast_to_gcc_expression (tree, struct clast_expr *, ivs_params_p);
tree name = clast_name_to_gcc (t->var, ip);
if (POINTER_TYPE_P (TREE_TYPE (name)) != POINTER_TYPE_P (type))
- name = fold_convert (sizetype, name);
+ name = convert_to_ptrofftype (name);
name = fold_convert (type, name);
return name;
tree name = clast_name_to_gcc (t->var, ip);
if (POINTER_TYPE_P (TREE_TYPE (name)) != POINTER_TYPE_P (type))
- name = fold_convert (sizetype, name);
+ name = convert_to_ptrofftype (name);
name = fold_convert (type, name);
tree cst = gmp_cst_to_tree (type, t->val);
if (POINTER_TYPE_P (TREE_TYPE (name)) != POINTER_TYPE_P (type))
- name = fold_convert (sizetype, name);
+ name = convert_to_ptrofftype (name);
name = fold_convert (type, name);
return NULL_TREE;
}
-/* Return a type that could represent the values between V1 and V2. */
+/* Return a type that could represent the values between BOUND_ONE and
+ BOUND_TWO. */
static tree
-gcc_type_for_interval (mpz_t v1, mpz_t v2)
+type_for_interval (mpz_t bound_one, mpz_t bound_two)
{
bool unsigned_p;
tree type;
enum machine_mode mode;
- int precision = MAX (mpz_sizeinbase (v1, 2),
- mpz_sizeinbase (v2, 2));
+ int wider_precision;
+ int precision = MAX (mpz_sizeinbase (bound_one, 2),
+ mpz_sizeinbase (bound_two, 2));
if (precision > BITS_PER_WORD)
{
return integer_type_node;
}
- if (mpz_cmp (v1, v2) <= 0)
- unsigned_p = (mpz_sgn (v1) >= 0);
+ if (mpz_cmp (bound_one, bound_two) <= 0)
+ unsigned_p = (mpz_sgn (bound_one) >= 0);
else
- unsigned_p = (mpz_sgn (v2) >= 0);
+ unsigned_p = (mpz_sgn (bound_two) >= 0);
mode = smallest_mode_for_size (precision, MODE_INT);
- precision = GET_MODE_PRECISION (mode);
- type = build_nonstandard_integer_type (precision, unsigned_p);
+ wider_precision = GET_MODE_PRECISION (mode);
+
+ /* As we want to generate signed types as much as possible, try to
+ fit the interval [bound_one, bound_two] in a signed type. For example,
+ supposing that we have the interval [0, 100], instead of
+ generating unsigned char, we want to generate a signed char. */
+ if (unsigned_p && precision < wider_precision)
+ unsigned_p = false;
+
+ type = build_nonstandard_integer_type (wider_precision, unsigned_p);
if (!type)
{
otherwise return NULL_TREE. */
static tree
-gcc_type_for_value (mpz_t val)
+type_for_value (mpz_t val)
{
- return gcc_type_for_interval (val, val);
+ return type_for_interval (val, val);
}
-/* Return the type for the clast_term T used in STMT. */
+/* Return the type for the clast_term T. Initializes BOUND_ONE and
+ BOUND_TWO to the bounds of the term. */
static tree
-gcc_type_for_clast_term (struct clast_term *t,
- ivs_params_p ip)
+type_for_clast_term (struct clast_term *t, ivs_params_p ip, mpz_t bound_one,
+ mpz_t bound_two)
{
+ clast_name_p name = t->var;
+ bool found = false;
+
gcc_assert (t->expr.type == clast_expr_term);
- if (!t->var)
- return gcc_type_for_value (t->val);
+ if (!name)
+ {
+ mpz_set (bound_one, t->val);
+ mpz_set (bound_two, t->val);
+ return type_for_value (t->val);
+ }
+
+ if (ip->params && ip->params_index)
+ found = clast_name_to_lb_ub (name, ip->params_index, bound_one, bound_two);
+
+ if (!found)
+ {
+ gcc_assert (*(ip->newivs) && ip->newivs_index);
+ found = clast_name_to_lb_ub (name, ip->newivs_index,
+ bound_one, bound_two);
+ gcc_assert (found);
+ }
- return TREE_TYPE (clast_name_to_gcc (t->var, ip));
+ mpz_mul (bound_one, bound_one, t->val);
+ mpz_mul (bound_two, bound_two, t->val);
+
+ return TREE_TYPE (clast_name_to_gcc (name, ip));
}
static tree
-gcc_type_for_clast_expr (struct clast_expr *, ivs_params_p);
+type_for_clast_expr (struct clast_expr *, ivs_params_p, mpz_t, mpz_t);
-/* Return the type for the clast_reduction R used in STMT. */
+/* Return the type for the clast_reduction R. Initializes BOUND_ONE
+ and BOUND_TWO to the bounds of the reduction expression. */
static tree
-gcc_type_for_clast_red (struct clast_reduction *r,
- ivs_params_p ip)
+type_for_clast_red (struct clast_reduction *r, ivs_params_p ip,
+ mpz_t bound_one, mpz_t bound_two)
{
int i;
- tree type = NULL_TREE;
+ tree type = type_for_clast_expr (r->elts[0], ip, bound_one, bound_two);
+ mpz_t b1, b2, m1, m2;
if (r->n == 1)
- return gcc_type_for_clast_expr (r->elts[0], ip);
+ return type;
- switch (r->type)
- {
- case clast_red_sum:
- case clast_red_min:
- case clast_red_max:
- type = gcc_type_for_clast_expr (r->elts[0], ip);
- for (i = 1; i < r->n; i++)
- type = max_precision_type (type, gcc_type_for_clast_expr
- (r->elts[i], ip));
+ mpz_init (b1);
+ mpz_init (b2);
+ mpz_init (m1);
+ mpz_init (m2);
- return type;
-
- default:
- break;
+ for (i = 1; i < r->n; i++)
+ {
+ tree t = type_for_clast_expr (r->elts[i], ip, b1, b2);
+ type = max_precision_type (type, t);
+
+ switch (r->type)
+ {
+ case clast_red_sum:
+ value_min (m1, bound_one, bound_two);
+ value_min (m2, b1, b2);
+ mpz_add (bound_one, m1, m2);
+
+ value_max (m1, bound_one, bound_two);
+ value_max (m2, b1, b2);
+ mpz_add (bound_two, m1, m2);
+ break;
+
+ case clast_red_min:
+ value_min (bound_one, bound_one, bound_two);
+ value_min (bound_two, b1, b2);
+ break;
+
+ case clast_red_max:
+ value_max (bound_one, bound_one, bound_two);
+ value_max (bound_two, b1, b2);
+ break;
+
+ default:
+ gcc_unreachable ();
+ break;
+ }
}
- gcc_unreachable ();
- return NULL_TREE;
+ mpz_clear (b1);
+ mpz_clear (b2);
+ mpz_clear (m1);
+ mpz_clear (m2);
+
+ /* Return a type that can represent the result of the reduction. */
+ return max_precision_type (type, type_for_interval (bound_one, bound_two));
}
/* Return the type for the clast_binary B used in STMT. */
static tree
-gcc_type_for_clast_bin (struct clast_binary *b, ivs_params_p ip)
+type_for_clast_bin (struct clast_binary *b, ivs_params_p ip, mpz_t bound_one,
+ mpz_t bound_two)
{
- tree l = gcc_type_for_clast_expr ((struct clast_expr *) b->LHS, ip);
- tree r = gcc_type_for_value (b->RHS);
- return max_signed_precision_type (l, r);
+ mpz_t one;
+ tree l = type_for_clast_expr ((struct clast_expr *) b->LHS, ip,
+ bound_one, bound_two);
+ tree r = type_for_value (b->RHS);
+ tree type = max_precision_type (l, r);
+
+ switch (b->type)
+ {
+ case clast_bin_fdiv:
+ mpz_mdiv (bound_one, bound_one, b->RHS);
+ mpz_mdiv (bound_two, bound_two, b->RHS);
+ break;
+
+ case clast_bin_cdiv:
+ mpz_mdiv (bound_one, bound_one, b->RHS);
+ mpz_mdiv (bound_two, bound_two, b->RHS);
+ mpz_init (one);
+ mpz_add (bound_one, bound_one, one);
+ mpz_add (bound_two, bound_two, one);
+ mpz_clear (one);
+ break;
+
+ case clast_bin_div:
+ mpz_div (bound_one, bound_one, b->RHS);
+ mpz_div (bound_two, bound_two, b->RHS);
+ break;
+
+ case clast_bin_mod:
+ mpz_mod (bound_one, bound_one, b->RHS);
+ mpz_mod (bound_two, bound_two, b->RHS);
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+
+ /* Return a type that can represent the result of the reduction. */
+ return max_precision_type (type, type_for_interval (bound_one, bound_two));
}
/* Returns the type for the CLAST expression E when used in statement
STMT. */
static tree
-gcc_type_for_clast_expr (struct clast_expr *e,
- ivs_params_p ip)
+type_for_clast_expr (struct clast_expr *e, ivs_params_p ip, mpz_t bound_one,
+ mpz_t bound_two)
{
switch (e->type)
{
case clast_expr_term:
- return gcc_type_for_clast_term ((struct clast_term *) e, ip);
+ return type_for_clast_term ((struct clast_term *) e, ip,
+ bound_one, bound_two);
case clast_expr_red:
- return gcc_type_for_clast_red ((struct clast_reduction *) e, ip);
+ return type_for_clast_red ((struct clast_reduction *) e, ip,
+ bound_one, bound_two);
case clast_expr_bin:
- return gcc_type_for_clast_bin ((struct clast_binary *) e, ip);
+ return type_for_clast_bin ((struct clast_binary *) e, ip,
+ bound_one, bound_two);
default:
gcc_unreachable ();
/* Returns the type for the equation CLEQ. */
static tree
-gcc_type_for_clast_eq (struct clast_equation *cleq,
- ivs_params_p ip)
+type_for_clast_eq (struct clast_equation *cleq, ivs_params_p ip)
{
- tree l = gcc_type_for_clast_expr (cleq->LHS, ip);
- tree r = gcc_type_for_clast_expr (cleq->RHS, ip);
+ mpz_t bound_one, bound_two;
+ tree l, r;
+
+ mpz_init (bound_one);
+ mpz_init (bound_two);
+
+ l = type_for_clast_expr (cleq->LHS, ip, bound_one, bound_two);
+ r = type_for_clast_expr (cleq->RHS, ip, bound_one, bound_two);
+
+ mpz_clear (bound_one);
+ mpz_clear (bound_two);
return max_precision_type (l, r);
}
ivs_params_p ip)
{
enum tree_code comp;
- tree type = gcc_type_for_clast_eq (cleq, ip);
+ tree type = type_for_clast_eq (cleq, ip);
tree lhs = clast_to_gcc_expression (type, cleq->LHS, ip);
tree rhs = clast_to_gcc_expression (type, cleq->RHS, ip);
return exit_edge;
}
+/* Compute the lower bound LOW and upper bound UP for the parameter
+ PARAM in scop SCOP based on the constraints in the context. */
+
+static void
+compute_bounds_for_param (scop_p scop, int param, mpz_t low, mpz_t up)
+{
+ ppl_Linear_Expression_t le;
+
+ /* Prepare the linear expression corresponding to the parameter that
+ we want to maximize/minimize. */
+ ppl_new_Linear_Expression_with_dimension (&le, scop_nb_params (scop));
+ ppl_set_coef (le, param, 1);
+
+ ppl_max_for_le_pointset (SCOP_CONTEXT (scop), le, up);
+ ppl_min_for_le_pointset (SCOP_CONTEXT (scop), le, low);
+ ppl_delete_Linear_Expression (le);
+}
+
/* Compute the lower bound LOW and upper bound UP for the induction
variable at LEVEL for the statement PBB, based on the transformed
scattering of PBB: T|I|G|Cst, with T the scattering transform, I
ppl_delete_Pointset_Powerset_C_Polyhedron (ps);
}
-/* Compute the type for the induction variable at LEVEL for the
- statement PBB, based on the transformed schedule of PBB. */
-
-static tree
-compute_type_for_level (poly_bb_p pbb, int level)
-{
- mpz_t low, up;
- tree type;
-
- mpz_init (low);
- mpz_init (up);
-
- compute_bounds_for_level (pbb, level, low, up);
- type = gcc_type_for_interval (low, up);
-
- mpz_clear (low);
- mpz_clear (up);
- return type;
-}
-
/* Walks a CLAST and returns the first statement in the body of a
loop.
if (CLAST_STMT_IS_A (stmt, stmt_block))
return clast_get_body_of_loop (((struct clast_block *) stmt)->body);
+ if (CLAST_STMT_IS_A (stmt, stmt_ass))
+ return clast_get_body_of_loop (stmt->next);
+
gcc_unreachable ();
}
from STMT_FOR. */
static tree
-gcc_type_for_iv_of_clast_loop (struct clast_for *stmt_for, int level,
- tree lb_type, tree ub_type)
+type_for_clast_for (struct clast_for *stmt_for, ivs_params_p ip)
{
- struct clast_stmt *stmt = (struct clast_stmt *) stmt_for;
- struct clast_user_stmt *body = clast_get_body_of_loop (stmt);
- CloogStatement *cs = body->statement;
- poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (cs);
+ mpz_t bound_one, bound_two;
+ tree lb_type, ub_type;
+
+ mpz_init (bound_one);
+ mpz_init (bound_two);
+
+ lb_type = type_for_clast_expr (stmt_for->LB, ip, bound_one, bound_two);
+ ub_type = type_for_clast_expr (stmt_for->UB, ip, bound_one, bound_two);
- return max_signed_precision_type (lb_type, max_precision_type
- (ub_type, compute_type_for_level
- (pbb, level)));
+ mpz_clear (bound_one);
+ mpz_clear (bound_two);
+
+ return max_precision_type (lb_type, ub_type);
}
/* Creates a new LOOP corresponding to Cloog's STMT. Inserts an
loop_p outer, tree type, tree lb, tree ub,
int level, ivs_params_p ip)
{
+ mpz_t low, up;
+
+ struct clast_user_stmt *body
+ = clast_get_body_of_loop ((struct clast_stmt *) stmt);
+ poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (body->statement);
+
tree stride = gmp_cst_to_tree (type, stmt->stride);
tree ivvar = create_tmp_var (type, "graphite_IV");
tree iv, iv_after_increment;
add_referenced_var (ivvar);
+ mpz_init (low);
+ mpz_init (up);
+ compute_bounds_for_level (pbb, level, low, up);
save_clast_name_index (ip->newivs_index, stmt->iterator,
- VEC_length (tree, *(ip->newivs)), level);
+ VEC_length (tree, *(ip->newivs)), level, low, up);
+ mpz_clear (low);
+ mpz_clear (up);
VEC_safe_push (tree, heap, *(ip->newivs), iv);
return loop;
}
CloogStatement *cs = user_stmt->statement;
poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (cs);
gimple_bb_p gbb = PBB_BLACK_BOX (pbb);
+ mpz_t bound_one, bound_two;
+
+ mpz_init (bound_one);
+ mpz_init (bound_two);
for (t = user_stmt->substitutions; t; t = t->next, depth++)
{
struct clast_expr *expr = (struct clast_expr *)
((struct clast_assignment *)t)->RHS;
- tree type = gcc_type_for_clast_expr (expr, ip);
+ tree type = type_for_clast_expr (expr, ip, bound_one, bound_two);
tree new_name = clast_to_gcc_expression (type, expr, ip);
loop_p old_loop = gbb_loop_at_index (gbb, ip->region, depth);
VEC_replace (tree, iv_map, old_loop->num, new_name);
}
+
+ mpz_clear (bound_one);
+ mpz_clear (bound_two);
}
/* Construct bb_pbb_def with BB and PBB. */
build_iv_mapping (iv_map, stmt, ip);
next_e = copy_bb_and_scalar_dependences (GBB_BB (gbb), ip->region,
- next_e, iv_map);
+ next_e, iv_map, &gloog_error);
VEC_free (tree, heap, iv_map);
new_bb = next_e->src;
static edge
graphite_create_new_loop_guard (edge entry_edge, struct clast_for *stmt,
- int level, tree *type, tree *lb, tree *ub,
+ tree *type, tree *lb, tree *ub,
ivs_params_p ip)
{
tree cond_expr;
edge exit_edge;
- tree lb_type = gcc_type_for_clast_expr (stmt->LB, ip);
- tree ub_type = gcc_type_for_clast_expr (stmt->UB, ip);
- *type = gcc_type_for_iv_of_clast_loop (stmt, level, lb_type, ub_type);
+ *type = type_for_clast_for (stmt, ip);
*lb = clast_to_gcc_expression (*type, stmt->LB, ip);
*ub = clast_to_gcc_expression (*type, stmt->UB, ip);
else
{
tree one = (POINTER_TYPE_P (*type)
- ? size_one_node
+ ? convert_to_ptrofftype (integer_one_node)
: fold_convert (*type, integer_one_node));
/* Adding +1 and using LT_EXPR helps with loop latches that have a
loop iteration count of "PARAMETER - 1". For PARAMETER == 0 this becomes
htab_t bb_pbb_mapping, int level, ivs_params_p ip)
{
tree type, lb, ub;
- edge last_e = graphite_create_new_loop_guard (next_e, stmt, level, &type,
+ edge last_e = graphite_create_new_loop_guard (next_e, stmt, &type,
&lb, &ub, ip);
edge true_e = get_true_edge_from_guard_bb (next_e->dest);
return last_e;
}
+/* Translates a clast assignment STMT to gimple.
+
+ - NEXT_E is the edge where new generated code should be attached.
+ - BB_PBB_MAPPING is is a basic_block and it's related poly_bb_p mapping. */
+
+static edge
+translate_clast_assignment (struct clast_assignment *stmt, edge next_e,
+ int level, ivs_params_p ip)
+{
+ gimple_seq stmts;
+ mpz_t bound_one, bound_two;
+ tree type, new_name, var;
+ edge res = single_succ_edge (split_edge (next_e));
+ struct clast_expr *expr = (struct clast_expr *) stmt->RHS;
+
+ mpz_init (bound_one);
+ mpz_init (bound_two);
+ type = type_for_clast_expr (expr, ip, bound_one, bound_two);
+ var = create_tmp_var (type, "graphite_var");
+ new_name = force_gimple_operand (clast_to_gcc_expression (type, expr, ip),
+ &stmts, true, var);
+ add_referenced_var (var);
+ if (stmts)
+ {
+ gsi_insert_seq_on_edge (next_e, stmts);
+ gsi_commit_edge_inserts ();
+ }
+
+ save_clast_name_index (ip->newivs_index, stmt->LHS,
+ VEC_length (tree, *(ip->newivs)), level,
+ bound_one, bound_two);
+ VEC_safe_push (tree, heap, *(ip->newivs), new_name);
+
+ mpz_clear (bound_one);
+ mpz_clear (bound_two);
+
+ return res;
+}
+
/* Translates a clast guard statement STMT to gimple.
- NEXT_E is the edge where new generated code should be attached.
else if (CLAST_STMT_IS_A (stmt, stmt_block))
next_e = translate_clast (context_loop, ((struct clast_block *) stmt)->body,
next_e, bb_pbb_mapping, level, ip);
+
+ else if (CLAST_STMT_IS_A (stmt, stmt_ass))
+ next_e = translate_clast_assignment ((struct clast_assignment *) stmt,
+ next_e, level, ip);
else
gcc_unreachable();
/* Change cloog output language to C. If we do use FORTRAN instead, cloog
will stop e.g. with "ERROR: unbounded loops not allowed in FORTRAN.", if
we pass an incomplete program to cloog. */
- options->language = LANGUAGE_C;
+ options->language = CLOOG_LANGUAGE_C;
/* Enable complex equality spreading: removes dummy statements
(assignments) in the generated code which repeats the
back from CLooG names to GCC trees. */
static void
-create_params_index (htab_t index_table, CloogProgram *prog) {
+create_params_index (scop_p scop, htab_t index_table, CloogProgram *prog) {
CloogNames* names = cloog_program_names (prog);
int nb_parameters = cloog_names_nb_parameters (names);
char **parameters = cloog_names_parameters (names);
int i;
+ mpz_t bound_one, bound_two;
+
+ mpz_init (bound_one);
+ mpz_init (bound_two);
for (i = 0; i < nb_parameters; i++)
- save_clast_name_index (index_table, parameters[i], i, i);
+ {
+ compute_bounds_for_param (scop, i, bound_one, bound_two);
+ save_clast_name_index (index_table, parameters[i], i, i,
+ bound_one, bound_two);
+ }
+
+ mpz_clear (bound_one);
+ mpz_clear (bound_two);
}
/* GIMPLE Loop Generator: generates loops from STMT in GIMPLE form for
context_loop = SESE_ENTRY (region)->src->loop_father;
newivs_index = htab_create (10, clast_name_index_elt_info,
- eq_clast_name_indexes, free);
+ eq_clast_name_indexes, free_clast_name_index);
params_index = htab_create (10, clast_name_index_elt_info,
- eq_clast_name_indexes, free);
+ eq_clast_name_indexes, free_clast_name_index);
- create_params_index (params_index, pc.prog);
+ create_params_index (scop, params_index, pc.prog);
ip.newivs = &newivs;
ip.newivs_index = newivs_index;