Start using retnodes_* for iteration.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20618 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp
index 5fca3ad..6c26602 100644
--- a/lib/Analysis/DataStructure/BottomUpClosure.cpp
+++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp
@@ -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;
diff --git a/lib/Analysis/DataStructure/CompleteBottomUp.cpp b/lib/Analysis/DataStructure/CompleteBottomUp.cpp
index e38aebf..4dcfc35 100644
--- a/lib/Analysis/DataStructure/CompleteBottomUp.cpp
+++ b/lib/Analysis/DataStructure/CompleteBottomUp.cpp
@@ -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.
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp
index ac2abb3..aa96276 100644
--- a/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/lib/Analysis/DataStructure/DataStructure.cpp
@@ -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();
diff --git a/lib/Analysis/DataStructure/EquivClassGraphs.cpp b/lib/Analysis/DataStructure/EquivClassGraphs.cpp
index bc8f6a6..daefb67 100644
--- a/lib/Analysis/DataStructure/EquivClassGraphs.cpp
+++ b/lib/Analysis/DataStructure/EquivClassGraphs.cpp
@@ -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.
diff --git a/lib/Analysis/DataStructure/Printer.cpp b/lib/Analysis/DataStructure/Printer.cpp
index ee143f6..05fba21 100644
--- a/lib/Analysis/DataStructure/Printer.cpp
+++ b/lib/Analysis/DataStructure/Printer.cpp
@@ -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
diff --git a/lib/Analysis/DataStructure/TopDownClosure.cpp b/lib/Analysis/DataStructure/TopDownClosure.cpp
index bbce45b..580f228 100644
--- a/lib/Analysis/DataStructure/TopDownClosure.cpp
+++ b/lib/Analysis/DataStructure/TopDownClosure.cpp
@@ -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;