[Refactor] Add a Scop & as argument to printScop

This is the first step in the interface simplification.

llvm-svn: 230897
This commit is contained in:
Johannes Doerfert 2015-03-01 18:40:25 +00:00
parent 0200f2507e
commit 3fe584d64f
11 changed files with 27 additions and 26 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -308,7 +308,7 @@ void Dependences::calculateDependences(Scop &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(Scop &S) {
DEBUG({
dbgs() << "Final Wrapped Dependences:\n";
printScop(dbgs());
printScop(dbgs(), S);
dbgs() << "\n";
});
@ -403,7 +403,7 @@ void Dependences::calculateDependences(Scop &S) {
DEBUG({
dbgs() << "Zipped Dependences:\n";
printScop(dbgs());
printScop(dbgs(), S);
dbgs() << "\n";
});
@ -415,7 +415,7 @@ void Dependences::calculateDependences(Scop &S) {
DEBUG({
dbgs() << "Unwrapped Dependences:\n";
printScop(dbgs());
printScop(dbgs(), S);
dbgs() << "\n";
});
@ -429,7 +429,7 @@ void Dependences::calculateDependences(Scop &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_ostream &OS, __isl_keep isl_union_map *DM) {
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";

View File

@ -28,7 +28,7 @@ bool ScopPass::runOnRegion(Region *R, RGPassManager &RGM) {
void ScopPass::print(raw_ostream &OS, const Module *M) const {
if (S)
printScop(OS);
printScop(OS, *S);
}
void ScopPass::getAnalysisUsage(AnalysisUsage &AU) const {

View File

@ -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(__isl_keep isl_ast_node *Node) {
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()

View File

@ -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>();

View File

@ -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(Scop *S) const {
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(Scop *S) const {
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++)

View File

@ -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);

View File

@ -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);

View File

@ -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(Scop &S) {
return false;
}
void IslScheduleOptimizer::printScop(raw_ostream &OS) const {
void IslScheduleOptimizer::printScop(raw_ostream &OS, Scop &) const {
isl_printer *p;
char *ScheduleStr;