JScop: Allow to update the context
llvm-svn: 144639
diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h
index 5f16708..b05bdb7 100755
--- a/polly/include/polly/ScopInfo.h
+++ b/polly/include/polly/ScopInfo.h
@@ -547,6 +547,8 @@
const_reverse_iterator rend() const { return Stmts.rend(); }
//@}
+ void setContext(isl_set* NewContext);
+
/// @brief Align the parameters in the statement to the scop context
void realignParams();
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index 7e542eb..34e7ae35 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -843,6 +843,12 @@
//===----------------------------------------------------------------------===//
/// Scop class implement
+void Scop::setContext(__isl_take isl_set* NewContext) {
+ NewContext = isl_set_align_params(NewContext, isl_set_get_space(Context));
+ isl_set_free(Context);
+ Context = NewContext;
+}
+
void Scop::addParams(std::vector<const SCEV*> NewParameters) {
for (std::vector<const SCEV*>::iterator PI = NewParameters.begin(),
PE = NewParameters.end(); PI != PE; ++PI) {
diff --git a/polly/lib/Exchange/JSONExporter.cpp b/polly/lib/Exchange/JSONExporter.cpp
index 00c9f88..b1488c6 100755
--- a/polly/lib/Exchange/JSONExporter.cpp
+++ b/polly/lib/Exchange/JSONExporter.cpp
@@ -228,6 +228,19 @@
return false;
}
+ isl_set *OldContext = S->getContext();
+ isl_set *NewContext = isl_set_read_from_str(S->getIslCtx(),
+ jscop["context"].asCString());
+
+ for (unsigned i = 0; i < isl_set_dim(OldContext, isl_dim_param); i++) {
+ isl_id *id = isl_set_get_dim_id(OldContext, isl_dim_param, i);
+ NewContext = isl_set_set_dim_id(NewContext, isl_dim_param, i, id);
+
+ }
+
+ isl_set_free(OldContext);
+ S->setContext(NewContext);
+
StatementToIslMapTy &NewScattering = *(new StatementToIslMapTy());
int index = 0;