//===----------------------------------------------------------------------===// /// Scop class implement Scop::Scop(TempScop &tempScop, LoopInfo &LI, ScalarEvolution &ScalarEvolution) : SE(&ScalarEvolution), R(tempScop.getMaxRegion()), MaxLoopDepth(tempScop.getMaxLoopDepth()) { isl_ctx *ctx = isl_ctx_alloc(); ParamSetType &Params = tempScop.getParamSet(); Parameters.insert(Parameters.begin(), Params.begin(), Params.end()); isl_dim *dim = isl_dim_set_alloc(ctx, getNumParams(), 0); // TODO: Insert relations between parameters. // TODO: Insert constraints on parameters. Context = isl_set_universe (dim); SmallVector<Loop*, 8> NestLoops; SmallVector<unsigned, 8> Scatter; Scatter.assign(MaxLoopDepth + 1, 0); // Build the iteration domain, access functions and scattering functions // traversing the region tree. buildScop(tempScop, getRegion(), NestLoops, Scatter, LI); Stmts.push_back(new ScopStmt(*this, Scatter)); assert(NestLoops.empty() && "NestLoops not empty at top level!"); }
bool ScopInfo::runOnRegion(Region *R, RGPassManager &RGM) { LoopInfo &LI = getAnalysis<LoopInfo>(); ScalarEvolution &SE = getAnalysis<ScalarEvolution>(); TempScop *tempScop = getAnalysis<TempScopInfo>().getTempScop(R); // This region is no Scop. if (!tempScop) { scop = 0; return false; } // Statistics. ++ScopFound; if (tempScop->getMaxLoopDepth() > 0) ++RichScopFound; scop = new Scop(*tempScop, LI, SE); return false; }
Scop::Scop(TempScop &tempScop, LoopInfo &LI, ScalarEvolution &ScalarEvolution, isl_ctx *Context) : SE(&ScalarEvolution), R(tempScop.getMaxRegion()), MaxLoopDepth(tempScop.getMaxLoopDepth()) { IslCtx = Context; buildContext(); SmallVector<Loop *, 8> NestLoops; SmallVector<unsigned, 8> Scatter; Scatter.assign(MaxLoopDepth + 1, 0); // Build the iteration domain, access functions and scattering functions // traversing the region tree. buildScop(tempScop, getRegion(), NestLoops, Scatter, LI); realignParams(); addParameterBounds(); assert(NestLoops.empty() && "NestLoops not empty at top level!"); }