Skip to content

Commit

Permalink
Make the SCC printing passes use errs() instead of outs(), as the
Browse files Browse the repository at this point in the history
other printing passes do, and update the documentation accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111601 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Dan Gohman committed Aug 20, 2010
1 parent 4bb122e commit 52fdaed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions docs/Passes.html
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@
<div class="doc_text">
<p>
This pass, only available in <code>opt</code>, prints the call graph to
standard output in a human-readable form.
standard error in a human-readable form.
</p>
</div>

Expand All @@ -660,7 +660,7 @@
<div class="doc_text">
<p>
This pass, only available in <code>opt</code>, prints the SCCs of the call
graph to standard output in a human-readable form.
graph to standard error in a human-readable form.
</p>
</div>

Expand All @@ -671,7 +671,7 @@
<div class="doc_text">
<p>
This pass, only available in <code>opt</code>, prints the SCCs of each
function CFG to standard output in a human-readable form.
function CFG to standard error in a human-readable form.
</p>
</div>

Expand Down
20 changes: 10 additions & 10 deletions tools/opt/PrintSCC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@ Z("print-callgraph-sccs", "Print SCCs of the Call Graph");

bool CFGSCC::runOnFunction(Function &F) {
unsigned sccNum = 0;
outs() << "SCCs for Function " << F.getName() << " in PostOrder:";
errs() << "SCCs for Function " << F.getName() << " in PostOrder:";
for (scc_iterator<Function*> SCCI = scc_begin(&F),
E = scc_end(&F); SCCI != E; ++SCCI) {
std::vector<BasicBlock*> &nextSCC = *SCCI;
outs() << "\nSCC #" << ++sccNum << " : ";
errs() << "\nSCC #" << ++sccNum << " : ";
for (std::vector<BasicBlock*>::const_iterator I = nextSCC.begin(),
E = nextSCC.end(); I != E; ++I)
outs() << (*I)->getName() << ", ";
errs() << (*I)->getName() << ", ";
if (nextSCC.size() == 1 && SCCI.hasLoop())
outs() << " (Has self-loop).";
errs() << " (Has self-loop).";
}
outs() << "\n";
errs() << "\n";

return true;
}
Expand All @@ -94,19 +94,19 @@ bool CFGSCC::runOnFunction(Function &F) {
bool CallGraphSCC::runOnModule(Module &M) {
CallGraphNode* rootNode = getAnalysis<CallGraph>().getRoot();
unsigned sccNum = 0;
outs() << "SCCs for the program in PostOrder:";
errs() << "SCCs for the program in PostOrder:";
for (scc_iterator<CallGraphNode*> SCCI = scc_begin(rootNode),
E = scc_end(rootNode); SCCI != E; ++SCCI) {
const std::vector<CallGraphNode*> &nextSCC = *SCCI;
outs() << "\nSCC #" << ++sccNum << " : ";
errs() << "\nSCC #" << ++sccNum << " : ";
for (std::vector<CallGraphNode*>::const_iterator I = nextSCC.begin(),
E = nextSCC.end(); I != E; ++I)
outs() << ((*I)->getFunction() ? (*I)->getFunction()->getNameStr()
errs() << ((*I)->getFunction() ? (*I)->getFunction()->getNameStr()
: std::string("external node")) << ", ";
if (nextSCC.size() == 1 && SCCI.hasLoop())
outs() << " (Has self-loop).";
errs() << " (Has self-loop).";
}
outs() << "\n";
errs() << "\n";

return true;
}

0 comments on commit 52fdaed

Please sign in to comment.