[polly] r230897 - [Refactor] Add a Scop & as argument to printScop

Johannes Doerfert doerfert at cs.uni-saarland.de
Sun Mar 1 10:40:26 PST 2015


Author: jdoerfert
Date: Sun Mar  1 12:40:25 2015
New Revision: 230897

URL: http://llvm.org/viewvc/llvm-project?rev=230897&view=rev
Log:
[Refactor] Add a Scop & as argument to printScop

  This is the first step in the interface simplification.

Modified:
    polly/trunk/include/polly/CodeGen/IslAst.h
    polly/trunk/include/polly/Dependences.h
    polly/trunk/include/polly/ScopPass.h
    polly/trunk/lib/Analysis/Dependences.cpp
    polly/trunk/lib/Analysis/ScopPass.cpp
    polly/trunk/lib/CodeGen/IslAst.cpp
    polly/trunk/lib/CodeGen/IslCodeGeneration.cpp
    polly/trunk/lib/Exchange/JSONExporter.cpp
    polly/trunk/lib/Transform/DeadCodeElimination.cpp
    polly/trunk/lib/Transform/Pluto.cpp
    polly/trunk/lib/Transform/ScheduleOptimizer.cpp

Modified: polly/trunk/include/polly/CodeGen/IslAst.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/IslAst.h?rev=230897&r1=230896&r2=230897&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/IslAst.h (original)
+++ polly/trunk/include/polly/CodeGen/IslAst.h Sun Mar  1 12:40:25 2015
@@ -91,7 +91,7 @@ public:
   bool runOnScop(Scop &S);
 
   /// @brief Print a source code representation of the program.
-  void printScop(llvm::raw_ostream &OS) const;
+  void printScop(llvm::raw_ostream &OS, Scop &S) const;
 
   /// @brief Return a copy of the AST root node.
   __isl_give isl_ast_node *getAst() const;

Modified: polly/trunk/include/polly/Dependences.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Dependences.h?rev=230897&r1=230896&r2=230897&view=diff
==============================================================================
--- polly/trunk/include/polly/Dependences.h (original)
+++ polly/trunk/include/polly/Dependences.h Sun Mar  1 12:40:25 2015
@@ -125,7 +125,7 @@ public:
   void recomputeDependences();
 
   bool runOnScop(Scop &S);
-  void printScop(raw_ostream &OS) const;
+  void printScop(raw_ostream &OS, Scop &S) const;
   virtual void releaseMemory();
   virtual void getAnalysisUsage(AnalysisUsage &AU) const;
 

Modified: polly/trunk/include/polly/ScopPass.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopPass.h?rev=230897&r1=230896&r2=230897&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopPass.h (original)
+++ polly/trunk/include/polly/ScopPass.h Sun Mar  1 12:40:25 2015
@@ -41,6 +41,9 @@ protected:
   ///
   virtual bool runOnScop(Scop &S) = 0;
 
+  /// @brief Print method for SCoPs.
+  virtual void printScop(raw_ostream &OS, Scop &S) const = 0;
+
   /// getAnalysisUsage - Subclasses that override getAnalysisUsage
   /// must call this.
   ///
@@ -55,7 +58,6 @@ public:
 private:
   virtual bool runOnRegion(Region *R, RGPassManager &RGM);
   void print(raw_ostream &OS, const Module *) const;
-  virtual void printScop(raw_ostream &OS) const {}
 };
 
 } // End llvm namespace

Modified: polly/trunk/lib/Analysis/Dependences.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/Dependences.cpp?rev=230897&r1=230896&r2=230897&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/Dependences.cpp (original)
+++ polly/trunk/lib/Analysis/Dependences.cpp Sun Mar  1 12:40:25 2015
@@ -308,7 +308,7 @@ void Dependences::calculateDependences(S
                                             isl_union_map_domain(StmtSchedule));
   DEBUG({
     dbgs() << "Wrapped Dependences:\n";
-    printScop(dbgs());
+    printScop(dbgs(), S);
     dbgs() << "\n";
   });
 
