Refactor optimize isl

Refactor graphite-optimize-isl.c. Renamed function name, variable names etc.,
and indented the source according to gcc style guidelines.  Modified comments
accordingly. No functional change intended.

Passes regtest and bootstap on x86_64.

gcc/ChangeLog:

2015-09-10  Aditya Kumar  <aditya.k7@samsung.com>

        * graphite-optimize-isl.c (get_tile_map): Refactor.
        (get_schedule_for_band): Same.
        (getScheduleForBand): Same.
        (get_prevector_map): Same.
        (get_schedule_for_band_list): Same.
        (get_schedule_map): Same.
        (get_single_map): Same.
        (apply_schedule_map_to_scop): Same.
        (optimize_isl): Same.

From-SVN: r227695
This commit is contained in:
Aditya Kumar 2015-09-11 19:50:41 +00:00 committed by Sebastian Pop
parent fc00244420
commit ec62c3731d
2 changed files with 221 additions and 205 deletions

View file

@ -1,3 +1,15 @@
2015-09-11 Aditya Kumar <aditya.k7@samsung.com>
* graphite-optimize-isl.c (get_tile_map): Refactor.
(get_schedule_for_band): Same.
(getScheduleForBand): Same.
(get_prevector_map): Same.
(get_schedule_for_band_list): Same.
(get_schedule_map): Same.
(get_single_map): Same.
(apply_schedule_map_to_scop): Same.
(optimize_isl): Same.
2015-09-10 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> 2015-09-10 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
PR target/63304 PR target/63304

View file

