Ejemplo n.º 1
0
/* Extend the ranges of the maps in the union map such they all have
 * the same dimension.
 */
__isl_give isl_union_map *align_range(__isl_take isl_union_map *umap)
{
    struct align_range_data data;

    data.max_out = 0;
    isl_union_map_foreach_map(umap, &update_max_out, &data.max_out);

    data.res = isl_union_map_empty(isl_union_map_get_space(umap));
    isl_union_map_foreach_map(umap, &map_align_range, &data);

    isl_union_map_free(umap);
    return data.res;
}
Ejemplo n.º 2
0
/* Call isl_map_move_dims with the given arguments on each of the maps
 * in "umap" and return the union of the results.
 *
 * This function can only meaningfully be called on a union map
 * where all maps have the same space for both dst_type and src_type.
 * One of these should then be isl_dim_param as otherwise the union map
 * could only contain a single map.
 */
__isl_give isl_union_map *pet_union_map_move_dims(
	__isl_take isl_union_map *umap,
	enum isl_dim_type dst_type, unsigned dst_pos,
	enum isl_dim_type src_type, unsigned src_pos, unsigned n)
{
	isl_space *space;
	struct pet_union_map_move_dims_data data =
		{ dst_type, dst_pos, src_type, src_pos, n };

	space = isl_union_map_get_space(umap);
	if (src_type == isl_dim_param)
		space = isl_space_drop_dims(space, src_type, src_pos, n);
	data.res = isl_union_map_empty(space);
	if (isl_union_map_foreach_map(umap, &map_move_dims, &data) < 0)
		data.res = isl_union_map_free(data.res);

	isl_union_map_free(umap);
	return data.res;
}