[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Nov 18 15:43:02 PST 2002
Changes in directory llvm/lib/Analysis/DataStructure:
Printer.cpp updated: 1.41 -> 1.42
---
Log message:
Add stats
---
Diffs of the changes:
Index: llvm/lib/Analysis/DataStructure/Printer.cpp
diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.41 llvm/lib/Analysis/DataStructure/Printer.cpp:1.42
--- llvm/lib/Analysis/DataStructure/Printer.cpp:1.41 Sun Nov 10 18:01:02 2002
+++ llvm/lib/Analysis/DataStructure/Printer.cpp Mon Nov 18 15:42:45 2002
@@ -11,6 +11,7 @@
#include "llvm/Assembly/Writer.h"
#include "Support/CommandLine.h"
#include "Support/GraphWriter.h"
+#include "Support/Statistic.h"
#include <fstream>
#include <sstream>
using std::string;
@@ -18,7 +19,11 @@
// OnlyPrintMain - The DataStructure printer exposes this option to allow
// printing of only the graph for "main".
//
-static cl::opt<bool> OnlyPrintMain("only-print-main-ds", cl::ReallyHidden);
+namespace {
+ cl::opt<bool> OnlyPrintMain("only-print-main-ds", cl::ReallyHidden);
+ Statistic<> MaxGraphSize ("dsnode", "Maximum graph size");
+ Statistic<> NumFoldedNodes ("dsnode", "Number of folded nodes (in final graph)");
+}
void DSNode::dump() const { print(std::cerr, 0); }
@@ -30,8 +35,8 @@
if (N->isNodeCompletelyFolded())
OS << "FOLDED";
else {
- WriteTypeSymbolic(OS, N->getType().Ty, M);
- if (N->getType().isArray)
+ WriteTypeSymbolic(OS, N->getType(), M);
+ if (N->isArray())
OS << " array";
}
if (N->NodeType) {
@@ -89,7 +94,7 @@
if (!isa<GlobalValue>(I->first)) {
std::stringstream OS;
WriteAsOperand(OS, I->first, false, true, G->getFunction().getParent());
- GW.emitSimpleNode(I->first, "plaintext=circle", OS.str());
+ GW.emitSimpleNode(I->first, "", OS.str());
// Add edge from return node to real destination
int EdgeDest = I->second.getOffset() >> DS::PointerShift;
@@ -186,6 +191,12 @@
O << "Skipped Writing '" << Prefix+I->getName() << ".dot'... ["
<< Gr.getGraphSize() << "+" << NumCalls << "]\n";
}
+
+ if (MaxGraphSize < Gr.getNodes().size())
+ MaxGraphSize = Gr.getNodes().size();
+ for (unsigned i = 0, e = Gr.getNodes().size(); i != e; ++i)
+ if (Gr.getNodes()[i]->isNodeCompletelyFolded())
+ ++NumFoldedNodes;
}
DSGraph &GG = C.getGlobalsGraph();
More information about the llvm-commits
mailing list