diff options
author | Chris Lattner <sabre@nondot.org> | 2002-04-16 20:39:59 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-04-16 20:39:59 +0000 |
commit | 7650b94c758f55066b43799ecfb50c729c2153af (patch) | |
tree | 29f836dd25a5cd09c714055a0e00ce1e8bb5256b /lib/Analysis/DataStructure/ComputeClosure.cpp | |
parent | 28c238636ea663419f35319bcedc445d08995e57 (diff) |
* Remove the concept of a critical shadow node
* Make the function pointer argument explicit for a call nodes
* Eliminate unreachable global values
* Merge call nodes that are identical
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2266 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/ComputeClosure.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/ComputeClosure.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/Analysis/DataStructure/ComputeClosure.cpp b/lib/Analysis/DataStructure/ComputeClosure.cpp index 30c21a3322..67309e8c77 100644 --- a/lib/Analysis/DataStructure/ComputeClosure.cpp +++ b/lib/Analysis/DataStructure/ComputeClosure.cpp @@ -100,6 +100,8 @@ void FunctionDSGraph::computeClosure(const DataStructure &DS) { NI = std::find_if(CallNodes.begin(), CallNodes.end(), isResolvableCallNode); while (NI != CallNodes.end()) { CallDSNode *CN = *NI; + // FIXME: This should work based on the pointer val set of the first arg + // link (which is the function to call) Function *F = CN->getCall()->getCalledFunction(); if (NumInlines++ == 100) { // CUTE hack huh? @@ -181,14 +183,14 @@ void FunctionDSGraph::computeClosure(const DataStructure &DS) { RetVals)); // If the call node has arguments, process them now! - assert(Args.size() == CN->getNumArgs() && + assert(Args.size() == CN->getNumArgs()-1 && "Call node doesn't match function?"); for (unsigned i = 0, e = Args.size(); i != e; ++i) { // Now we make all of the nodes inside of the incorporated method // point to the real arguments values, not to the shadow nodes for the // argument. - ResolveNodesTo(Args[i], CN->getArgValues(i)); + ResolveNodesTo(Args[i], CN->getArgValues(i+1)); } // Loop through the nodes, deleting alloca nodes in the inlined function. @@ -231,4 +233,18 @@ void FunctionDSGraph::computeClosure(const DataStructure &DS) { // Move on to the next call node... NI = std::find_if(CallNodes.begin(), CallNodes.end(), isResolvableCallNode); } + + // Drop references to globals... + CallMap.clear(); + + bool Changed = true; + while (Changed) { + // Eliminate shadow nodes that are not distinguishable from some other + // node in the graph... + // + Changed = UnlinkUndistinguishableNodes(); + + // Eliminate shadow nodes that are now extraneous due to linking... + Changed |= RemoveUnreachableNodes(); + } } |