Added a first-class representation for each call site that can be
used in the DS graphs.  Essentially, what was vector<DSNodeHandle>
before is now a DSCallSite with the same vector, plus pointers to the
CallInst and the caller Function.  The special-purpose class
BUDataStructure::CallSite is no longer needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4228 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp
index acb90a2..e65a06c 100644
--- a/lib/Analysis/DataStructure/BottomUpClosure.cpp
+++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp
@@ -56,7 +56,7 @@
 // ResolveArguments - Resolve the formal and actual arguments for a function
 // call.
 //
-static void ResolveArguments(std::vector<DSNodeHandle> &Call, Function &F,
+static void ResolveArguments(DSCallSite &Call, Function &F,
                              map<Value*, DSNodeHandle> &ValueMap) {
   // Resolve all of the function arguments...
   Function::aiterator AI = F.abegin();
@@ -87,7 +87,7 @@
 #endif
 
   // Start resolving calls...
-  std::vector<std::vector<DSNodeHandle> > &FCs = Graph->getFunctionCalls();
+  std::vector<DSCallSite> &FCs = Graph->getFunctionCalls();
 
   DEBUG(std::cerr << "  [BU] Inlining: " << F.getName() << "\n");
 
@@ -97,14 +97,14 @@
 
     for (unsigned i = 0; i != FCs.size(); ++i) {
       // Copy the call, because inlining graphs may invalidate the FCs vector.
-      std::vector<DSNodeHandle> Call = FCs[i];
+      DSCallSite Call = FCs[i];
 
       // If the function list is complete...
-      if ((Call[1].getNode()->NodeType & DSNode::Incomplete) == 0) {
+      if ((Call.getCalleeNode().getNode()->NodeType & DSNode::Incomplete)==0) {
         // Start inlining all of the functions we can... some may not be
         // inlinable if they are external...
         //
-        std::vector<GlobalValue*> Callees(Call[1].getNode()->getGlobals());
+        std::vector<GlobalValue*> Callees(Call.getCalleeNode().getNode()->getGlobals());
 
         // Loop over the functions, inlining whatever we can...
         for (unsigned c = 0; c != Callees.size(); ++c) {
@@ -112,7 +112,8 @@
           Function &FI = cast<Function>(*Callees[c]);
 
           // Record that this is a call site of FI.
-          CallSites[&FI].push_back(CallSite(F, Call));
+          assert(&Call.getCaller() == &F && "Invalid caller in DSCallSite?");
+          CallSites[&FI].push_back(DSCallSite(Call));
 
           if (&FI == &F) {
             // Self recursion... simply link up the formal arguments with the
@@ -120,8 +121,8 @@
 
             DEBUG(std::cerr << "\t[BU] Self Inlining: " << F.getName() << "\n");
 
-            if (Call[0].getNode()) // Handle the return value if present...
-              Graph->getRetNode().mergeWith(Call[0]);
+            if (Call.getReturnValueNode().getNode()) // Handle the return value if present...
+              Graph->getRetNode().mergeWith(Call.getReturnValueNode());
 
             // Resolve the arguments in the call to the actual values...
             ResolveArguments(Call, F, Graph->getValueMap());
@@ -159,8 +160,8 @@
             // Resolve the arguments in the call to the actual values...
             ResolveArguments(Call, FI, OldValMap);
 
-            if (Call[0].getNode())  // Handle the return value if present
-              RetVal.mergeWith(Call[0]);
+            if (Call.getReturnValueNode().getNode())  // Handle the return value if present
+              RetVal.mergeWith(Call.getReturnValueNode());
 
             // Erase the entry in the Callees vector
             Callees.erase(Callees.begin()+c--);
@@ -178,7 +179,7 @@
           // Erase the call if it is resolvable...
           FCs.erase(FCs.begin()+i--);  // Don't skip a the next call...
           Inlined = true;
-        } else if (Callees.size() != Call[1].getNode()->getGlobals().size()) {
+        } else if (Callees.size() != Call.getCalleeNode().getNode()->getGlobals().size()) {
           // Was able to inline SOME, but not all of the functions.  Construct a
           // new global node here.
           //