@ -50,6 +50,9 @@ along with GCC; see the file COPYING3. If not see
#include "params.h" #include "params.h"
#include "dumpfile.h" #include "dumpfile.h"
/* Set this to true to disable tiling of nested loops. */
static bool disable_tiling = false;
static isl_union_set * static isl_union_set *
scop_get_domains (scop_p scop ATTRIBUTE_UNUSED) scop_get_domains (scop_p scop ATTRIBUTE_UNUSED)
{ {
@ -64,151 +67,152 @@ scop_get_domains (scop_p scop ATTRIBUTE_UNUSED)
return res; return res;
} }
/* getTileMap - Create a map that describes a n-dimensonal tiling. /* get_tile_map - Create a map that describes a n-dimensonal tiling.
getTileMap creates a map from a n-dimensional scattering space into an get_tile_map creates a map from a n-dimensional scattering space into an
2*n-dimensional scattering space. The map describes a rectangular tiling. 2*n-dimensional scattering space. The map describes a rectangular tiling.
Example: Example:
scheduleDimensions = 2, parameterDimensions = 1, tileSize = 32 SCHEDULE_DIMENSIONS = 2, PARAMETER_DIMENSIONS = 1, TILE_SIZE = 32
tileMap := [p0] -> {[s0, s1] -> [t0, t1, s0, s1]: tile_map := [p0] -> {[s0, s1] -> [t0, t1, s0, s1]:
t0 % 32 = 0 and t0 <= s0 < t0 + 32 and t0 % 32 = 0 and t0 <= s0 < t0 + 32 and
t1 % 32 = 0 and t1 <= s1 < t1 + 32} t1 % 32 = 0 and t1 <= s1 < t1 + 32}
Before tiling: Before tiling:
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
for (j = 0; j < M; j++) for (j = 0; j < M; j++)
S(i,j) S(i,j)
After tiling: After tiling:
for (t_i = 0; t_i < N; i+=32) for (t_i = 0; t_i < N; i+=32)
for (t_j = 0; t_j < M; j+=32) for (t_j = 0; t_j < M; j+=32)
for (i = t_i; i < min(t_i + 32, N); i++) | Unknown that N % 32 = 0 for (i = t_i; i < min(t_i + 32, N); i++) | Unknown that N % 32 = 0
for (j = t_j; j < t_j + 32; j++) | Known that M % 32 = 0 for (j = t_j; j < t_j + 32; j++) | Known that M % 32 = 0
S(i,j) S(i,j)
*/ */
static isl_basic_map * static isl_basic_map *
getTileMap (isl_ctx *ctx, int scheduleDimensions, int tileSize) get_tile_map (isl_ctx *ctx, int schedule_dimensions, int tile_size)
{ {
int x;
/* We construct /* We construct
tileMap := [p0] -> {[s0, s1] -> [t0, t1, p0, p1, a0, a1]: tile_map := [p0] -> {[s0, s1] -> [t0, t1, p0, p1, a0, a1]:
s0 = a0 * 32 and s0 = p0 and t0 <= p0 < t0 + 32 and s0 = a0 * 32 and s0 = p0 and t0 <= p0 < t0 + 32 and
s1 = a1 * 32 and s1 = p1 and t1 <= p1 < t1 + 32} s1 = a1 * 32 and s1 = p1 and t1 <= p1 < t1 + 32}
and project out the auxilary dimensions a0 and a1. */ and project out the auxilary dimensions a0 and a1. */
isl_space *Space = isl_space_alloc (ctx, 0, scheduleDimensions, isl_space *space
scheduleDimensions * 3); = isl_space_alloc (ctx, 0, schedule_dimensions, schedule_dimensions * 3);
isl_basic_map *tileMap = isl_basic_map_universe (isl_space_copy (Space)); isl_basic_map *tile_map = isl_basic_map_universe (isl_space_copy (space));
isl_local_space *LocalSpace = isl_local_space_from_space (Space); isl_local_space *local_space = isl_local_space_from_space (space);
for (x = 0; x < scheduleDimensions; x++) for (int x = 0; x < schedule_dimensions; x++)
{ {
int sX = x; int sX = x;
int tX = x; int tX = x;
int pX = scheduleDimensions + x; int pX = schedule_dimensions + x;
int aX = 2 * scheduleDimensions + x; int aX = 2 * schedule_dimensions + x;
isl_constraint *c; isl_constraint *c;
/* sX = aX * tileSize; */ /* sX = aX * tile_size; */
c = isl_equality_alloc (isl_local_space_copy (LocalSpace)); c = isl_equality_alloc (isl_local_space_copy (local_space));
isl_constraint_set_coefficient_si (c, isl_dim_out, sX, 1); isl_constraint_set_coefficient_si (c, isl_dim_out, sX, 1);
isl_constraint_set_coefficient_si (c, isl_dim_out, aX, -tileSize); isl_constraint_set_coefficient_si (c, isl_dim_out, aX, -tile_size);
tileMap = isl_basic_map_add_constraint (tileMap, c); tile_map = isl_basic_map_add_constraint (tile_map, c);
/* pX = sX; */ /* pX = sX; */
c = isl_equality_alloc (isl_local_space_copy (LocalSpace)); c = isl_equality_alloc (isl_local_space_copy (local_space));
isl_constraint_set_coefficient_si (c, isl_dim_out, pX, 1); isl_constraint_set_coefficient_si (c, isl_dim_out, pX, 1);
isl_constraint_set_coefficient_si (c, isl_dim_in, sX, -1); isl_constraint_set_coefficient_si (c, isl_dim_in, sX, -1);
tileMap = isl_basic_map_add_constraint (tileMap, c); tile_map = isl_basic_map_add_constraint (tile_map, c);
/* tX <= pX */ /* tX <= pX */
c = isl_inequality_alloc (isl_local_space_copy (LocalSpace)); c = isl_inequality_alloc (isl_local_space_copy (local_space));
isl_constraint_set_coefficient_si (c, isl_dim_out, pX, 1); isl_constraint_set_coefficient_si (c, isl_dim_out, pX, 1);
isl_constraint_set_coefficient_si (c, isl_dim_out, tX, -1); isl_constraint_set_coefficient_si (c, isl_dim_out, tX, -1);
tileMap = isl_basic_map_add_constraint (tileMap, c); tile_map = isl_basic_map_add_constraint (tile_map, c);
/* pX <= tX + (tileSize - 1) */ /* pX <= tX + (tile_size - 1) */
c = isl_inequality_alloc (isl_local_space_copy (LocalSpace)); c = isl_inequality_alloc (isl_local_space_copy (local_space));
isl_constraint_set_coefficient_si (c, isl_dim_out, tX, 1); isl_constraint_set_coefficient_si (c, isl_dim_out, tX, 1);
isl_constraint_set_coefficient_si (c, isl_dim_out, pX, -1); isl_constraint_set_coefficient_si (c, isl_dim_out, pX, -1);
isl_constraint_set_constant_si (c, tileSize - 1); isl_constraint_set_constant_si (c, tile_size - 1);
tileMap = isl_basic_map_add_constraint (tileMap, c); tile_map = isl_basic_map_add_constraint (tile_map, c);
} }
/* Project out auxiliary dimensions. /* Project out auxiliary dimensions.
The auxiliary dimensions are transformed into existentially quantified ones. The auxiliary dimensions are transformed into existentially quantified
This reduces the number of visible scattering dimensions and allows Cloog ones.
This reduces the number of visible scattering dimensions and allows isl
to produces better code. */ to produces better code. */
tileMap = isl_basic_map_project_out (tileMap, isl_dim_out, tile_map =
2 * scheduleDimensions, isl_basic_map_project_out (tile_map, isl_dim_out,
scheduleDimensions); 2 * schedule_dimensions, schedule_dimensions);
isl_local_space_free (LocalSpace); isl_local_space_free (local_space);
return tileMap; return tile_map;
} }
/* getScheduleForBand - Get the schedule for this band. /* get_schedule_for_band - Get the schedule for this BAND.
Polly applies transformations like tiling on top of the isl calculated value. Polly applies transformations like tiling on top of the isl calculated
value.
This can influence the number of scheduling dimension. The number of This can influence the number of scheduling dimension. The number of
schedule dimensions is returned in the parameter 'Dimension'. */ schedule dimensions is returned in DIMENSIONS. */
static bool DisableTiling = false;
static isl_union_map * static isl_union_map *
getScheduleForBand (isl_band *Band, int *Dimensions) get_schedule_for_band (isl_band *band, int *dimensions)
{ {
isl_union_map *PartialSchedule; isl_union_map *partial_schedule;
isl_ctx *ctx; isl_ctx *ctx;
isl_space *Space; isl_space *space;
isl_basic_map *TileMap; isl_basic_map *tile_map;
isl_union_map *TileUMap; isl_union_map *tile_umap;
PartialSchedule = isl_band_get_partial_schedule (Band); partial_schedule = isl_band_get_partial_schedule (band);
*Dimensions = isl_band_n_member (Band); *dimensions = isl_band_n_member (band);
if (DisableTiling) if (disable_tiling)
return PartialSchedule; return partial_schedule;
/* It does not make any sense to tile a band with just one dimension. */ /* It does not make any sense to tile a band with just one dimension. */
if (*Dimensions == 1) if (*dimensions == 1)
{ {
if (dump_file && dump_flags) if (dump_file && dump_flags)
fprintf (dump_file, "not tiled\n"); fprintf (dump_file, "not tiled\n");
return PartialSchedule; return partial_schedule;
} }
if (dump_file && dump_flags) if (dump_file && dump_flags)
fprintf (dump_file, "tiled by %d\n", fprintf (dump_file, "tiled by %d\n",
PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE)); PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE));
ctx = isl_union_map_get_ctx (PartialSchedule); ctx = isl_union_map_get_ctx (partial_schedule);
Space = isl_union_map_get_space (PartialSchedule); space = isl_union_map_get_space (partial_schedule);
TileMap = getTileMap (ctx, *Dimensions, tile_map = get_tile_map (ctx, *dimensions,
PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE)); PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE));
TileUMap = isl_union_map_from_map (isl_map_from_basic_map (TileMap)); tile_umap = isl_union_map_from_map (isl_map_from_basic_map (tile_map));
TileUMap = isl_union_map_align_params (TileUMap, Space); tile_umap = isl_union_map_align_params (tile_umap, space);
*Dimensions = 2 * *Dimensions; *dimensions = 2 * *dimensions;
return isl_union_map_apply_range (PartialSchedule, TileUMap); return isl_union_map_apply_range (partial_schedule, tile_umap);
} }
/* Create a map that pre-vectorizes one scheduling dimension. /* Create a map that pre-vectorizes one scheduling dimension.
getPrevectorMap creates a map that maps each input dimension to the same get_prevector_map creates a map that maps each input dimension to the same
output dimension, except for the dimension DimToVectorize. DimToVectorize is output dimension, except for the dimension DIM_TO_VECTORIZE.
strip mined by 'VectorWidth' and the newly created point loop of DIM_TO_VECTORIZE is
DimToVectorize is moved to the innermost level. strip mined by 'VECTOR_WIDTH' and the newly created point loop of
DIM_TO_VECTORIZE is moved to the innermost level.
Example (DimToVectorize=0, ScheduleDimensions=2, VectorWidth=4): Example (DIM_TO_VECTORIZE=0, SCHEDULE_DIMENSIONS=2,VECTOR_WIDTH=4):
| Before transformation | Before transformation
| |
@ -236,163 +240,164 @@ getScheduleForBand (isl_band *Band, int *Dimensions)
This transformation creates a loop at the innermost level. The loop has a This transformation creates a loop at the innermost level. The loop has a
constant number of iterations, if the number of loop iterations at constant number of iterations, if the number of loop iterations at
DimToVectorize can be devided by VectorWidth. The default VectorWidth is DIM_TO_VECTORIZE can be devided by VECTOR_WIDTH. The default VECTOR_WIDTH is
currently constant and not yet target specific. This function does not reason currently constant and not yet target specific. This function does not
about parallelism. */ reason about parallelism. */
static isl_map * static isl_map *
getPrevectorMap (isl_ctx *ctx, int DimToVectorize, get_prevector_map (isl_ctx *ctx, int dim_to_vectorize, int schedule_dimensions,
int ScheduleDimensions, int vector_width)
int VectorWidth)
{ {
isl_space *Space; isl_space *space;
isl_local_space *LocalSpace, *LocalSpaceRange; isl_local_space *local_space, *local_space_range;
isl_set *Modulo; isl_set *modulo;
isl_map *TilingMap; isl_map *tiling_map;
isl_constraint *c; isl_constraint *c;
isl_aff *Aff; isl_aff *aff;
int PointDimension; /* ip */ int point_dimension; /* ip */
int TileDimension; /* it */ int tile_dimension; /* it */
isl_val *VectorWidthMP; isl_val *vector_widthMP;
int i; int i;
/* assert (0 <= DimToVectorize && DimToVectorize < ScheduleDimensions);*/ /* assert (0 <= DimToVectorize && DimToVectorize < ScheduleDimensions);*/
Space = isl_space_alloc (ctx, 0, ScheduleDimensions, ScheduleDimensions + 1); space
TilingMap = isl_map_universe (isl_space_copy (Space)); = isl_space_alloc (ctx, 0, schedule_dimensions, schedule_dimensions + 1);
LocalSpace = isl_local_space_from_space (Space); tiling_map = isl_map_universe (isl_space_copy (space));
PointDimension = ScheduleDimensions; local_space = isl_local_space_from_space (space);
TileDimension = DimToVectorize; point_dimension = schedule_dimensions;
tile_dimension = dim_to_vectorize;
/* Create an identity map for everything except DimToVectorize and map /* Create an identity map for everything except DimToVectorize and map
DimToVectorize to the point loop at the innermost dimension. */ DimToVectorize to the point loop at the innermost dimension. */
for (i = 0; i < ScheduleDimensions; i++) for (i = 0; i < schedule_dimensions; i++)
{ {
c = isl_equality_alloc (isl_local_space_copy (LocalSpace)); c = isl_equality_alloc (isl_local_space_copy (local_space));
isl_constraint_set_coefficient_si (c, isl_dim_in, i, -1); isl_constraint_set_coefficient_si (c, isl_dim_in, i, -1);
if (i == DimToVectorize) if (i == dim_to_vectorize)
isl_constraint_set_coefficient_si (c, isl_dim_out, PointDimension, 1); isl_constraint_set_coefficient_si (c, isl_dim_out, point_dimension, 1);
else else
isl_constraint_set_coefficient_si (c, isl_dim_out, i, 1); isl_constraint_set_coefficient_si (c, isl_dim_out, i, 1);
TilingMap = isl_map_add_constraint (TilingMap, c); tiling_map = isl_map_add_constraint (tiling_map, c);
} }
/* it % 'VectorWidth' = 0 */ /* it % 'VectorWidth' = 0 */
LocalSpaceRange = isl_local_space_range (isl_local_space_copy (LocalSpace)); local_space_range
Aff = isl_aff_zero_on_domain (LocalSpaceRange); = isl_local_space_range (isl_local_space_copy (local_space));
Aff = isl_aff_set_constant_si (Aff, VectorWidth); aff = isl_aff_zero_on_domain (local_space_range);
Aff = isl_aff_set_coefficient_si (Aff, isl_dim_in, TileDimension, 1); aff = isl_aff_set_constant_si (aff, vector_width);
aff = isl_aff_set_coefficient_si (aff, isl_dim_in, tile_dimension, 1);
VectorWidthMP = isl_val_int_from_si (ctx, VectorWidth); vector_widthMP = isl_val_int_from_si (ctx, vector_width);
Aff = isl_aff_mod_val (Aff, VectorWidthMP); aff = isl_aff_mod_val (aff, vector_widthMP);
Modulo = isl_pw_aff_zero_set (isl_pw_aff_from_aff (Aff)); modulo = isl_pw_aff_zero_set (isl_pw_aff_from_aff (aff));
TilingMap = isl_map_intersect_range (TilingMap, Modulo); tiling_map = isl_map_intersect_range (tiling_map, modulo);
/* it <= ip */ /* it <= ip */
c = isl_inequality_alloc (isl_local_space_copy (LocalSpace)); c = isl_inequality_alloc (isl_local_space_copy (local_space));
isl_constraint_set_coefficient_si (c, isl_dim_out, TileDimension, -1); isl_constraint_set_coefficient_si (c, isl_dim_out, tile_dimension, -1);
isl_constraint_set_coefficient_si (c, isl_dim_out, PointDimension, 1); isl_constraint_set_coefficient_si (c, isl_dim_out, point_dimension, 1);
TilingMap = isl_map_add_constraint (TilingMap, c); tiling_map = isl_map_add_constraint (tiling_map, c);
/* ip <= it + ('VectorWidth' - 1) */ /* ip <= it + ('VectorWidth' - 1) */
c = isl_inequality_alloc (LocalSpace); c = isl_inequality_alloc (local_space);
isl_constraint_set_coefficient_si (c, isl_dim_out, TileDimension, 1); isl_constraint_set_coefficient_si (c, isl_dim_out, tile_dimension, 1);
isl_constraint_set_coefficient_si (c, isl_dim_out, PointDimension, -1); isl_constraint_set_coefficient_si (c, isl_dim_out, point_dimension, -1);
isl_constraint_set_constant_si (c, VectorWidth - 1); isl_constraint_set_constant_si (c, vector_width - 1);
TilingMap = isl_map_add_constraint (TilingMap, c); tiling_map = isl_map_add_constraint (tiling_map, c);
return TilingMap; return tiling_map;
} }
static bool EnablePollyVector = false; static bool enable_polly_vector = false;
/* getScheduleForBandList - Get the scheduling map for a list of bands. /* get_schedule_for_band_list - Get the scheduling map for a list of bands.
We walk recursively the forest of bands to combine the schedules of the We walk recursively the forest of bands to combine the schedules of the
individual bands to the overall schedule. In case tiling is requested, individual bands to the overall schedule. In case tiling is requested,
the individual bands are tiled. */ the individual bands are tiled. */
static isl_union_map * static isl_union_map *
getScheduleForBandList (isl_band_list *BandList) get_schedule_for_band_list (isl_band_list *band_list)
{ {
int NumBands, i; int num_bands, i;
isl_union_map *Schedule; isl_union_map *schedule;
isl_ctx *ctx; isl_ctx *ctx;
ctx = isl_band_list_get_ctx (BandList); ctx = isl_band_list_get_ctx (band_list);
NumBands = isl_band_list_n_band (BandList); num_bands = isl_band_list_n_band (band_list);
Schedule = isl_union_map_empty (isl_space_params_alloc (ctx, 0)); schedule = isl_union_map_empty (isl_space_params_alloc (ctx, 0));
for (i = 0; i < NumBands; i++) for (i = 0; i < num_bands; i++)
{ {
isl_band *Band; isl_band *band;
isl_union_map *PartialSchedule; isl_union_map *partial_schedule;
int ScheduleDimensions; int schedule_dimensions;
isl_space *Space; isl_space *space;
Band = isl_band_list_get_band (BandList, i); band = isl_band_list_get_band (band_list, i);
PartialSchedule = getScheduleForBand (Band, &ScheduleDimensions); partial_schedule = get_schedule_for_band (band, &schedule_dimensions);
Space = isl_union_map_get_space (PartialSchedule); space = isl_union_map_get_space (partial_schedule);
if (isl_band_has_children (Band)) if (isl_band_has_children (band))
{ {
isl_band_list *Children; isl_band_list *children = isl_band_get_children (band);
isl_union_map *SuffixSchedule; isl_union_map *suffixSchedule
= get_schedule_for_band_list (children);
Children = isl_band_get_children (Band); partial_schedule
SuffixSchedule = getScheduleForBandList (Children); = isl_union_map_flat_range_product (partial_schedule,
PartialSchedule = isl_union_map_flat_range_product (PartialSchedule, suffixSchedule);
SuffixSchedule); isl_band_list_free (children);
isl_band_list_free (Children);
} }
else if (EnablePollyVector) else if (enable_polly_vector)
{ {
for (i = ScheduleDimensions - 1 ; i >= 0 ; i--) for (i = schedule_dimensions - 1; i >= 0; i--)
{ {
#ifdef HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE #ifdef HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE
if (isl_band_member_is_coincident (Band, i)) if (isl_band_member_is_coincident (band, i))
#else #else
if (isl_band_member_is_zero_distance (Band, i)) if (isl_band_member_is_zero_distance (band, i))
#endif #endif
{ {
isl_map *TileMap; /* FIXME: The default VECTOR_WIDTH is currently constant and
isl_union_map *TileUMap; * not yet target specific. */
isl_map *tile_map
TileMap = getPrevectorMap (ctx, i, ScheduleDimensions, 4); = get_prevector_map (ctx, i, schedule_dimensions, 4);
TileUMap = isl_union_map_from_map (TileMap); isl_union_map *tile_umap = isl_union_map_from_map (tile_map);
TileUMap = isl_union_map_align_params tile_umap
(TileUMap, isl_space_copy (Space)); = isl_union_map_align_params (tile_umap,
PartialSchedule = isl_union_map_apply_range isl_space_copy (space));
(PartialSchedule, TileUMap); partial_schedule
= isl_union_map_apply_range (partial_schedule,
tile_umap);
break; break;
} }
} }
} }
Schedule = isl_union_map_union (Schedule, PartialSchedule); schedule = isl_union_map_union (schedule, partial_schedule);
isl_band_free (Band); isl_band_free (band);
isl_space_free (Space); isl_space_free (space);
} }
return Schedule; return schedule;
} }
static isl_union_map * static isl_union_map *
getScheduleMap (isl_schedule *Schedule) get_schedule_map (isl_schedule *schedule)
{ {
isl_band_list *BandList = isl_schedule_get_band_forest (Schedule); isl_band_list *bandList = isl_schedule_get_band_forest (schedule);
isl_union_map *ScheduleMap = getScheduleForBandList (BandList); isl_union_map *schedule_map = get_schedule_for_band_list (bandList);
isl_band_list_free (BandList); isl_band_list_free (bandList);
return ScheduleMap; return schedule_map;
} }
static isl_stat static isl_stat
getSingleMap (__isl_take isl_map *map, void *user) get_single_map (__isl_take isl_map *map, void *user)
{ {
isl_map **singleMap = (isl_map **) user; isl_map **single_map = (isl_map **)user;
*singleMap = map; *single_map = map;
return isl_stat_ok; return isl_stat_ok;
} }
@ -405,16 +410,15 @@ apply_schedule_map_to_scop (scop_p scop, isl_union_map *schedule_map)
FOR_EACH_VEC_ELT (scop->bbs, i, pbb) FOR_EACH_VEC_ELT (scop->bbs, i, pbb)
{ {
isl_set *domain = isl_set_copy (pbb->domain); isl_set *domain = isl_set_copy (pbb->domain);
isl_union_map *stmtBand; isl_map *stmt_schedule;
isl_map *stmtSchedule;
stmtBand = isl_union_map_intersect_domain isl_union_map *stmt_band
(isl_union_map_copy (schedule_map), = isl_union_map_intersect_domain (isl_union_map_copy (schedule_map),
isl_union_set_from_set (domain)); isl_union_set_from_set (domain));
isl_union_map_foreach_map (stmtBand, getSingleMap, &stmtSchedule); isl_union_map_foreach_map (stmt_band, get_single_map, &stmt_schedule);
isl_map_free (pbb->transformed); isl_map_free (pbb->transformed);
pbb->transformed = stmtSchedule; pbb->transformed = stmt_schedule;
isl_union_map_free (stmtBand); isl_union_map_free (stmt_band);
} }
} }
@ -424,19 +428,19 @@ bool
optimize_isl (scop_p scop) optimize_isl (scop_p scop)
{ {
#ifdef HAVE_ISL_CTX_MAX_OPERATIONS #ifdef HAVE_ISL_CTX_MAX_OPERATIONS
int old_max_operations = isl_ctx_get_max_operations(scop->ctx); int old_max_operations = isl_ctx_get_max_operations (scop->ctx);
int max_operations = PARAM_VALUE (PARAM_MAX_ISL_OPERATIONS); int max_operations = PARAM_VALUE (PARAM_MAX_ISL_OPERATIONS);
if (max_operations) if (max_operations)
isl_ctx_set_max_operations(scop->ctx, max_operations); isl_ctx_set_max_operations (scop->ctx, max_operations);
#endif #endif
isl_options_set_on_error (scop->ctx, ISL_ON_ERROR_CONTINUE); isl_options_set_on_error (scop->ctx, ISL_ON_ERROR_CONTINUE);
isl_union_set *domain = scop_get_domains (scop); isl_union_set *domain = scop_get_domains (scop);
isl_union_map *dependences = scop_get_dependences (scop); isl_union_map *dependences = scop_get_dependences (scop);
dependences = isl_union_map_gist_domain (dependences, dependences
isl_union_set_copy (domain)); = isl_union_map_gist_domain (dependences, isl_union_set_copy (domain));
dependences = isl_union_map_gist_range (dependences, dependences
isl_union_set_copy (domain)); = isl_union_map_gist_range (dependences, isl_union_set_copy (domain));
isl_union_map *validity = dependences; isl_union_map *validity = dependences;
isl_union_map *proximity = isl_union_map_copy (validity); isl_union_map *proximity = isl_union_map_copy (validity);
@ -444,14 +448,14 @@ optimize_isl (scop_p scop)
isl_schedule_constraints *schedule_constraints; isl_schedule_constraints *schedule_constraints;
schedule_constraints = isl_schedule_constraints_on_domain (domain); schedule_constraints = isl_schedule_constraints_on_domain (domain);
schedule_constraints schedule_constraints
= isl_schedule_constraints_set_proximity (schedule_constraints, = isl_schedule_constraints_set_proximity (schedule_constraints,
proximity); proximity);
schedule_constraints schedule_constraints
= isl_schedule_constraints_set_validity (schedule_constraints, = isl_schedule_constraints_set_validity (schedule_constraints,
isl_union_map_copy (validity)); isl_union_map_copy (validity));
schedule_constraints schedule_constraints
= isl_schedule_constraints_set_coincidence (schedule_constraints, = isl_schedule_constraints_set_coincidence (schedule_constraints,
validity); validity);
#endif #endif
isl_options_set_schedule_max_constant_term (scop->ctx, CONSTANT_BOUND); isl_options_set_schedule_max_constant_term (scop->ctx, CONSTANT_BOUND);
@ -473,8 +477,8 @@ optimize_isl (scop_p scop)
isl_options_set_on_error (scop->ctx, ISL_ON_ERROR_ABORT); isl_options_set_on_error (scop->ctx, ISL_ON_ERROR_ABORT);
#ifdef HAVE_ISL_CTX_MAX_OPERATIONS #ifdef HAVE_ISL_CTX_MAX_OPERATIONS
isl_ctx_reset_operations(scop->ctx); isl_ctx_reset_operations (scop->ctx);
isl_ctx_set_max_operations(scop->ctx, old_max_operations); isl_ctx_set_max_operations (scop->ctx, old_max_operations);
if (!schedule || isl_ctx_last_error (scop->ctx) == isl_error_quota) if (!schedule || isl_ctx_last_error (scop->ctx) == isl_error_quota)
{ {
if (dump_file && dump_flags) if (dump_file && dump_flags)
@ -489,7 +493,7 @@ optimize_isl (scop_p scop)
return false; return false;
#endif #endif
isl_union_map *schedule_map = getScheduleMap (schedule); isl_union_map *schedule_map = get_schedule_map (schedule);
apply_schedule_map_to_scop (scop, schedule_map); apply_schedule_map_to_scop (scop, schedule_map);
isl_schedule_free (schedule); isl_schedule_free (schedule);
@ -497,4 +501,4 @@ optimize_isl (scop_p scop)
return true; return true;
} }
#endif /* HAVE_isl */ #endif /* HAVE_isl */