@@ -355,7 +355,7 @@ void Dependences::calculateDependences(S
 
   DEBUG({
     dbgs() << "Final Wrapped Dependences:\n";
-    printScop(dbgs());
+    printScop(dbgs(), S);
     dbgs() << "\n";
   });
 
@@ -403,7 +403,7 @@ void Dependences::calculateDependences(S
 
   DEBUG({
     dbgs() << "Zipped Dependences:\n";
-    printScop(dbgs());
+    printScop(dbgs(), S);
     dbgs() << "\n";
   });
 
@@ -415,7 +415,7 @@ void Dependences::calculateDependences(S
 
   DEBUG({
     dbgs() << "Unwrapped Dependences:\n";
-    printScop(dbgs());
+    printScop(dbgs(), S);
     dbgs() << "\n";
   });
 
@@ -429,7 +429,7 @@ void Dependences::calculateDependences(S
   RED = isl_union_map_coalesce(RED);
   TC_RED = isl_union_map_coalesce(TC_RED);
 
-  DEBUG(printScop(dbgs()));
+  DEBUG(printScop(dbgs(), S));
 }
 
 void Dependences::recomputeDependences() {
@@ -556,7 +556,7 @@ static void printDependencyMap(raw_ostre
     OS << "n/a\n";
 }
 
-void Dependences::printScop(raw_ostream &OS) const {
+void Dependences::printScop(raw_ostream &OS, Scop &) const {
   OS << "\tRAW dependences:\n\t\t";
   printDependencyMap(OS, RAW);
   OS << "\tWAR dependences:\n\t\t";

Modified: polly/trunk/lib/Analysis/ScopPass.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopPass.cpp?rev=230897&r1=230896&r2=230897&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopPass.cpp (original)
+++ polly/trunk/lib/Analysis/ScopPass.cpp Sun Mar  1 12:40:25 2015
@@ -28,7 +28,7 @@ bool ScopPass::runOnRegion(Region *R, RG
 
 void ScopPass::print(raw_ostream &OS, const Module *M) const {
   if (S)
-    printScop(OS);
+    printScop(OS, *S);
 }
 
 void ScopPass::getAnalysisUsage(AnalysisUsage &AU) const {

Modified: polly/trunk/lib/CodeGen/IslAst.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslAst.cpp?rev=230897&r1=230896&r2=230897&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslAst.cpp (original)
+++ polly/trunk/lib/CodeGen/IslAst.cpp Sun Mar  1 12:40:25 2015
@@ -429,7 +429,7 @@ bool IslAstInfo::runOnScop(Scop &Scop) {
 
   Ast = new IslAst(&Scop, D);
 
-  DEBUG(printScop(dbgs()));
+  DEBUG(printScop(dbgs(), Scop));
   return false;
 }
 
@@ -515,10 +515,9 @@ isl_ast_build *IslAstInfo::getBuild(__is
   return Payload ? Payload->Build : nullptr;
 }
 
-void IslAstInfo::printScop(raw_ostream &OS) const {
+void IslAstInfo::printScop(raw_ostream &OS, Scop &S) const {
   isl_ast_print_options *Options;
   isl_ast_node *RootNode = getAst();
-  Scop &S = getCurScop();
   Function *F = S.getRegion().getEntry()->getParent();
 
   OS << ":: isl ast :: " << F->getName() << " :: " << S.getRegion().getNameStr()

Modified: polly/trunk/lib/CodeGen/IslCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslCodeGeneration.cpp?rev=230897&r1=230896&r2=230897&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/IslCodeGeneration.cpp Sun Mar  1 12:40:25 2015
@@ -930,7 +930,7 @@ public:
                 "SCoP ==\n";
       S.print(errs());
       errs() << "\n== The isl AST ==\n";
-      AI->printScop(errs());
+      AI->printScop(errs(), S);
       errs() << "\n== The invalid function ==\n";
       F.print(errs());
       errs() << "\n== The errors ==\n";
@@ -977,7 +977,7 @@ public:
     return true;
   }
 
-  virtual void printScop(raw_ostream &OS) const {}
+  virtual void printScop(raw_ostream &, Scop &) const {}
 
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
     AU.addRequired<DataLayoutPass>();

Modified: polly/trunk/lib/Exchange/JSONExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/JSONExporter.cpp?rev=230897&r1=230896&r2=230897&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/JSONExporter.cpp (original)
+++ polly/trunk/lib/Exchange/JSONExporter.cpp Sun Mar  1 12:40:25 2015
@@ -61,7 +61,7 @@ struct JSONExporter : public ScopPass {
   std::string getFileName(Scop *S) const;
   Json::Value getJSON(Scop &scop) const;
   virtual bool runOnScop(Scop &S);
-  void printScop(raw_ostream &OS) const;
+  void printScop(raw_ostream &OS, Scop &S) const;
   void getAnalysisUsage(AnalysisUsage &AU) const;
 };
 
@@ -73,7 +73,7 @@ struct JSONImporter : public ScopPass {
 
   std::string getFileName(Scop *S) const;
   virtual bool runOnScop(Scop &S);
-  void printScop(raw_ostream &OS) const;
+  void printScop(raw_ostream &OS, Scop &S) const;
   void getAnalysisUsage(AnalysisUsage &AU) const;
 };
 }
@@ -85,7 +85,7 @@ std::string JSONExporter::getFileName(Sc
   return FileName;
 }
 
-void JSONExporter::printScop(raw_ostream &OS) const { S->print(OS); }
+void JSONExporter::printScop(raw_ostream &OS, Scop &S) const { S.print(OS); }
 
 Json::Value JSONExporter::getJSON(Scop &scop) const {
   Json::Value root;
@@ -171,8 +171,8 @@ std::string JSONImporter::getFileName(Sc
   return FileName;
 }
 
-void JSONImporter::printScop(raw_ostream &OS) const {
-  S->print(OS);
+void JSONImporter::printScop(raw_ostream &OS, Scop &S) const {
+  S.print(OS);
   for (std::vector<std::string>::const_iterator I = newAccessStrings.begin(),
                                                 E = newAccessStrings.end();
        I != E; I++)

Modified: polly/trunk/lib/Transform/DeadCodeElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/DeadCodeElimination.cpp?rev=230897&r1=230896&r2=230897&view=diff
==============================================================================
--- polly/trunk/lib/Transform/DeadCodeElimination.cpp (original)
+++ polly/trunk/lib/Transform/DeadCodeElimination.cpp Sun Mar  1 12:40:25 2015
@@ -60,7 +60,7 @@ public:
 
   virtual bool runOnScop(Scop &S);
 
-  void printScop(llvm::raw_ostream &OS) const;
+  void printScop(raw_ostream &OS, Scop &S) const;
   void getAnalysisUsage(AnalysisUsage &AU) const;
 
 private:
@@ -164,7 +164,7 @@ bool DeadCodeElim::runOnScop(Scop &S) {
   return eliminateDeadCode(S, DCEPreciseSteps);
 }
 
-void DeadCodeElim::printScop(raw_ostream &OS) const {}
+void DeadCodeElim::printScop(raw_ostream &, Scop &) const {}
 
 void DeadCodeElim::getAnalysisUsage(AnalysisUsage &AU) const {
   ScopPass::getAnalysisUsage(AU);

Modified: polly/trunk/lib/Transform/Pluto.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/Pluto.cpp?rev=230897&r1=230896&r2=230897&view=diff
==============================================================================
--- polly/trunk/lib/Transform/Pluto.cpp (original)
+++ polly/trunk/lib/Transform/Pluto.cpp Sun Mar  1 12:40:25 2015
@@ -131,7 +131,7 @@ public:
   explicit PlutoOptimizer() : ScopPass(ID) {}
 
   virtual bool runOnScop(Scop &S);
-  void printScop(llvm::raw_ostream &OS) const;
+  void printScop(llvm::raw_ostream &OS, Scop &S) const;
   void getAnalysisUsage(AnalysisUsage &AU) const;
   static void extendScattering(Scop &S, unsigned NewDimensions);
 };
@@ -250,7 +250,7 @@ bool PlutoOptimizer::runOnScop(Scop &S)
   return false;
 }
 
-void PlutoOptimizer::printScop(raw_ostream &OS) const {}
+void PlutoOptimizer::printScop(raw_ostream &, Scop &) const {}
 
 void PlutoOptimizer::getAnalysisUsage(AnalysisUsage &AU) const {
   ScopPass::getAnalysisUsage(AU);

Modified: polly/trunk/lib/Transform/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/ScheduleOptimizer.cpp?rev=230897&r1=230896&r2=230897&view=diff
==============================================================================
--- polly/trunk/lib/Transform/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/Transform/ScheduleOptimizer.cpp Sun Mar  1 12:40:25 2015
@@ -100,7 +100,7 @@ public:
   ~IslScheduleOptimizer() { isl_schedule_free(LastSchedule); }
 
   virtual bool runOnScop(Scop &S);
-  void printScop(llvm::raw_ostream &OS) const;
+  void printScop(raw_ostream &OS, Scop &S) const;
   void getAnalysisUsage(AnalysisUsage &AU) const;
 
 private:
@@ -627,7 +627,7 @@ bool IslScheduleOptimizer::runOnScop(Sco
   return false;
 }
 
-void IslScheduleOptimizer::printScop(raw_ostream &OS) const {
+void IslScheduleOptimizer::printScop(raw_ostream &OS, Scop &) const {
   isl_printer *p;
   char *ScheduleStr;
 





More information about the llvm-commits mailing list