[llvm-commits] [llvm] r81838 - in /llvm/trunk: include/llvm/PassManagers.h lib/Analysis/IPA/CallGraphSCCPass.cpp lib/VMCore/PassManager.cpp
Chris Lattner
sabre at nondot.org
Mon Sep 14 22:03:04 PDT 2009
Author: lattner
Date: Tue Sep 15 00:03:04 2009
New Revision: 81838
URL: http://llvm.org/viewvc/llvm-project?rev=81838&view=rev
Log:
make -debug-pass=Executions show information about what call graph nodes
are in the SCC for each execution of a CGSCC pass.
Modified:
llvm/trunk/include/llvm/PassManagers.h
llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp
llvm/trunk/lib/VMCore/PassManager.cpp
Modified: llvm/trunk/include/llvm/PassManagers.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManagers.h?rev=81838&r1=81837&r2=81838&view=diff
==============================================================================
--- llvm/trunk/include/llvm/PassManagers.h (original)
+++ llvm/trunk/include/llvm/PassManagers.h Tue Sep 15 00:03:04 2009
@@ -380,6 +380,11 @@
// then PMT_Last active pass mangers.
std::map<AnalysisID, Pass *> *InheritedAnalysis[PMT_Last];
+
+ /// isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions
+ /// or higher is specified.
+ bool isPassDebuggingExecutionsOrMore() const;
+
private:
void dumpAnalysisUsage(const StringRef &Msg, const Pass *P,
const AnalysisUsage::VectorType &Set) const;
Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=81838&r1=81837&r2=81838&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Tue Sep 15 00:03:04 2009
@@ -317,7 +317,20 @@
PassNo != e; ++PassNo) {
Pass *P = getContainedPass(PassNo);
- dumpPassInfo(P, EXECUTION_MSG, ON_CG_MSG, "");
+ // If we're in -debug-pass=Executions mode, construct the SCC node list,
+ // otherwise avoid constructing this string as it is expensive.
+ if (isPassDebuggingExecutionsOrMore()) {
+ std::string Functions;
+#ifndef NDEBUG
+ raw_string_ostream OS(Functions);
+ for (unsigned i = 0, e = CurSCC.size(); i != e; ++i) {
+ if (i) OS << ", ";
+ CurSCC[i]->print(OS);
+ }
+ OS.flush();
+#endif
+ dumpPassInfo(P, EXECUTION_MSG, ON_CG_MSG, Functions);
+ }
dumpRequiredSet(P);
initializeAnalysisImpl(P);
Modified: llvm/trunk/lib/VMCore/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=81838&r1=81837&r2=81838&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/PassManager.cpp (original)
+++ llvm/trunk/lib/VMCore/PassManager.cpp Tue Sep 15 00:03:04 2009
@@ -67,6 +67,15 @@
clEnumValEnd));
} // End of llvm namespace
+/// isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions
+/// or higher is specified.
+bool PMDataManager::isPassDebuggingExecutionsOrMore() const {
+ return PassDebugging >= Executions;
+}
+
+
+
+
void PassManagerPrettyStackEntry::print(raw_ostream &OS) const {
if (V == 0 && M == 0)
OS << "Releasing pass '";
@@ -1044,7 +1053,7 @@
errs() << "' on Loop '" << Msg << "'...\n";
break;
case ON_CG_MSG:
- errs() << "' on Call Graph '" << Msg << "'...\n";
+ errs() << "' on Call Graph Nodes '" << Msg << "'...\n";
break;
default:
break;
@@ -1076,10 +1085,10 @@
return;
errs() << (void*)P << std::string(getDepth()*2+3, ' ') << Msg << " Analyses:";
for (unsigned i = 0; i != Set.size(); ++i) {
- if (i) errs() << ",";
- errs() << " " << Set[i]->getPassName();
+ if (i) errs() << ',';
+ errs() << ' ' << Set[i]->getPassName();
}
- errs() << "\n";
+ errs() << '\n';
}
/// Add RequiredPass into list of lower level passes required by pass P.
More information about the llvm-commits
mailing list