add a method to compute a commonly used mapping.

llvm-svn: 20588
This commit is contained in:
Chris Lattner 2005-03-14 19:22:47 +00:00
parent 40e2b71f7a
commit 1bdb8b7e7e
2 changed files with 16 additions and 5 deletions

View File

@ -2082,3 +2082,16 @@ void DSGraph::computeNodeMapping(const DSNodeHandle &NH1,
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);
}

View File

@ -45,13 +45,11 @@ static void CheckAllGraphs(Module *M, GT &ECGraphs) {
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