Ejemplo n.º 1
0
/* Update the given lower bound on level such that it satisfies the stride
 * constraint.  The computation performed here is essentially the same
 * as that performed in constraint_stride_lower_c.
 *
 * We update the constraint
 *
 *	a i + f >= 0
 *
 * to
 *
 *	i >= s * ceil((-f/a - d)/s) + d
 *
 * with s the stride and d the offset encoded in the stride constraint.
 */
CloogConstraint *cloog_constraint_stride_lower_bound(CloogConstraint *c,
	int level, CloogStride *stride)
{
	isl_constraint *stride_c = cloog_constraint_to_isl(stride->constraint);
	isl_constraint *bound = cloog_constraint_to_isl(c);
	isl_aff *offset;
	isl_aff *lower;

	lower = isl_constraint_get_bound(bound, isl_dim_set, level - 1);
	isl_constraint_free(bound);

	offset = extract_stride_offset(stride_c, level, stride);

	lower = isl_aff_sub(lower, isl_aff_copy(offset));
	lower = isl_aff_scale_down(lower, stride->stride);
	lower = isl_aff_ceil(lower);
	lower = isl_aff_scale(lower, stride->stride);
	lower = isl_aff_add(lower, offset);
	lower = isl_aff_neg(lower);
	lower = isl_aff_add_coefficient_si(lower, isl_dim_in, level - 1, 1);

	bound = isl_inequality_from_aff(lower);

	return cloog_constraint_from_isl_constraint(bound);
}
Ejemplo n.º 2
0
/* Make a copy of "si" and return it.
 */
__isl_give isl_stride_info *isl_stride_info_copy(
	__isl_keep isl_stride_info *si)
{
	if (!si)
		return NULL;

	return isl_stride_info_alloc(isl_val_copy(si->stride),
		isl_aff_copy(si->offset));
}
Ejemplo n.º 3
0
/* Return the offset of "si".
 */
__isl_give isl_aff *isl_stride_info_get_offset(__isl_keep isl_stride_info *si)
{
	if (!si)
		return NULL;
	return isl_aff_copy(si->offset);
}