summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/DataStructure
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-03-25 20:54:45 +0000
committerChris Lattner <sabre@nondot.org>2005-03-25 20:54:45 +0000
commitd21e2200358cc55356a46c88ce476ba049a90afb (patch)
tree239ebb646d26d05dd6c1f2af9746c1dc776751ec /llvm/lib/Analysis/DataStructure
parentb7ffd50537e4127c86def112a6d5d068f63d2183 (diff)
downloadbcm5719-llvm-d21e2200358cc55356a46c88ce476ba049a90afb.tar.gz
bcm5719-llvm-d21e2200358cc55356a46c88ce476ba049a90afb.zip
no really, don't double count these nodes either!
llvm-svn: 20837
Diffstat (limited to 'llvm/lib/Analysis/DataStructure')
-rw-r--r--llvm/lib/Analysis/DataStructure/Printer.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/llvm/lib/Analysis/DataStructure/Printer.cpp b/llvm/lib/Analysis/DataStructure/Printer.cpp
index d24045b7653..03b298cbadb 100644
--- a/llvm/lib/Analysis/DataStructure/Printer.cpp
+++ b/llvm/lib/Analysis/DataStructure/Printer.cpp
@@ -285,34 +285,39 @@ static void printCollection(const Collection &C, std::ostream &O,
DSGraph &Gr = C.getDSGraph((Function&)*I);
unsigned NumCalls = Gr.shouldPrintAuxCalls() ?
Gr.getAuxFunctionCalls().size() : Gr.getFunctionCalls().size();
+ bool IsDuplicateGraph = false;
if (I->getName() == "main" || !OnlyPrintMain) {
Function *SCCFn = Gr.retnodes_begin()->first;
if (&*I == SCCFn) {
- TotalNumNodes += Gr.getGraphSize();
- TotalCallNodes += NumCalls;
-
Gr.writeGraphToFile(O, Prefix+I->getName());
} else {
- // Don't double count node/call nodes.
+ IsDuplicateGraph = true; // 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";
+ Function *SCCFn = Gr.retnodes_begin()->first;
+ if (&*I == SCCFn) {
+ O << "Skipped Writing '" << Prefix+I->getName() << ".dot'... ["
+ << Gr.getGraphSize() << "+" << NumCalls << "]\n";
+ } else {
+ IsDuplicateGraph = true; // Don't double count node/call nodes.
+ }
}
- unsigned GraphSize = Gr.getGraphSize();
- if (MaxGraphSize < GraphSize) MaxGraphSize = GraphSize;
+ if (!IsDuplicateGraph) {
+ unsigned GraphSize = Gr.getGraphSize();
+ if (MaxGraphSize < GraphSize) MaxGraphSize = GraphSize;
- for (DSGraph::node_iterator NI = Gr.node_begin(), E = Gr.node_end();
- NI != E; ++NI)
- if (NI->isNodeCompletelyFolded())
- ++NumFoldedNodes;
+ TotalNumNodes += Gr.getGraphSize();
+ TotalCallNodes += NumCalls;
+ for (DSGraph::node_iterator NI = Gr.node_begin(), E = Gr.node_end();
+ NI != E; ++NI)
+ if (NI->isNodeCompletelyFolded())
+ ++NumFoldedNodes;
+ }
}
DSGraph &GG = C.getGlobalsGraph();
OpenPOWER on IntegriCloud