[llvm-commits] [polly] r141253 - in /polly/trunk: include/polly/ScopInfo.h lib/Analysis/ScopInfo.cpp test/ScopInfo/loop_carry.ll

Tobias Grosser grosser at fim.uni-passau.de
Wed Oct 5 17:03:48 PDT 2011


Author: grosser
Date: Wed Oct  5 19:03:48 2011
New Revision: 141253

URL: http://llvm.org/viewvc/llvm-project?rev=141253&view=rev
Log:
ScopInfo: Use separate function to build context

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

Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=141253&r1=141252&r2=141253&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Wed Oct  5 19:03:48 2011
@@ -20,6 +20,8 @@
 #ifndef POLLY_SCOP_INFO_H
 #define POLLY_SCOP_INFO_H
 
+#include "polly/ScopDetection.h"
+
 #include "llvm/Analysis/RegionPass.h"
 
 #include "isl/ctx.h"
@@ -39,7 +41,6 @@
 struct isl_map;
 struct isl_basic_map;
 struct isl_set;
-struct isl_ctx;
 struct isl_space;
 struct isl_constraint;
 
@@ -418,6 +419,12 @@
   /// @return True if the basic block is trivial, otherwise false.
   static bool isTrivialBB(BasicBlock *BB, TempScop &tempScop);
 
+  /// @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);
+
   /// Build the Scop and Statement with precalculate scop information.
   void buildScop(TempScop &TempScop, const Region &CurRegion,
                   // Loops in Scop containing CurRegion

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=141253&r1=141252&r2=141253&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Wed Oct  5 19:03:48 2011
@@ -869,22 +869,18 @@
 
 //===----------------------------------------------------------------------===//
 /// Scop class implement
-Scop::Scop(TempScop &tempScop, LoopInfo &LI, ScalarEvolution &ScalarEvolution,
-           isl_ctx *ctx)
-           : SE(&ScalarEvolution), R(tempScop.getMaxRegion()),
-           MaxLoopDepth(tempScop.getMaxLoopDepth()) {
-  ParamSetType &Params = tempScop.getParamSet();
-  Parameters.insert(Parameters.begin(), Params.begin(), Params.end());
 
-  isl_space *Space = isl_space_set_alloc(ctx, getNumParams(), 0);
+void Scop::buildContext(isl_ctx *IslCtx, ParamSetType *ParamSet) {
+  isl_space *Space = isl_space_params_alloc(IslCtx, ParamSet->size());
 
   int i = 0;
-  for (ParamSetType::iterator PI = Params.begin(), PE = Params.end();
+  for (ParamSetType::iterator PI = ParamSet->begin(), PE = ParamSet->end();
        PI != PE; ++PI) {
-    const SCEV *scev = *PI;
-    isl_id *id = isl_id_alloc(ctx,
-                              ("p" + convertInt(i)).c_str(),
-                              (void *) scev);
+    const SCEV *Parameter = *PI;
+    Parameters.push_back(Parameter);
+    std::string ParameterName = "p" + convertInt(i);
+    isl_id *id = isl_id_alloc(IslCtx, ParameterName.c_str(),
+                              (void *) Parameter);
     Space = isl_space_set_dim_id(Space, isl_dim_param, i, id);
     i++;
   }
@@ -892,6 +888,13 @@
   // TODO: Insert relations between parameters.
   // TODO: Insert constraints on parameters.
   Context = isl_set_universe (Space);
+}
+
+Scop::Scop(TempScop &tempScop, LoopInfo &LI, ScalarEvolution &ScalarEvolution,
+           isl_ctx *Context)
+           : SE(&ScalarEvolution), R(tempScop.getMaxRegion()),
+           MaxLoopDepth(tempScop.getMaxLoopDepth()) {
+  buildContext(Context, &tempScop.getParamSet());
 
   SmallVector<Loop*, 8> NestLoops;
   SmallVector<unsigned, 8> Scatter;

Modified: polly/trunk/test/ScopInfo/loop_carry.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/loop_carry.ll?rev=141253&r1=141252&r2=141253&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/loop_carry.ll (original)
+++ polly/trunk/test/ScopInfo/loop_carry.ll Wed Oct  5 19:03:48 2011
@@ -47,7 +47,7 @@
 }
 
 ; CHECK: Context:
-; CHECK: [p0] -> { [] }
+; CHECK: [p0] -> { : }
 ; CHECK:     Statements {
 ; CHECK:     	Stmt_bb_nph
 ; CHECK:             Domain :=





More information about the llvm-commits mailing list