[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. llvm-svn: 308746
This commit is contained in:
parent
b2a9a23213
commit
cd4c977b8b
@ -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.
|
||||
|
||||
@ -1048,7 +1048,7 @@ ScopBuilder::ScopBuilder(Region *R, AssumptionCache &AC, AliasAnalysis &AA,
|
||||
|
||||
buildScop(*R, AC);
|
||||
|
||||
DEBUG(scop->print(dbgs()));
|
||||
DEBUG(dbgs() << *scop);
|
||||
|
||||
if (!scop->hasFeasibleRuntimeContext()) {
|
||||
InfeasibleScops++;
|
||||
|
||||
@ -1974,7 +1974,7 @@ void ScopStmt::printInstructions(raw_ostream &OS) const {
|
||||
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) const {
|
||||
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(MemoryAccess *MA) {
|
||||
}
|
||||
}
|
||||
|
||||
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_ostream &OS) const {
|
||||
}
|
||||
}
|
||||
|
||||
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 &OS) const {
|
||||
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::getPHIIncomings(const ScopArrayInfo *SAI) const {
|
||||
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(Region *R, RGPassManager &RGM) {
|
||||
|
||||
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::run(Function &F,
|
||||
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(Function &F) {
|
||||
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";
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ static void verifyGeneratedFunction(Scop &S, Function &F, IslAstInfo &AI) {
|
||||
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";
|
||||
|
||||
@ -134,7 +134,7 @@ std::string JSONExporter::getFileName(Scop &S) const {
|
||||
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(Scop &S) const {
|
||||
}
|
||||
|
||||
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++)
|
||||
|
||||
@ -2155,7 +2155,7 @@ private:
|
||||
Impl->greedyCollapse();
|
||||
|
||||
DEBUG(dbgs() << "\nFinal Scop:\n");
|
||||
DEBUG(S.print(dbgs()));
|
||||
DEBUG(dbgs() << S);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@ -1596,7 +1596,7 @@ bool IslScheduleOptimizer::runOnScop(Scop &S) {
|
||||
S.markAsOptimized();
|
||||
|
||||
if (OptimizedScops)
|
||||
S.dump();
|
||||
errs() << S;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -434,7 +434,7 @@ public:
|
||||
if (isModified())
|
||||
ScopsModified++;
|
||||
DEBUG(dbgs() << "\nFinal Scop:\n");
|
||||
DEBUG(S.print(dbgs()));
|
||||
DEBUG(dbgs() << S);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user