[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp CompleteBottomUp.cpp DataStructure.cpp EquivClassGraphs.cpp Printer.cpp TopDownClosure.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Mar 15 08:55:17 PST 2005
Changes in directory llvm/lib/Analysis/DataStructure:
BottomUpClosure.cpp updated: 1.95 -> 1.96
CompleteBottomUp.cpp updated: 1.19 -> 1.20
DataStructure.cpp updated: 1.203 -> 1.204
EquivClassGraphs.cpp updated: 1.28 -> 1.29
Printer.cpp updated: 1.76 -> 1.77
TopDownClosure.cpp updated: 1.74 -> 1.75
---
Log message:
Start using retnodes_* for iteration.
---
Diffs of the changes: (+34 -39)
BottomUpClosure.cpp | 6 +++---
CompleteBottomUp.cpp | 8 ++++----
DataStructure.cpp | 14 +++++++-------
EquivClassGraphs.cpp | 21 +++++++++------------
Printer.cpp | 17 ++++++++---------
TopDownClosure.cpp | 7 +++----
6 files changed, 34 insertions(+), 39 deletions(-)
Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp
diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.95 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.96
--- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.95 Sun Mar 13 14:32:26 2005
+++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Tue Mar 15 10:55:04 2005
@@ -228,8 +228,8 @@
SCCGraph->getReturnNodes(), NodeMap);
}
// Update the DSInfo map and delete the old graph...
- for (DSGraph::ReturnNodesTy::iterator I = G.getReturnNodes().begin(),
- E = G.getReturnNodes().end(); I != E; ++I)
+ for (DSGraph::retnodes_iterator I = G.retnodes_begin(),
+ E = G.retnodes_end(); I != E; ++I)
DSInfo[I->first] = SCCGraph;
delete &G;
}
@@ -496,7 +496,7 @@
assert(NG->getReturnNodes().size() == 1 && "Cannot copy SCC's yet!");
// Change the Function* is the returnnodes map to the ToF.
- DSNodeHandle Ret = NG->getReturnNodes().begin()->second;
+ DSNodeHandle Ret = NG->retnodes_begin()->second;
NG->getReturnNodes().clear();
NG->getReturnNodes()[ToF] = Ret;
return;
Index: llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp
diff -u llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.19 llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.20
--- llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.19 Sun Mar 13 14:32:26 2005
+++ llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp Tue Mar 15 10:55:04 2005
@@ -127,8 +127,8 @@
// Make sure to update the DSInfo map for all of the functions currently in
// this graph!
- for (DSGraph::ReturnNodesTy::iterator I = Graph->getReturnNodes().begin();
- I != Graph->getReturnNodes().end(); ++I)
+ for (DSGraph::retnodes_iterator I = Graph->retnodes_begin();
+ I != Graph->retnodes_end(); ++I)
DSInfo[I->first] = Graph;
return *Graph;
@@ -180,8 +180,8 @@
FG.cloneInto(*NG, FG.getScalarMap(), FG.getReturnNodes(), NodeMap);
// Update the DSInfo map and delete the old graph...
- for (DSGraph::ReturnNodesTy::iterator I = NG->getReturnNodes().begin();
- I != NG->getReturnNodes().end(); ++I)
+ for (DSGraph::retnodes_iterator I = NG->retnodes_begin();
+ I != NG->retnodes_end(); ++I)
DSInfo[I->first] = &FG;
// Remove NG from the ValMap since the pointer may get recycled.
Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.203 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.204
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.203 Mon Mar 14 22:54:18 2005
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Tue Mar 15 10:55:04 2005
@@ -547,8 +547,8 @@
}
Module *M = 0;
- if (getParentGraph()->getReturnNodes().size())
- M = getParentGraph()->getReturnNodes().begin()->first->getParent();
+ if (getParentGraph()->retnodes_begin() != getParentGraph()->retnodes_end())
+ M = getParentGraph()->retnodes_begin()->first->getParent();
DEBUG(std::cerr << "MergeTypeInfo Folding OrigTy: ";
WriteTypeSymbolic(std::cerr, Ty, M) << "\n due to:";
WriteTypeSymbolic(std::cerr, NewTy, M) << " @ " << Offset << "!\n"
@@ -1058,11 +1058,11 @@
std::string DSGraph::getFunctionNames() const {
switch (getReturnNodes().size()) {
case 0: return "Globals graph";
- case 1: return getReturnNodes().begin()->first->getName();
+ case 1: return retnodes_begin()->first->getName();
default:
std::string Return;
- for (DSGraph::ReturnNodesTy::const_iterator I = getReturnNodes().begin();
- I != getReturnNodes().end(); ++I)
+ for (DSGraph::retnodes_iterator I = retnodes_begin();
+ I != retnodes_end(); ++I)
Return += I->first->getName() + " ";
Return.erase(Return.end()-1, Return.end()); // Remove last space character
return Return;
@@ -1233,8 +1233,8 @@
}
// Map the return node pointers over...
- for (ReturnNodesTy::const_iterator I = G.getReturnNodes().begin(),
- E = G.getReturnNodes().end(); I != E; ++I) {
+ for (retnodes_iterator I = G.retnodes_begin(),
+ E = G.retnodes_end(); I != E; ++I) {
const DSNodeHandle &Ret = I->second;
DSNodeHandle &MappedRet = OldNodeMap[Ret.getNode()];
DSNode *MappedRetN = MappedRet.getNode();
Index: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp
diff -u llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.28 llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.29
--- llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.28 Tue Mar 15 00:29:12 2005
+++ llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp Tue Mar 15 10:55:04 2005
@@ -45,7 +45,7 @@
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
if (!I->isExternal()) {
DSGraph &G = ECGraphs.getDSGraph(*I);
- if (G.getReturnNodes().begin()->first != I)
+ if (G.retnodes_begin()->first != I)
continue; // Only check a graph once.
DSGraph::NodeMapTy GlobalsGraphNodeMapping;
@@ -181,9 +181,8 @@
// Currently, that is just the functions in the same call-graph-SCC as F.
//
DSGraph& funcDSGraph = CBU->getDSGraph(*I->second);
- const DSGraph::ReturnNodesTy &RetNodes = funcDSGraph.getReturnNodes();
- for (DSGraph::ReturnNodesTy::const_iterator RI=RetNodes.begin(),
- RE=RetNodes.end(); RI != RE; ++RI)
+ for (DSGraph::retnodes_iterator RI = funcDSGraph.retnodes_begin(),
+ RE = funcDSGraph.retnodes_end(); RI != RE; ++RI)
FuncECs.unionSetsWith(FirstFunc, RI->first);
}
@@ -235,10 +234,8 @@
continue;
// Record the "folded" graph for the function.
- for (DSGraph::ReturnNodesTy::iterator
- I = CBUGraph.getReturnNodes().begin(),
- E = CBUGraph.getReturnNodes().end();
- I != E; ++I) {
+ for (DSGraph::retnodes_iterator I = CBUGraph.retnodes_begin(),
+ E = CBUGraph.retnodes_end(); I != E; ++I) {
assert(DSInfo[I->first] == 0 && "Graph already exists for Fn!");
DSInfo[I->first] = &MergedG;
}
@@ -284,8 +281,8 @@
Graph->setPrintAuxCalls();
// Make sure to update the DSInfo map for all functions in the graph!
- for (DSGraph::ReturnNodesTy::iterator I = Graph->getReturnNodes().begin();
- I != Graph->getReturnNodes().end(); ++I)
+ for (DSGraph::retnodes_iterator I = Graph->retnodes_begin();
+ I != Graph->retnodes_end(); ++I)
if (I->first != &F) {
DSGraph *&FG = DSInfo[I->first];
assert(FG == 0 && "Merging function in SCC twice?");
@@ -342,8 +339,8 @@
FG.cloneInto(*NG, FG.getScalarMap(), FG.getReturnNodes(), NodeMap);
// Update the DSInfo map and delete the old graph...
- for (DSGraph::ReturnNodesTy::iterator I = NG->getReturnNodes().begin();
- I != NG->getReturnNodes().end(); ++I)
+ for (DSGraph::retnodes_iterator I = NG->retnodes_begin();
+ I != NG->retnodes_end(); ++I)
DSInfo[I->first] = &FG;
// Remove NG from the ValMap since the pointer may get recycled.
Index: llvm/lib/Analysis/DataStructure/Printer.cpp
diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.76 llvm/lib/Analysis/DataStructure/Printer.cpp:1.77
--- llvm/lib/Analysis/DataStructure/Printer.cpp:1.76 Sun Mar 13 13:51:24 2005
+++ llvm/lib/Analysis/DataStructure/Printer.cpp Tue Mar 15 10:55:04 2005
@@ -44,8 +44,8 @@
if (!G) G = N->getParentGraph();
// Get the module from ONE of the functions in the graph it is available.
- if (G && !G->getReturnNodes().empty())
- M = G->getReturnNodes().begin()->first->getParent();
+ if (G && G->retnodes_begin() != G->retnodes_end())
+ M = G->retnodes_begin()->first->getParent();
if (M == 0 && G) {
// If there is a global in the graph, we can use it to find the module.
const DSScalarMap &SM = G->getScalarMap();
@@ -126,8 +126,8 @@
static void addCustomGraphFeatures(const DSGraph *G,
GraphWriter<const DSGraph*> &GW) {
Module *CurMod = 0;
- if (!G->getReturnNodes().empty())
- CurMod = G->getReturnNodes().begin()->first->getParent();
+ if (G->retnodes_begin() != G->retnodes_end())
+ CurMod = G->retnodes_begin()->first->getParent();
else {
// If there is a global in the graph, we can use it to find the module.
const DSScalarMap &SM = G->getScalarMap();
@@ -154,12 +154,11 @@
// Output the returned value pointer...
- const DSGraph::ReturnNodesTy &RetNodes = G->getReturnNodes();
- for (DSGraph::ReturnNodesTy::const_iterator I = RetNodes.begin(),
- E = RetNodes.end(); I != E; ++I)
+ for (DSGraph::retnodes_iterator I = G->retnodes_begin(),
+ E = G->retnodes_end(); I != E; ++I)
if (I->second.getNode()) {
std::string Label;
- if (RetNodes.size() == 1)
+ if (G->getReturnNodes().size() == 1)
Label = "returning";
else
Label = I->first->getName() + " ret node";
@@ -276,7 +275,7 @@
TotalCallNodes += NumCalls;
if (I->getName() == "main" || !OnlyPrintMain) {
- Function *SCCFn = Gr.getReturnNodes().begin()->first;
+ Function *SCCFn = Gr.retnodes_begin()->first;
if (&*I == SCCFn)
Gr.writeGraphToFile(O, Prefix+I->getName());
else
Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp
diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.74 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.75
--- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.74 Fri Feb 4 12:58:04 2005
+++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Tue Mar 15 10:55:04 2005
@@ -179,9 +179,8 @@
// If any of the functions has incomplete incoming arguments, don't mark any
// of them as complete.
bool HasIncompleteArgs = false;
- const DSGraph::ReturnNodesTy &GraphReturnNodes = Graph.getReturnNodes();
- for (DSGraph::ReturnNodesTy::const_iterator I = GraphReturnNodes.begin(),
- E = GraphReturnNodes.end(); I != E; ++I)
+ for (DSGraph::retnodes_iterator I = Graph.retnodes_begin(),
+ E = Graph.retnodes_end(); I != E; ++I)
if (ArgsRemainIncomplete.count(I->first)) {
HasIncompleteArgs = true;
break;
@@ -330,7 +329,7 @@
assert(NG->getReturnNodes().size() == 1 && "Cannot copy SCC's yet!");
// Change the Function* is the returnnodes map to the ToF.
- DSNodeHandle Ret = NG->getReturnNodes().begin()->second;
+ DSNodeHandle Ret = NG->retnodes_begin()->second;
NG->getReturnNodes().clear();
NG->getReturnNodes()[ToF] = Ret;
return;
More information about the llvm-commits
mailing list