Make computeGGToGMapping compute an invnodemap

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20622 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2005-03-15 17:52:18 +00:00
parent a9fec4ed81
commit 36a13cdeea

View File

@@ -2087,8 +2087,7 @@ void DSGraph::computeNodeMapping(const DSNodeHandle &NH1,
/// computeGToGGMapping - Compute the mapping of nodes in the global graph to /// 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, /// nodes in this graph.
/// unless it is known that the globals graph has been merged into this graph!
void DSGraph::computeGToGGMapping(NodeMapTy &NodeMap) { void DSGraph::computeGToGGMapping(NodeMapTy &NodeMap) {
DSGraph &GG = *getGlobalsGraph(); DSGraph &GG = *getGlobalsGraph();
@@ -2099,13 +2098,16 @@ void DSGraph::computeGToGGMapping(NodeMapTy &NodeMap) {
} }
/// computeGGToGMapping - Compute the mapping of nodes in the global graph to /// computeGGToGMapping - Compute the mapping of nodes in the global graph to
/// nodes in this graph. /// nodes in this graph. Note that any uses of this method are probably bugs,
void DSGraph::computeGGToGMapping(NodeMapTy &NodeMap) { /// unless it is known that the globals graph has been merged into this graph!
DSGraph &GG = *getGlobalsGraph(); void DSGraph::computeGGToGMapping(InvNodeMapTy &InvNodeMap) {
NodeMapTy NodeMap;
computeGToGGMapping(NodeMap);
DSScalarMap &SM = getScalarMap(); while (!NodeMap.empty()) {
for (DSScalarMap::global_iterator I = SM.global_begin(), InvNodeMap.insert(std::make_pair(NodeMap.begin()->second,
E = SM.global_end(); I != E; ++I) NodeMap.begin()->first));
DSGraph::computeNodeMapping(GG.getNodeForValue(*I), SM[*I], NodeMap); NodeMap.erase(NodeMap.begin());
}
} }