diff options
author | Chris Lattner <sabre@nondot.org> | 2005-03-15 17:52:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-03-15 17:52:18 +0000 |
commit | 36a13cdeeade48e80bdfe8e9d9962ba0c5e33b5a (patch) | |
tree | 91834e7bbbc8828c8f19a1233066940d2714d796 /lib/Analysis/DataStructure/DataStructure.cpp | |
parent | a9fec4ed81361102e02078a2bc67953bb338dec2 (diff) |
Make computeGGToGMapping compute an invnodemap
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20622 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/DataStructure.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp index aa96276324..21e18a6b74 100644 --- a/lib/Analysis/DataStructure/DataStructure.cpp +++ b/lib/Analysis/DataStructure/DataStructure.cpp @@ -2087,8 +2087,7 @@ void DSGraph::computeNodeMapping(const DSNodeHandle &NH1, /// 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 @@ void DSGraph::computeGToGGMapping(NodeMapTy &NodeMap) { } /// 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()); + } } |