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/TopDownClosure.cpp b/lib/Analysis/DataStructure/TopDownClosure.cpp
index 30634e7..1ceaedb 100644
--- a/lib/Analysis/DataStructure/TopDownClosure.cpp
+++ b/lib/Analysis/DataStructure/TopDownClosure.cpp
@@ -48,24 +48,24 @@
 /// local to the specified graph.
 ///
 void TDDataStructures::ResolveCallSite(DSGraph &Graph,
-                                   const BUDataStructures::CallSite &CallSite) {
+                                       const DSCallSite &CallSite) {
   // Resolve all of the function formal arguments...
   Function &F = Graph.getFunction();
   Function::aiterator AI = F.abegin();
 
-  for (unsigned i = 2, e = CallSite.Context.size(); i != e; ++i, ++AI) {
+  for (unsigned i = 2, e = CallSite.size(); i != e; ++i, ++AI) {
     // Advance the argument iterator to the first pointer argument...
     while (!DataStructureAnalysis::isPointerType(AI->getType())) ++AI;
     
     // TD ...Merge the formal arg scalar with the actual arg node
     DSNodeHandle &NodeForFormal = Graph.getNodeForValue(AI);
     if (NodeForFormal.getNode())
-      NodeForFormal.mergeWith(CallSite.Context[i]);
+      NodeForFormal.mergeWith(CallSite[i]);
   }
   
   // Merge returned node in the caller with the "return" node in callee
-  if (CallSite.Context[0].getNode() && Graph.getRetNode().getNode())
-    Graph.getRetNode().mergeWith(CallSite.Context[0]);
+  if (CallSite.getReturnValueNode().getNode() && Graph.getRetNode().getNode())
+    Graph.getRetNode().mergeWith(CallSite.getReturnValueNode());
 }
 
 DSGraph &TDDataStructures::calculateGraph(Function &F) {
@@ -79,7 +79,7 @@
   DSGraph &BUGraph = BU.getDSGraph(F);
   Graph = new DSGraph(BUGraph);
 
-  const vector<BUDataStructures::CallSite> *CallSitesP = BU.getCallSites(F);
+  const vector<DSCallSite> *CallSitesP = BU.getCallSites(F);
   if (CallSitesP == 0) {
     DEBUG(std::cerr << "  [TD] No callers for: " << F.getName() << "\n");
     return *Graph;  // If no call sites, the graph is the same as the BU graph!
@@ -89,10 +89,10 @@
   // graph.
   //
   DEBUG(std::cerr << "  [TD] Inlining callers for: " << F.getName() << "\n");
-  const vector<BUDataStructures::CallSite> &CallSites = *CallSitesP;
+  const vector<DSCallSite> &CallSites = *CallSitesP;
   for (unsigned c = 0, ce = CallSites.size(); c != ce; ++c) {
-    const BUDataStructures::CallSite &CallSite = CallSites[c];  // Copy
-    Function &Caller = *CallSite.Caller;
+    const DSCallSite &CallSite = CallSites[c];  // Copy
+    Function &Caller = CallSite.getCaller();
     assert(!Caller.isExternal() && "Externals function cannot 'call'!");
     
     DEBUG(std::cerr << "\t [TD] Inlining caller #" << c << " '"
@@ -128,10 +128,10 @@
 
       // Make a temporary copy of the call site, and transform the argument node
       // pointers.
-      BUDataStructures::CallSite TmpCallSite = CallSite;
-      for (unsigned i = 0, e = CallSite.Context.size(); i != e; ++i) {
-        const DSNode *OldNode = TmpCallSite.Context[i].getNode();
-        TmpCallSite.Context[i].setNode(OldNodeMap[OldNode]);
+      DSCallSite TmpCallSite = CallSite;
+      for (unsigned i = 0, e = CallSite.size(); i != e; ++i) {
+        const DSNode *OldNode = TmpCallSite[i].getNode();
+        TmpCallSite[i].setNode(OldNodeMap[OldNode]);
       }
 
       ResolveCallSite(*Graph, CallSite);