Rearrange code

llvm-svn: 5527
This commit is contained in:
Chris Lattner 2003-02-10 18:16:36 +00:00
parent 5153d44a91
commit b96f2123ab
1 changed files with 13 additions and 11 deletions

View File

@ -103,6 +103,15 @@ void TDDataStructures::calculateGraph(Function &F) {
// Get the current functions graph... // Get the current functions graph...
DSGraph &Graph = getOrCreateDSGraph(F); DSGraph &Graph = getOrCreateDSGraph(F);
// Recompute the Incomplete markers and eliminate unreachable nodes.
Graph.maskIncompleteMarkers();
// FIXME: Need to check if all callers have been found, or rather if a
// funcpointer escapes!
unsigned Flags = F.hasInternalLinkage() ?
DSGraph::IgnoreFormalArgs : DSGraph::MarkFormalArgs;
Graph.markIncompleteNodes(Flags | DSGraph::IgnoreGlobals);
Graph.removeDeadNodes(DSGraph::RemoveUnreachableGlobals);
const std::vector<DSCallSite> &CallSites = Graph.getFunctionCalls(); const std::vector<DSCallSite> &CallSites = Graph.getFunctionCalls();
if (CallSites.empty()) { if (CallSites.empty()) {
DEBUG(std::cerr << " [TD] No callees for: " << F.getName() << "\n"); DEBUG(std::cerr << " [TD] No callees for: " << F.getName() << "\n");
@ -153,7 +162,8 @@ void TDDataStructures::calculateGraph(Function &F) {
hash_map<const DSNode*, DSNodeHandle> OldNodeMap; hash_map<const DSNode*, DSNodeHandle> OldNodeMap;
CG.cloneInto(Graph, OldValMap, OldNodeMap, CG.cloneInto(Graph, OldValMap, OldNodeMap,
DSGraph::StripModRefBits | DSGraph::StripModRefBits |
DSGraph::KeepAllocaBit | DSGraph::DontCloneCallNodes); DSGraph::KeepAllocaBit | DSGraph::DontCloneCallNodes |
DSGraph::DontCloneAuxCallNodes);
OldValMap.clear(); // We don't care about the ValMap OldValMap.clear(); // We don't care about the ValMap
// Loop over all of the invocation sites of the callee, resolving // Loop over all of the invocation sites of the callee, resolving
@ -194,8 +204,9 @@ void TDDataStructures::calculateGraph(Function &F) {
OldNodeMap.clear(); OldNodeMap.clear();
// Recompute the Incomplete markers and eliminate unreachable nodes. // Recompute the Incomplete markers and eliminate unreachable nodes.
CG.removeTriviallyDeadNodes();
CG.maskIncompleteMarkers(); CG.maskIncompleteMarkers();
CG.markIncompleteNodes(DSGraph::MarkFormalArgs); CG.markIncompleteNodes(DSGraph::MarkFormalArgs |DSGraph::IgnoreGlobals);
CG.removeDeadNodes(DSGraph::RemoveUnreachableGlobals); CG.removeDeadNodes(DSGraph::RemoveUnreachableGlobals);
} }
@ -212,14 +223,5 @@ void TDDataStructures::calculateGraph(Function &F) {
calculateGraph(*I->first); calculateGraph(*I->first);
} }
} }
// Recompute the Incomplete markers and eliminate unreachable nodes.
Graph.maskIncompleteMarkers();
// FIXME: Need to check if all callers have been found, or rather if a
// funcpointer escapes!
unsigned Flags = F.hasInternalLinkage() ?
DSGraph::IgnoreFormalArgs : DSGraph::MarkFormalArgs;
Graph.markIncompleteNodes(Flags | DSGraph::IgnoreGlobals);
Graph.removeDeadNodes(DSGraph::RemoveUnreachableGlobals);
} }