isl_union_map *getCombinedScheduleForSpace(Scop *scop, unsigned dimLevel) { isl_space *Space = scop->getParamSpace(); isl_union_map *schedule = isl_union_map_empty(Space); for (Scop::iterator SI = scop->begin(), SE = scop->end(); SI != SE; ++SI) { ScopStmt *Stmt = *SI; unsigned remainingDimensions = Stmt->getNumScattering() - dimLevel; isl_map *Scattering = isl_map_project_out( Stmt->getScattering(), isl_dim_out, dimLevel, remainingDimensions); schedule = isl_union_map_add_map(schedule, Scattering); } return schedule; }
void IslScheduleOptimizer::extendScattering(Scop &S, unsigned NewDimensions) { for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) { ScopStmt *Stmt = *SI; unsigned OldDimensions = Stmt->getNumScattering(); isl_space *Space; isl_map *Map, *New; Space = isl_space_alloc(Stmt->getIslCtx(), 0, OldDimensions, NewDimensions); Map = isl_map_universe(Space); for (unsigned i = 0; i < OldDimensions; i++) Map = isl_map_equate(Map, isl_dim_in, i, isl_dim_out, i); for (unsigned i = OldDimensions; i < NewDimensions; i++) Map = isl_map_fix_si(Map, isl_dim_out, i, 0); Map = isl_map_align_params(Map, S.getParamSpace()); New = isl_map_apply_range(Stmt->getScattering(), Map); Stmt->setScattering(New); } }