/* Expand the constraint "c" into "v". The initial "dim" dimensions * are the same, but "v" may have more divs than "c" and the divs of "c" * may appear in different positions in "v". * The number of divs in "c" is given by "n_div" and the mapping * of divs in "c" to divs in "v" is given by "div_map". * * Although it shouldn't happen in practice, it is theoretically * possible that two or more divs in "c" are mapped to the same div in "v". * These divs are then necessarily the same, so we simply add their * coefficients. */ static void expand_constraint(isl_vec *v, unsigned dim, isl_int *c, int *div_map, unsigned n_div) { int i; isl_seq_cpy(v->el, c, 1 + dim); isl_seq_clr(v->el + 1 + dim, v->size - (1 + dim)); for (i = 0; i < n_div; ++i) { int pos = 1 + dim + div_map[i]; isl_int_add(v->el[pos], v->el[pos], c[1 + dim + i]); } }
static int increment_range(struct isl_scan_callback *cb, isl_int min, isl_int max) { struct isl_counter *cnt = (struct isl_counter *)cb; isl_int_add(cnt->count, cnt->count, max); isl_int_sub(cnt->count, cnt->count, min); isl_int_add_ui(cnt->count, cnt->count, 1); if (isl_int_is_zero(cnt->max) || isl_int_lt(cnt->count, cnt->max)) return 0; isl_int_set(cnt->count, cnt->max); return -1; }
static int add_constant_term(CloogConstraint *c, void *user) { isl_int *bound = (isl_int *)user; isl_int v; isl_int_init(v); cloog_constraint_constant_get(c, &v); isl_int_add(*bound, *bound, v); isl_int_clear(v); return 0; }