Replace low-level constraint building with higher level functions

Instead of explicitly building constraints and adding them to our maps we
now use functions like map_order_le to add the relevant information to the
maps.

llvm-svn: 237934
This commit is contained in:
Tobias Grosser 2015-05-21 19:02:44 +00:00
parent 0289dcbd91
commit 1b6ea573f2
2 changed files with 9 additions and 29 deletions

View File

@ -747,8 +747,7 @@ void MemoryAccess::dump() const { print(errs()); }
//
static isl_map *getEqualAndLarger(isl_space *setDomain) {
isl_space *Space = isl_space_map_from_set(setDomain);
isl_map *Map = isl_map_universe(isl_space_copy(Space));
isl_local_space *MapLocalSpace = isl_local_space_from_space(Space);
isl_map *Map = isl_map_universe(Space);
unsigned lastDimension = isl_map_dim(Map, isl_dim_in) - 1;
// Set all but the last dimension to be equal for the input and output
@ -762,20 +761,8 @@ static isl_map *getEqualAndLarger(isl_space *setDomain) {
// last dimension of the output.
//
// input[?,?,?,...,iX] -> output[?,?,?,...,oX] : iX < oX
//
isl_val *v;
isl_ctx *Ctx = isl_map_get_ctx(Map);
isl_constraint *c = isl_inequality_alloc(isl_local_space_copy(MapLocalSpace));
v = isl_val_int_from_si(Ctx, -1);
c = isl_constraint_set_coefficient_val(c, isl_dim_in, lastDimension, v);
v = isl_val_int_from_si(Ctx, 1);
c = isl_constraint_set_coefficient_val(c, isl_dim_out, lastDimension, v);
v = isl_val_int_from_si(Ctx, -1);
c = isl_constraint_set_constant_val(c, v);
Map = isl_map_add_constraint(Map, c);
isl_local_space_free(MapLocalSpace);
Map = isl_map_order_lt(Map, isl_dim_in, lastDimension, isl_dim_out,
lastDimension);
return Map;
}

View File

@ -213,17 +213,12 @@ IslScheduleOptimizer::getPrevectorMap(isl_ctx *ctx, int DimToVectorize,
// Create an identity map for everything except DimToVectorize and map
// DimToVectorize to the point loop at the innermost dimension.
for (int i = 0; i < ScheduleDimensions; i++) {
c = isl_equality_alloc(isl_local_space_copy(LocalSpace));
c = isl_constraint_set_coefficient_si(c, isl_dim_in, i, -1);
for (int i = 0; i < ScheduleDimensions; i++)
if (i == DimToVectorize)
c = isl_constraint_set_coefficient_si(c, isl_dim_out, PointDimension, 1);
TilingMap =
isl_map_equate(TilingMap, isl_dim_in, i, isl_dim_out, PointDimension);
else
c = isl_constraint_set_coefficient_si(c, isl_dim_out, i, 1);
TilingMap = isl_map_add_constraint(TilingMap, c);
}
TilingMap = isl_map_equate(TilingMap, isl_dim_in, i, isl_dim_out, i);
// it % 'VectorWidth' = 0
LocalSpaceRange = isl_local_space_range(isl_local_space_copy(LocalSpace));
@ -236,10 +231,8 @@ IslScheduleOptimizer::getPrevectorMap(isl_ctx *ctx, int DimToVectorize,
TilingMap = isl_map_intersect_range(TilingMap, Modulo);
// it <= ip
c = isl_inequality_alloc(isl_local_space_copy(LocalSpace));
isl_constraint_set_coefficient_si(c, isl_dim_out, TileDimension, -1);
isl_constraint_set_coefficient_si(c, isl_dim_out, PointDimension, 1);
TilingMap = isl_map_add_constraint(TilingMap, c);
TilingMap = isl_map_order_le(TilingMap, isl_dim_out, TileDimension,
isl_dim_out, PointDimension);
// ip <= it + ('VectorWidth' - 1)
c = isl_inequality_alloc(LocalSpace);