add a method to compute a commonly used mapping.

llvm-svn: 20588
diff --git a/llvm/lib/Analysis/DataStructure/DataStructure.cpp b/llvm/lib/Analysis/DataStructure/DataStructure.cpp
index 212e118..1e47203 100644
--- a/llvm/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/llvm/lib/Analysis/DataStructure/DataStructure.cpp
@@ -2082,3 +2082,16 @@
       computeNodeMapping(N1->getLink(i),
                          N2->getLink(unsigned(N2Idx+i) % N2Size), NodeMap);
 }
+
+
+/// computeGlobalGraphMapping - Compute the mapping of nodes in the global
+/// graph to nodes in this graph.
+void DSGraph::computeGlobalGraphMapping(NodeMapTy &NodeMap) {
+  DSGraph &GG = *getGlobalsGraph();
+
+  DSScalarMap &SM = getScalarMap();
+  for (DSScalarMap::global_iterator I = SM.global_begin(),
+         E = SM.global_end(); I != E; ++I)
+    DSGraph::computeNodeMapping(SM[*I], GG.getNodeForValue(*I), NodeMap);
+}
+