[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. llvm-svn: 248685
This commit is contained in:
parent
0f37630849
commit
45be64464b
|
@ -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();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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>();
|
||||
|
|
|
@ -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(AnalysisUsage &AU) const {
|
|||
ScopPass::getAnalysisUsage(AU);
|
||||
AU.addRequired<DependenceInfo>();
|
||||
}
|
||||
|
||||
Pass *polly::createJSONImporterPass() { return new JSONImporter(); }
|
||||
|
||||
INITIALIZE_PASS_BEGIN(JSONExporter, "polly-export-jscop",
|
||||
|
|
|
@ -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>();
|
||||
|
|
|
@ -328,18 +328,23 @@ public:
|
|||
|
||||
~IslScheduleOptimizer() { isl_schedule_free(LastSchedule); }
|
||||
|
||||
/// @brief Optimize the schedule of the SCoP @p S.
|
||||
bool runOnScop(Scop &S) override;
|
||||
void printScop(raw_ostream &OS, Scop &S) const override;
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override;
|
||||
|
||||
private:
|
||||
isl_schedule *LastSchedule;
|
||||
/// @brief Print the new schedule for the SCoP @p S.
|
||||
void printScop(raw_ostream &OS, Scop &S) const override;
|
||||
|
||||
/// @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;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue