getNodes() is gone

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11166 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2004-02-07 23:57:26 +00:00
parent e187d56520
commit a84c681637
2 changed files with 42 additions and 42 deletions

View File

@@ -63,8 +63,10 @@ FunctionModRefInfo::FunctionModRefInfo(const Function& func,
funcTDGraph(tdgClone), funcTDGraph(tdgClone),
funcModRefInfo(tdgClone->getGraphSize()) funcModRefInfo(tdgClone->getGraphSize())
{ {
for (unsigned i=0, N = funcTDGraph->getGraphSize(); i < N; ++i) unsigned i = 0;
NodeIds[funcTDGraph->getNodes()[i]] = i; for (DSGraph::node_iterator NI = funcTDGraph->node_begin(),
E = funcTDGraph->node_end(); NI != E; ++NI)
NodeIds[*NI] = i++;
} }
@@ -95,13 +97,12 @@ void FunctionModRefInfo::computeModRef(const Function &func)
{ {
// Mark all nodes in the graph that are marked MOD as being mod // Mark all nodes in the graph that are marked MOD as being mod
// and all those marked REF as being ref. // and all those marked REF as being ref.
for (unsigned i = 0, N = funcTDGraph->getGraphSize(); i < N; ++i) unsigned i = 0;
{ for (DSGraph::node_iterator NI = funcTDGraph->node_begin(),
if (funcTDGraph->getNodes()[i]->isModified()) E = funcTDGraph->node_end(); NI != E; ++NI, ++i) {
funcModRefInfo.setNodeIsMod(i); if ((*NI)->isModified()) funcModRefInfo.setNodeIsMod(i);
if (funcTDGraph->getNodes()[i]->isRead()) if ((*NI)->isRead()) funcModRefInfo.setNodeIsRef(i);
funcModRefInfo.setNodeIsRef(i); }
}
// Compute the Mod/Ref info for all call sites within the function. // Compute the Mod/Ref info for all call sites within the function.
// The call sites are recorded in the TD graph. // The call sites are recorded in the TD graph.
@@ -214,18 +215,15 @@ FunctionModRefInfo::computeModRef(CallSite CS)
} }
// For all nodes in the graph, extract the mod/ref information // For all nodes in the graph, extract the mod/ref information
const std::vector<DSNode*>& csgNodes = csgp->getNodes(); for (DSGraph::node_iterator NI = funcTDGraph->node_begin(),
const std::vector<DSNode*>& origNodes = funcTDGraph->getNodes(); E = funcTDGraph->node_end(); NI != E; ++NI) {
assert(csgNodes.size() == origNodes.size()); DSNode* csgNode = NodeMap[*NI].getNode();
for (unsigned i=0, N = origNodes.size(); i < N; ++i) assert(csgNode && "Inlined and original graphs do not correspond!");
{ if (csgNode->isModified())
DSNode* csgNode = NodeMap[origNodes[i]].getNode(); callModRefInfo->setNodeIsMod(getNodeId(*NI));
assert(csgNode && "Inlined and original graphs do not correspond!"); if (csgNode->isRead())
if (csgNode->isModified()) callModRefInfo->setNodeIsRef(getNodeId(*NI));
callModRefInfo->setNodeIsMod(getNodeId(origNodes[i])); }
if (csgNode->isRead())
callModRefInfo->setNodeIsRef(getNodeId(origNodes[i]));
}
// Drop nodemap before we delete the graph... // Drop nodemap before we delete the graph...
NodeMap.clear(); NodeMap.clear();
@@ -295,8 +293,10 @@ public:
O << std::string((j < NV-1)? "; " : "\n"); O << std::string((j < NV-1)? "; " : "\n");
} }
#if 0
else else
tdGraph.getNodes()[i]->print(O, /*graph*/ NULL); tdGraph.getNodes()[i]->print(O, /*graph*/ NULL);
#endif
} }
} }
}; };

View File

@@ -63,8 +63,10 @@ FunctionModRefInfo::FunctionModRefInfo(const Function& func,
funcTDGraph(tdgClone), funcTDGraph(tdgClone),
funcModRefInfo(tdgClone->getGraphSize()) funcModRefInfo(tdgClone->getGraphSize())
{ {
for (unsigned i=0, N = funcTDGraph->getGraphSize(); i < N; ++i) unsigned i = 0;
NodeIds[funcTDGraph->getNodes()[i]] = i; for (DSGraph::node_iterator NI = funcTDGraph->node_begin(),
E = funcTDGraph->node_end(); NI != E; ++NI)
NodeIds[*NI] = i++;
} }
@@ -95,13 +97,12 @@ void FunctionModRefInfo::computeModRef(const Function &func)
{ {
// Mark all nodes in the graph that are marked MOD as being mod // Mark all nodes in the graph that are marked MOD as being mod
// and all those marked REF as being ref. // and all those marked REF as being ref.
for (unsigned i = 0, N = funcTDGraph->getGraphSize(); i < N; ++i) unsigned i = 0;
{ for (DSGraph::node_iterator NI = funcTDGraph->node_begin(),
if (funcTDGraph->getNodes()[i]->isModified()) E = funcTDGraph->node_end(); NI != E; ++NI, ++i) {
funcModRefInfo.setNodeIsMod(i); if ((*NI)->isModified()) funcModRefInfo.setNodeIsMod(i);
if (funcTDGraph->getNodes()[i]->isRead()) if ((*NI)->isRead()) funcModRefInfo.setNodeIsRef(i);
funcModRefInfo.setNodeIsRef(i); }
}
// Compute the Mod/Ref info for all call sites within the function. // Compute the Mod/Ref info for all call sites within the function.
// The call sites are recorded in the TD graph. // The call sites are recorded in the TD graph.
@@ -214,18 +215,15 @@ FunctionModRefInfo::computeModRef(CallSite CS)
} }
// For all nodes in the graph, extract the mod/ref information // For all nodes in the graph, extract the mod/ref information
const std::vector<DSNode*>& csgNodes = csgp->getNodes(); for (DSGraph::node_iterator NI = funcTDGraph->node_begin(),
const std::vector<DSNode*>& origNodes = funcTDGraph->getNodes(); E = funcTDGraph->node_end(); NI != E; ++NI) {
assert(csgNodes.size() == origNodes.size()); DSNode* csgNode = NodeMap[*NI].getNode();
for (unsigned i=0, N = origNodes.size(); i < N; ++i) assert(csgNode && "Inlined and original graphs do not correspond!");
{ if (csgNode->isModified())
DSNode* csgNode = NodeMap[origNodes[i]].getNode(); callModRefInfo->setNodeIsMod(getNodeId(*NI));
assert(csgNode && "Inlined and original graphs do not correspond!"); if (csgNode->isRead())
if (csgNode->isModified()) callModRefInfo->setNodeIsRef(getNodeId(*NI));
callModRefInfo->setNodeIsMod(getNodeId(origNodes[i])); }
if (csgNode->isRead())
callModRefInfo->setNodeIsRef(getNodeId(origNodes[i]));
}
// Drop nodemap before we delete the graph... // Drop nodemap before we delete the graph...
NodeMap.clear(); NodeMap.clear();
@@ -295,8 +293,10 @@ public:
O << std::string((j < NV-1)? "; " : "\n"); O << std::string((j < NV-1)? "; " : "\n");
} }
#if 0
else else
tdGraph.getNodes()[i]->print(O, /*graph*/ NULL); tdGraph.getNodes()[i]->print(O, /*graph*/ NULL);
#endif
} }
} }
}; };