aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-04-01 22:20:48 +0000
committerChris Lattner <sabre@nondot.org>2002-04-01 22:20:48 +0000
commita13d6ceed799c5a342fb2d499b88b5fcb950970e (patch)
tree11ea0d5de996fe2bb4246e274f017e9a970ac729 /lib
parent85e1e9c22f6b8f9bac4924e0692ab199bd69ba89 (diff)
downloadexternal_llvm-a13d6ceed799c5a342fb2d499b88b5fcb950970e.zip
external_llvm-a13d6ceed799c5a342fb2d499b88b5fcb950970e.tar.gz
external_llvm-a13d6ceed799c5a342fb2d499b88b5fcb950970e.tar.bz2
Support resolving function arguments/return values to pointers that index
into other objects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2094 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/DataStructure/ComputeClosure.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/Analysis/DataStructure/ComputeClosure.cpp b/lib/Analysis/DataStructure/ComputeClosure.cpp
index 493b282..6466f0b 100644
--- a/lib/Analysis/DataStructure/ComputeClosure.cpp
+++ b/lib/Analysis/DataStructure/ComputeClosure.cpp
@@ -18,11 +18,21 @@
// Make all of the pointers that point to Val also point to N.
//
static void copyEdgesFromTo(PointerVal Val, DSNode *N) {
- assert(Val.Index == 0 && "copyEdgesFromTo:index != 0 TODO");
-
- const vector<PointerValSet*> &PVSToUpdate(Val.Node->getReferrers());
- for (unsigned i = 0, e = PVSToUpdate.size(); i != e; ++i)
- PVSToUpdate[i]->add(N); // TODO: support index
+ unsigned ValIdx = Val.Index;
+ unsigned NLinks = N->getNumLinks();
+
+ const vector<PointerValSet*> &PVSsToUpdate(Val.Node->getReferrers());
+ for (unsigned i = 0, e = PVSsToUpdate.size(); i != e; ++i) {
+ // Loop over all of the pointers pointing to Val...
+ PointerValSet &PVS = *PVSsToUpdate[i];
+ for (unsigned j = 0, je = PVS.size(); j != je; ++j) {
+ if (PVS[j].Node == Val.Node && PVS[j].Index >= ValIdx &&
+ PVS[j].Index < ValIdx+NLinks)
+ PVS.add(PointerVal(N, PVS[j].Index-ValIdx));
+
+ //PVS.add(PointerVal(N, Val.Index)); // TODO: support index
+ }
+ }
}
static void ResolveNodesTo(const PointerVal &FromPtr,