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 | dd3fb83f32d767cacf15cd41cbad29114d90310b (patch) | |
| tree | 368ba7228cf2c511f139db0aac722e97f550d6d5 | |
| parent | 6cd5d1adb6eac48c75cb9620dd693082600274dc (diff) | |
| download | bcm5719-llvm-dd3fb83f32d767cacf15cd41cbad29114d90310b.tar.gz bcm5719-llvm-dd3fb83f32d767cacf15cd41cbad29114d90310b.zip | |
Make computeGGToGMapping compute an invnodemap
llvm-svn: 20622
| -rw-r--r-- | llvm/lib/Analysis/DataStructure/DataStructure.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/llvm/lib/Analysis/DataStructure/DataStructure.cpp b/llvm/lib/Analysis/DataStructure/DataStructure.cpp index aa962763247..21e18a6b74d 100644 --- a/llvm/lib/Analysis/DataStructure/DataStructure.cpp +++ b/llvm/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()); + } } |

