[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp GraphChecker.cpp Printer.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sat Feb 7 17:59:46 PST 2004
Changes in directory llvm/lib/Analysis/DataStructure:
DataStructure.cpp updated: 1.149 -> 1.150
GraphChecker.cpp updated: 1.10 -> 1.11
Printer.cpp updated: 1.63 -> 1.64
---
Log message:
getNodes() is gone, use node_begin/end instead
Rename stats from dsnode -> dsa
Add a new stat
---
Diffs of the changes: (+18 -15)
Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.149 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.150
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.149 Sat Feb 7 16:00:03 2004
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Feb 7 17:58:05 2004
@@ -26,9 +26,10 @@
using namespace llvm;
namespace {
- Statistic<> NumFolds ("dsnode", "Number of nodes completely folded");
- Statistic<> NumCallNodesMerged("dsnode", "Number of call nodes merged");
- Statistic<> NumNodeAllocated ("dsnode", "Number of nodes allocated");
+ Statistic<> NumFolds ("dsa", "Number of nodes completely folded");
+ Statistic<> NumCallNodesMerged("dsa", "Number of call nodes merged");
+ Statistic<> NumNodeAllocated ("dsa", "Number of nodes allocated");
+ Statistic<> NumDNE ("dsa", "Number of nodes removed by reachability");
cl::opt<bool>
EnableDSNodeGlobalRootsHack("enable-dsa-globalrootshack", cl::Hidden,
@@ -73,7 +74,7 @@
: NumReferrers(0), Size(0), ParentGraph(G), Ty(Type::VoidTy), NodeType(0) {
// Add the type entry if it is specified...
if (T) mergeTypeInfo(T, 0);
- G->getNodes().push_back(this);
+ G->addNode(this);
++NumNodeAllocated;
}
@@ -85,7 +86,7 @@
Links = N.Links;
else
Links.resize(N.Links.size()); // Create the appropriate number of null links
- G->getNodes().push_back(this);
+ G->addNode(this);
++NumNodeAllocated;
}
@@ -1757,6 +1758,7 @@
DeadNodes.reserve(Nodes.size());
for (unsigned i = 0; i != Nodes.size(); ++i)
if (!Alive.count(Nodes[i])) {
+ ++NumDNE;
DSNode *N = Nodes[i];
Nodes[i--] = Nodes.back(); // move node to end of vector
Nodes.pop_back(); // Erase node from alive list.
Index: llvm/lib/Analysis/DataStructure/GraphChecker.cpp
diff -u llvm/lib/Analysis/DataStructure/GraphChecker.cpp:1.10 llvm/lib/Analysis/DataStructure/GraphChecker.cpp:1.11
--- llvm/lib/Analysis/DataStructure/GraphChecker.cpp:1.10 Wed Nov 12 17:11:14 2003
+++ llvm/lib/Analysis/DataStructure/GraphChecker.cpp Sat Feb 7 17:58:05 2004
@@ -114,11 +114,10 @@
void DSGC::verify(const DSGraph &G) {
// Loop over all of the nodes, checking to see if any are collapsed...
if (AbortIfAnyCollapsed) {
- const std::vector<DSNode*> &Nodes = G.getNodes();
- for (unsigned i = 0, e = Nodes.size(); i != e; ++i)
- if (Nodes[i]->isNodeCompletelyFolded()) {
+ for (DSGraph::node_iterator I = G.node_begin(), E = G.node_end(); I!=E; ++I)
+ if ((*I)->isNodeCompletelyFolded()) {
std::cerr << "Node is collapsed: ";
- Nodes[i]->print(std::cerr, &G);
+ (*I)->print(std::cerr, &G);
abort();
}
}
Index: llvm/lib/Analysis/DataStructure/Printer.cpp
diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.63 llvm/lib/Analysis/DataStructure/Printer.cpp:1.64
--- llvm/lib/Analysis/DataStructure/Printer.cpp:1.63 Thu Jan 22 07:42:43 2004
+++ llvm/lib/Analysis/DataStructure/Printer.cpp Sat Feb 7 17:58:05 2004
@@ -30,8 +30,8 @@
namespace {
cl::opt<bool> OnlyPrintMain("only-print-main-ds", cl::ReallyHidden);
cl::opt<bool> DontPrintAnything("dont-print-ds", cl::ReallyHidden);
- Statistic<> MaxGraphSize ("dsnode", "Maximum graph size");
- Statistic<> NumFoldedNodes ("dsnode", "Number of folded nodes (in final graph)");
+ Statistic<> MaxGraphSize ("dsa", "Maximum graph size");
+ Statistic<> NumFoldedNodes ("dsa", "Number of folded nodes (in final graph)");
}
void DSNode::dump() const { print(std::cerr, 0); }
@@ -249,10 +249,12 @@
<< 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())
+ unsigned GraphSize = std::distance(Gr.node_begin(), Gr.node_end());
+ if (MaxGraphSize < GraphSize) MaxGraphSize = GraphSize;
+
+ for (DSGraph::node_iterator NI = Gr.node_begin(), E = Gr.node_end();
+ NI != E; ++NI)
+ if ((*NI)->isNodeCompletelyFolded())
++NumFoldedNodes;
}
More information about the llvm-commits
mailing list