示例#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;
}
示例#2
0
文件: aff.c 项目: realincubus/pet
/* 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;
}
示例#3
0
/* Extend the dimension of the range of the given map to data->max_out and
 * then add the result to data->res.
 */
static isl_stat map_align_range(__isl_take isl_map *map, void *user)
{
    struct align_range_data *data = user;
    int i;
    isl_space *dim;
    isl_map *proj;
    int n_out = isl_map_dim(map, isl_dim_out);

    dim = isl_union_map_get_space(data->res);
    proj = isl_map_reverse(projection(dim, data->max_out, n_out));
    for (i = n_out; i < data->max_out; ++i)
        proj = isl_map_fix_si(proj, isl_dim_out, i, 0);

    map = isl_map_apply_range(map, proj);

    data->res = isl_union_map_add_map(data->res, map);

    return isl_stat_ok;
}