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);
+}
+
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
if (!I->isExternal()) {
DSGraph &G = ECGraphs.getDSGraph(*I);
+ if (G.getReturnNodes().begin()->first != I)
+ continue; // Only check a graph once.
DSGraph::NodeMapTy GlobalsGraphNodeMapping;
- for (DSScalarMap::global_iterator I = G.getScalarMap().global_begin(),
- E = G.getScalarMap().global_end(); I != E; ++I)
- DSGraph::computeNodeMapping(G.getNodeForValue(*I),
- GG.getNodeForValue(*I),
- GlobalsGraphNodeMapping);
+ G.computeGlobalGraphMapping(GlobalsGraphNodeMapping);
}
}
#endif