[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Mar 25 12:37:44 PST 2005
Changes in directory llvm/lib/Analysis/DataStructure:
Printer.cpp updated: 1.79 -> 1.80
---
Log message:
Don't count all of the nodes in the SCC once for each function in the SCC.
---
Diffs of the changes: (+9 -4)
Printer.cpp | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
Index: llvm/lib/Analysis/DataStructure/Printer.cpp
diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.79 llvm/lib/Analysis/DataStructure/Printer.cpp:1.80
--- llvm/lib/Analysis/DataStructure/Printer.cpp:1.79 Sat Mar 19 20:40:11 2005
+++ llvm/lib/Analysis/DataStructure/Printer.cpp Fri Mar 25 14:37:32 2005
@@ -283,20 +283,25 @@
for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
if (C.hasGraph(*I)) {
DSGraph &Gr = C.getDSGraph((Function&)*I);
- TotalNumNodes += Gr.getGraphSize();
unsigned NumCalls = Gr.shouldPrintAuxCalls() ?
Gr.getAuxFunctionCalls().size() : Gr.getFunctionCalls().size();
- TotalCallNodes += NumCalls;
if (I->getName() == "main" || !OnlyPrintMain) {
Function *SCCFn = Gr.retnodes_begin()->first;
- if (&*I == SCCFn)
+ if (&*I == SCCFn) {
+ TotalNumNodes += Gr.getGraphSize();
+ TotalCallNodes += NumCalls;
+
Gr.writeGraphToFile(O, Prefix+I->getName());
- else
+ } else {
+ // Don't double count node/call nodes.
O << "Didn't write '" << Prefix+I->getName()
<< ".dot' - Graph already emitted to '" << Prefix+SCCFn->getName()
<< "\n";
+ }
} else {
+ TotalNumNodes += Gr.getGraphSize();
+ TotalCallNodes += NumCalls;
O << "Skipped Writing '" << Prefix+I->getName() << ".dot'... ["
<< Gr.getGraphSize() << "+" << NumCalls << "]\n";
}
More information about the llvm-commits
mailing list