[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Mar 15 09:52:32 PST 2005



Changes in directory llvm/lib/Analysis/DataStructure:

DataStructure.cpp updated: 1.204 -> 1.205
---
Log message:

Make computeGGToGMapping compute an invnodemap


---
Diffs of the changes:  (+11 -9)

 DataStructure.cpp |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)


Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.204 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.205
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.204	Tue Mar 15 10:55:04 2005
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp	Tue Mar 15 11:52:18 2005
@@ -2087,8 +2087,7 @@
 
 
 /// computeGToGGMapping - Compute the mapping of nodes in the global graph to
-/// nodes in this graph.  Note that any uses of this method are probably bugs,
-/// unless it is known that the globals graph has been merged into this graph!
+/// nodes in this graph.
 void DSGraph::computeGToGGMapping(NodeMapTy &NodeMap) {
   DSGraph &GG = *getGlobalsGraph();
 
@@ -2099,13 +2098,16 @@
 }
                                 
 /// computeGGToGMapping - Compute the mapping of nodes in the global graph to
-/// nodes in this graph.
-void DSGraph::computeGGToGMapping(NodeMapTy &NodeMap) {
-  DSGraph &GG = *getGlobalsGraph();
+/// nodes in this graph.  Note that any uses of this method are probably bugs,
+/// unless it is known that the globals graph has been merged into this graph!
+void DSGraph::computeGGToGMapping(InvNodeMapTy &InvNodeMap) {
+  NodeMapTy NodeMap;
+  computeGToGGMapping(NodeMap);
 
-  DSScalarMap &SM = getScalarMap();
-  for (DSScalarMap::global_iterator I = SM.global_begin(),
-         E = SM.global_end(); I != E; ++I)
-    DSGraph::computeNodeMapping(GG.getNodeForValue(*I), SM[*I], NodeMap);
+  while (!NodeMap.empty()) {
+    InvNodeMap.insert(std::make_pair(NodeMap.begin()->second,
+                                     NodeMap.begin()->first));
+    NodeMap.erase(NodeMap.begin());
+  }
 }
                                 






More information about the llvm-commits mailing list