[polly] r248685 - [NFC] Consistenly use commented and annotated ScopPass functions
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 27 08:43:29 PDT 2015
Author: jdoerfert
Date: Sun Sep 27 10:43:29 2015
New Revision: 248685
URL: http://llvm.org/viewvc/llvm-project?rev=248685&view=rev
Log:
[NFC] Consistenly use commented and annotated ScopPass functions
The changes affect methods that are part of the Pass interface and
include:
- Comments that describe the methods purpose.
- A consistent use of the keywords override and virtual.
Additionally, the printScop method is now optional and removed from
SCoP passes that do not implement it.
Modified:
polly/trunk/include/polly/CodeGen/IslAst.h
polly/trunk/include/polly/DependenceInfo.h
polly/trunk/include/polly/ScopPass.h
polly/trunk/lib/CodeGen/CodeGeneration.cpp
polly/trunk/lib/Exchange/JSONExporter.cpp
polly/trunk/lib/Transform/DeadCodeElimination.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=248685&r1=248684&r2=248685&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/IslAst.h (original)
+++ polly/trunk/include/polly/CodeGen/IslAst.h Sun Sep 27 10:43:29 2015
@@ -88,10 +88,16 @@ public:
IslAstInfo() : ScopPass(ID), S(nullptr), Ast(nullptr) {}
/// @brief Build the AST for the given SCoP @p S.
- bool runOnScop(Scop &S);
+ bool runOnScop(Scop &S) override;
+
+ /// @brief Register all analyses and transformation required.
+ void getAnalysisUsage(AnalysisUsage &AU) const override;
+
+ /// @brief Release the internal memory.
+ void releaseMemory() override;
/// @brief Print a source code representation of the program.
- void printScop(llvm::raw_ostream &OS, Scop &S) const;
+ void printScop(llvm::raw_ostream &OS, Scop &S) const override;
/// @brief Return a copy of the AST root node.
__isl_give isl_ast_node *getAst() const;
@@ -143,9 +149,6 @@ public:
static __isl_give isl_ast_build *getBuild(__isl_keep isl_ast_node *Node);
///}
-
- virtual void getAnalysisUsage(AnalysisUsage &AU) const;
- virtual void releaseMemory();
};
}
Modified: polly/trunk/include/polly/DependenceInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/DependenceInfo.h?rev=248685&r1=248684&r2=248685&view=diff
==============================================================================
--- polly/trunk/include/polly/DependenceInfo.h (original)
+++ polly/trunk/include/polly/DependenceInfo.h Sun Sep 27 10:43:29 2015
@@ -188,9 +188,16 @@ public:
/// @brief Recompute dependences from schedule and memory accesses.
void recomputeDependences();
+ /// @brief Compute the dependence information for the SCoP @p S.
bool runOnScop(Scop &S) override;
+
+ /// @brief Print the dependences for the given SCoP to @p OS.
void printScop(raw_ostream &OS, Scop &) const override { D.print(OS); }
+
+ /// @brief Release the internal memory.
void releaseMemory() override { D.releaseMemory(); }
+
+ /// @brief Register all analyses and transformation required.
void getAnalysisUsage(AnalysisUsage &AU) const override;
private:
Modified: polly/trunk/include/polly/ScopPass.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopPass.h?rev=248685&r1=248684&r2=248685&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopPass.h (original)
+++ polly/trunk/include/polly/ScopPass.h Sun Sep 27 10:43:29 2015
@@ -42,7 +42,7 @@ protected:
virtual bool runOnScop(Scop &S) = 0;
/// @brief Print method for SCoPs.
- virtual void printScop(raw_ostream &OS, Scop &S) const = 0;
+ virtual void printScop(raw_ostream &OS, Scop &S) const {};
/// getAnalysisUsage - Subclasses that override getAnalysisUsage
/// must call this.
Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=248685&r1=248684&r2=248685&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Sun Sep 27 10:43:29 2015
@@ -108,6 +108,7 @@ public:
}
}
+ /// @brief Generate LLVM-IR for the SCoP @p S.
bool runOnScop(Scop &S) override {
AI = &getAnalysis<IslAstInfo>();
@@ -159,8 +160,7 @@ public:
return true;
}
- void printScop(raw_ostream &, Scop &) const override {}
-
+ /// @brief Register all analyses and transformation required.
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<DominatorTreeWrapperPass>();
AU.addRequired<IslAstInfo>();
Modified: polly/trunk/lib/Exchange/JSONExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/JSONExporter.cpp?rev=248685&r1=248684&r2=248685&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/JSONExporter.cpp (original)
+++ polly/trunk/lib/Exchange/JSONExporter.cpp Sun Sep 27 10:43:29 2015
@@ -60,9 +60,15 @@ struct JSONExporter : public ScopPass {
std::string getFileName(Scop &S) const;
Json::Value getJSON(Scop &S) const;
- virtual bool runOnScop(Scop &S);
- void printScop(raw_ostream &OS, Scop &S) const;
- void getAnalysisUsage(AnalysisUsage &AU) const;
+
+ /// @brief Export the SCoP @p S to a JSON file.
+ bool runOnScop(Scop &S) override;
+
+ /// @brief Print the SCoP @p S as it is exported.
+ void printScop(raw_ostream &OS, Scop &S) const override;
+
+ /// @brief Register all analyses and transformation required.
+ void getAnalysisUsage(AnalysisUsage &AU) const override;
};
struct JSONImporter : public ScopPass {
@@ -71,9 +77,15 @@ struct JSONImporter : public ScopPass {
explicit JSONImporter() : ScopPass(ID) {}
std::string getFileName(Scop &S) const;
- virtual bool runOnScop(Scop &S);
- void printScop(raw_ostream &OS, Scop &S) const;
- void getAnalysisUsage(AnalysisUsage &AU) const;
+
+ /// @brief Import new access functions for SCoP @p S from a JSON file.
+ bool runOnScop(Scop &S) override;
+
+ /// @brief Print the SCoP @p S and the imported access functions.
+ void printScop(raw_ostream &OS, Scop &S) const override;
+
+ /// @brief Register all analyses and transformation required.
+ void getAnalysisUsage(AnalysisUsage &AU) const override;
};
}
@@ -386,6 +398,7 @@ void JSONImporter::getAnalysisUsage(Anal
ScopPass::getAnalysisUsage(AU);
AU.addRequired<DependenceInfo>();
}
+
Pass *polly::createJSONImporterPass() { return new JSONImporter(); }
INITIALIZE_PASS_BEGIN(JSONExporter, "polly-export-jscop",
Modified: polly/trunk/lib/Transform/DeadCodeElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/DeadCodeElimination.cpp?rev=248685&r1=248684&r2=248685&view=diff
==============================================================================
--- polly/trunk/lib/Transform/DeadCodeElimination.cpp (original)
+++ polly/trunk/lib/Transform/DeadCodeElimination.cpp Sun Sep 27 10:43:29 2015
@@ -59,9 +59,10 @@ public:
static char ID;
explicit DeadCodeElim() : ScopPass(ID) {}
+ /// @brief Remove dead iterations from the schedule of @p S.
bool runOnScop(Scop &S) override;
- void printScop(raw_ostream &OS, Scop &S) const override;
+ /// @brief Register all analyses and transformation required.
void getAnalysisUsage(AnalysisUsage &AU) const override;
private:
@@ -166,8 +167,6 @@ bool DeadCodeElim::runOnScop(Scop &S) {
return eliminateDeadCode(S, DCEPreciseSteps);
}
-void DeadCodeElim::printScop(raw_ostream &, Scop &) const {}
-
void DeadCodeElim::getAnalysisUsage(AnalysisUsage &AU) const {
ScopPass::getAnalysisUsage(AU);
AU.addRequired<DependenceInfo>();
Modified: polly/trunk/lib/Transform/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/ScheduleOptimizer.cpp?rev=248685&r1=248684&r2=248685&view=diff
==============================================================================
--- polly/trunk/lib/Transform/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/Transform/ScheduleOptimizer.cpp Sun Sep 27 10:43:29 2015
@@ -328,18 +328,23 @@ public:
~IslScheduleOptimizer() { isl_schedule_free(LastSchedule); }
+ /// @brief Optimize the schedule of the SCoP @p S.
bool runOnScop(Scop &S) override;
+
+ /// @brief Print the new schedule for the SCoP @p S.
void printScop(raw_ostream &OS, Scop &S) const override;
- void getAnalysisUsage(AnalysisUsage &AU) const override;
-private:
- isl_schedule *LastSchedule;
+ /// @brief Register all analyses and transformation required.
+ void getAnalysisUsage(AnalysisUsage &AU) const override;
/// @brief Release the internal memory.
void releaseMemory() override {
isl_schedule_free(LastSchedule);
LastSchedule = nullptr;
}
+
+private:
+ isl_schedule *LastSchedule;
};
}
More information about the llvm-commits
mailing list