[llvm-commits] [polly] r144085 - in /polly/trunk: include/polly/ScopInfo.h lib/Analysis/ScopInfo.cpp

Tobias Grosser grosser at fim.uni-passau.de
Tue Nov 8 07:41:14 PST 2011


Author: grosser
Date: Tue Nov  8 09:41:13 2011
New Revision: 144085

URL: http://llvm.org/viewvc/llvm-project?rev=144085&view=rev
Log:
ScopInfo: Don't add common parameters during realignment to the context.

Previously we built a context that contained already all parameter dimensions
from the start. We now build a context without any parameter dimensions and
extend the context as needed. All parameter dimensions are added during final
realignment.

Modified:
    polly/trunk/include/polly/ScopInfo.h
    polly/trunk/lib/Analysis/ScopInfo.cpp

Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=144085&r1=144084&r2=144085&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Tue Nov  8 09:41:13 2011
@@ -433,11 +433,11 @@
   /// @return True if the basic block is trivial, otherwise false.
   static bool isTrivialBB(BasicBlock *BB, TempScop &tempScop);
 
+  /// @brief Add the parameters to the internal parameter set.
+  void initializeParameters(ParamSetType *ParamSet);
+
   /// @brief Build the Context of the Scop.
-  ///
-  /// @param IslCtx The isl context to use.
-  /// @param ParamSet The list of all parameters in the SCoP.
-  void buildContext(isl_ctx *IslCtx, ParamSetType *ParamSet);
+  void buildContext();
 
   /// Build the Scop and Statement with precalculate scop information.
   void buildScop(TempScop &TempScop, const Region &CurRegion,

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=144085&r1=144084&r2=144085&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Tue Nov  8 09:41:13 2011
@@ -863,26 +863,36 @@
   return isl_id_alloc(getIslCtx(), ParameterName.c_str(), (void *) Parameter);
 }
 
-void Scop::buildContext(isl_ctx *IslCtx, ParamSetType *ParamSet) {
-  isl_space *Space = isl_space_params_alloc(IslCtx, ParamSet->size());
-
+void Scop::initializeParameters(ParamSetType *ParamSet) {
   int i = 0;
   for (ParamSetType::iterator PI = ParamSet->begin(), PE = ParamSet->end();
        PI != PE; ++PI) {
     const SCEV *Parameter = *PI;
     Parameters.push_back(Parameter);
     ParameterIds.insert(std::pair<const SCEV*, int>(Parameter, i));
-    isl_id *id = getIdForParam(Parameter);
-    Space = isl_space_set_dim_id(Space, isl_dim_param, i, id);
     i++;
   }
+}
 
-  // TODO: Insert relations between parameters.
-  // TODO: Insert constraints on parameters.
+void Scop::buildContext() {
+  isl_space *Space = isl_space_params_alloc(IslCtx, 0);
   Context = isl_set_universe (Space);
 }
 
 void Scop::realignParams() {
+  // Add all parameters into a common model.
+  isl_space *Space = isl_space_params_alloc(IslCtx, Parameters.size());
+
+  for (ParamIdType::iterator PI = ParameterIds.begin(), PE = ParameterIds.end();
+       PI != PE; ++PI) {
+    const SCEV *Parameter = PI->first;
+    isl_id *id = getIdForParam(Parameter);
+    Space = isl_space_set_dim_id(Space, isl_dim_param, PI->second, id);
+  }
+
+  // Align the parameters of all data structures to the model.
+  Context = isl_set_align_params(Context, Space);
+
   for (iterator I = begin(), E = end(); I != E; ++I)
     (*I)->realignParams();
 }
@@ -892,7 +902,8 @@
            : SE(&ScalarEvolution), R(tempScop.getMaxRegion()),
            MaxLoopDepth(tempScop.getMaxLoopDepth()) {
   IslCtx = Context;
-  buildContext(Context, &tempScop.getParamSet());
+  initializeParameters(&tempScop.getParamSet());
+  buildContext();
 
   SmallVector<Loop*, 8> NestLoops;
   SmallVector<unsigned, 8> Scatter;





More information about the llvm-commits mailing list