/* Return a new isl_schedule_band with partial schedule "mupa".
 * First replace "mupa" by its greatest integer part to ensure
 * that the schedule is always integral.
 * The band is not marked permutable, the dimensions are not
 * marked coincident and the AST build options are empty.
 * Since there are no build options, the node is not anchored.
 */
__isl_give isl_schedule_band *isl_schedule_band_from_multi_union_pw_aff(
	__isl_take isl_multi_union_pw_aff *mupa)
{
	isl_ctx *ctx;
	isl_schedule_band *band;
	isl_space *space;

	mupa = isl_multi_union_pw_aff_floor(mupa);
	if (!mupa)
		return NULL;
	ctx = isl_multi_union_pw_aff_get_ctx(mupa);
	band = isl_schedule_band_alloc(ctx);
	if (!band)
		goto error;

	band->n = isl_multi_union_pw_aff_dim(mupa, isl_dim_set);
	band->coincident = isl_calloc_array(ctx, int, band->n);
	band->mupa = mupa;
	space = isl_space_params_alloc(ctx, 0);
	band->ast_build_options = isl_union_set_empty(space);
	band->anchored = 0;

	if ((band->n && !band->coincident) || !band->ast_build_options)
		return isl_schedule_band_free(band);

	return band;
error:
	isl_multi_union_pw_aff_free(mupa);
	return NULL;
}
Esempio n. 2
0
/* Free all memory allocated for "leaves".
 */
static void ppcg_grouping_leaf_free(int n, struct ppcg_grouping_leaf leaves[n])
{
	int i;

	if (!leaves)
		return;

	for (i = 0; i < n; ++i) {
		isl_union_set_free(leaves[i].domain);
		isl_union_set_list_free(leaves[i].list);
		isl_multi_union_pw_aff_free(leaves[i].prefix);
	}

	free(leaves);
}