[polly] r308746 - [ScopInfo] Print instructions in dump().
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 21 08:35:53 PDT 2017
Author: meinersbur
Date: Fri Jul 21 08:35:53 2017
New Revision: 308746
URL: http://llvm.org/viewvc/llvm-project?rev=308746&view=rev
Log:
[ScopInfo] Print instructions in dump().
Print a statement's instruction on dump() regardless of
-polly-print-instructions. dump() is supposed to be used in the debugger
only and never in regression tests. While debugging, get all the
information we have and we are not bound to break anything. For non-dump
purposes of print, forward the setting of -polly-print-instructions as
parameters.
Some calls to print() had to be changed because the
PollyPrintInstructions setting is only available in ScopInfo.cpp.
In ScheduleOptimizer.cpp, dump() was used in regression tests.
That's not what dump() is for.
The print parameter "PrintInstructions" will also be useful for an
explicit print SCoP pass in a future patch.
Modified:
polly/trunk/include/polly/ScopInfo.h
polly/trunk/lib/Analysis/ScopBuilder.cpp
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/CodeGen/CodeGeneration.cpp
polly/trunk/lib/Exchange/JSONExporter.cpp
polly/trunk/lib/Transform/DeLICM.cpp
polly/trunk/lib/Transform/ScheduleOptimizer.cpp
polly/trunk/lib/Transform/Simplify.cpp
Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=308746&r1=308745&r2=308746&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Fri Jul 21 08:35:53 2017
@@ -1611,8 +1611,10 @@ public:
/// Print the ScopStmt.
///
- /// @param OS The output stream the ScopStmt is printed to.
- void print(raw_ostream &OS) const;
+ /// @param OS The output stream the ScopStmt is printed to.
+ /// @param PrintInstructions Whether to print the statement's instructions as
+ /// well.
+ void print(raw_ostream &OS, bool PrintInstructions) const;
/// Print the instructions in ScopStmt.
///
@@ -1623,10 +1625,7 @@ public:
};
/// Print ScopStmt S to raw_ostream O.
-static inline raw_ostream &operator<<(raw_ostream &O, const ScopStmt &S) {
- S.print(O);
- return O;
-}
+raw_ostream &operator<<(raw_ostream &O, const ScopStmt &S);
/// Static Control Part
///
@@ -2318,7 +2317,7 @@ private:
//@{
void printContext(raw_ostream &OS) const;
void printArrayInfo(raw_ostream &OS) const;
- void printStatements(raw_ostream &OS) const;
+ void printStatements(raw_ostream &OS, bool PrintInstructions) const;
void printAliasAssumptions(raw_ostream &OS) const;
//@}
@@ -2811,7 +2810,9 @@ public:
/// Print the static control part.
///
/// @param OS The output stream the static control part is printed to.
- void print(raw_ostream &OS) const;
+ /// @param PrintInstructions Whether to print the statement's instructions as
+ /// well.
+ void print(raw_ostream &OS, bool PrintInstructions) const;
/// Print the ScopStmt to stderr.
void dump() const;
@@ -2956,10 +2957,7 @@ public:
};
/// Print Scop scop to raw_ostream O.
-static inline raw_ostream &operator<<(raw_ostream &O, const Scop &scop) {
- scop.print(O);
- return O;
-}
+raw_ostream &operator<<(raw_ostream &O, const Scop &scop);
/// The legacy pass manager's analysis pass to compute scop information
/// for a region.
Modified: polly/trunk/lib/Analysis/ScopBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopBuilder.cpp?rev=308746&r1=308745&r2=308746&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopBuilder.cpp (original)
+++ polly/trunk/lib/Analysis/ScopBuilder.cpp Fri Jul 21 08:35:53 2017
@@ -1048,7 +1048,7 @@ ScopBuilder::ScopBuilder(Region *R, Assu
buildScop(*R, AC);
- DEBUG(scop->print(dbgs()));
+ DEBUG(dbgs() << *scop);
if (!scop->hasFeasibleRuntimeContext()) {
InfeasibleScops++;
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=308746&r1=308745&r2=308746&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Fri Jul 21 08:35:53 2017
@@ -1974,7 +1974,7 @@ void ScopStmt::printInstructions(raw_ost
OS.indent(16) << "}\n";
}
-void ScopStmt::print(raw_ostream &OS) const {
+void ScopStmt::print(raw_ostream &OS, bool PrintInstructions) const {
OS << "\t" << getBaseName() << "\n";
OS.indent(12) << "Domain :=\n";
@@ -1993,11 +1993,11 @@ void ScopStmt::print(raw_ostream &OS) co
for (MemoryAccess *Access : MemAccs)
Access->print(OS);
- if (PollyPrintInstructions)
+ if (PrintInstructions)
printInstructions(OS.indent(12));
}
-void ScopStmt::dump() const { print(dbgs()); }
+void ScopStmt::dump() const { print(dbgs(), true); }
void ScopStmt::removeAccessData(MemoryAccess *MA) {
if (MA->isRead() && MA->isOriginalValueKind()) {
@@ -2059,6 +2059,11 @@ void ScopStmt::removeSingleMemoryAccess(
}
}
+raw_ostream &polly::operator<<(raw_ostream &O, const ScopStmt &S) {
+ S.print(O, PollyPrintInstructions);
+ return O;
+}
+
//===----------------------------------------------------------------------===//
/// Scop class implement
@@ -4605,11 +4610,13 @@ void Scop::printAliasAssumptions(raw_ost
}
}
-void Scop::printStatements(raw_ostream &OS) const {
+void Scop::printStatements(raw_ostream &OS, bool PrintInstructions) const {
OS << "Statements {\n";
- for (const ScopStmt &Stmt : *this)
- OS.indent(4) << Stmt;
+ for (const ScopStmt &Stmt : *this) {
+ OS.indent(4);
+ Stmt.print(OS, PrintInstructions);
+ }
OS.indent(4) << "}\n";
}
@@ -4630,7 +4637,7 @@ void Scop::printArrayInfo(raw_ostream &O
OS.indent(4) << "}\n";
}
-void Scop::print(raw_ostream &OS) const {
+void Scop::print(raw_ostream &OS, bool PrintInstructions) const {
OS.indent(4) << "Function: " << getFunction().getName() << "\n";
OS.indent(4) << "Region: " << getNameStr() << "\n";
OS.indent(4) << "Max Loop Depth: " << getMaxLoopDepth() << "\n";
@@ -4649,10 +4656,10 @@ void Scop::print(raw_ostream &OS) const
printContext(OS.indent(4));
printArrayInfo(OS.indent(4));
printAliasAssumptions(OS);
- printStatements(OS.indent(4));
+ printStatements(OS.indent(4), PrintInstructions);
}
-void Scop::dump() const { print(dbgs()); }
+void Scop::dump() const { print(dbgs(), true); }
isl_ctx *Scop::getIslCtx() const { return IslCtx.get(); }
@@ -5128,6 +5135,11 @@ ArrayRef<MemoryAccess *> Scop::getPHIInc
return It->second;
}
+raw_ostream &polly::operator<<(raw_ostream &O, const Scop &scop) {
+ scop.print(O, PollyPrintInstructions);
+ return O;
+}
+
//===----------------------------------------------------------------------===//
void ScopInfoRegionPass::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<LoopInfoWrapperPass>();
@@ -5187,7 +5199,7 @@ bool ScopInfoRegionPass::runOnRegion(Reg
void ScopInfoRegionPass::print(raw_ostream &OS, const Module *) const {
if (S)
- S->print(OS);
+ S->print(OS, PollyPrintInstructions);
else
OS << "Invalid Scop!\n";
}
@@ -5250,7 +5262,7 @@ PreservedAnalyses ScopInfoPrinterPass::r
auto &SI = FAM.getResult<ScopInfoAnalysis>(F);
for (auto &It : SI) {
if (It.second)
- It.second->print(Stream);
+ It.second->print(Stream, PollyPrintInstructions);
else
Stream << "Invalid Scop!\n";
}
@@ -5284,7 +5296,7 @@ bool ScopInfoWrapperPass::runOnFunction(
void ScopInfoWrapperPass::print(raw_ostream &OS, const Module *) const {
for (auto &It : *Result) {
if (It.second)
- It.second->print(OS);
+ It.second->print(OS, PollyPrintInstructions);
else
OS << "Invalid Scop!\n";
}
Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=308746&r1=308745&r2=308746&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Fri Jul 21 08:35:53 2017
@@ -63,7 +63,7 @@ static void verifyGeneratedFunction(Scop
DEBUG({
errs() << "== ISL Codegen created an invalid function ==\n\n== The "
"SCoP ==\n";
- S.print(errs());
+ errs() << S;
errs() << "\n== The isl AST ==\n";
AI.print(errs());
errs() << "\n== The invalid function ==\n";
Modified: polly/trunk/lib/Exchange/JSONExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/JSONExporter.cpp?rev=308746&r1=308745&r2=308746&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/JSONExporter.cpp (original)
+++ polly/trunk/lib/Exchange/JSONExporter.cpp Fri Jul 21 08:35:53 2017
@@ -134,7 +134,7 @@ std::string JSONExporter::getFileName(Sc
return FileName;
}
-void JSONExporter::printScop(raw_ostream &OS, Scop &S) const { S.print(OS); }
+void JSONExporter::printScop(raw_ostream &OS, Scop &S) const { OS << S; }
/// Export all arrays from the Scop.
///
@@ -263,7 +263,7 @@ std::string JSONImporter::getFileName(Sc
}
void JSONImporter::printScop(raw_ostream &OS, Scop &S) const {
- S.print(OS);
+ OS << S;
for (std::vector<std::string>::const_iterator I = NewAccessStrings.begin(),
E = NewAccessStrings.end();
I != E; I++)
Modified: polly/trunk/lib/Transform/DeLICM.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/DeLICM.cpp?rev=308746&r1=308745&r2=308746&view=diff
==============================================================================
--- polly/trunk/lib/Transform/DeLICM.cpp (original)
+++ polly/trunk/lib/Transform/DeLICM.cpp Fri Jul 21 08:35:53 2017
@@ -2155,7 +2155,7 @@ private:
Impl->greedyCollapse();
DEBUG(dbgs() << "\nFinal Scop:\n");
- DEBUG(S.print(dbgs()));
+ DEBUG(dbgs() << S);
}
public:
Modified: polly/trunk/lib/Transform/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/ScheduleOptimizer.cpp?rev=308746&r1=308745&r2=308746&view=diff
==============================================================================
--- polly/trunk/lib/Transform/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/Transform/ScheduleOptimizer.cpp Fri Jul 21 08:35:53 2017
@@ -1596,7 +1596,7 @@ bool IslScheduleOptimizer::runOnScop(Sco
S.markAsOptimized();
if (OptimizedScops)
- S.dump();
+ errs() << S;
return false;
}
Modified: polly/trunk/lib/Transform/Simplify.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/Simplify.cpp?rev=308746&r1=308745&r2=308746&view=diff
==============================================================================
--- polly/trunk/lib/Transform/Simplify.cpp (original)
+++ polly/trunk/lib/Transform/Simplify.cpp Fri Jul 21 08:35:53 2017
@@ -434,7 +434,7 @@ public:
if (isModified())
ScopsModified++;
DEBUG(dbgs() << "\nFinal Scop:\n");
- DEBUG(S.print(dbgs()));
+ DEBUG(dbgs() << S);
return false;
}
More information about the llvm-commits
mailing list