[llvm-commits] [poolalloc] r78193 - in /poolalloc/trunk: include/rdsa/DSGraphTraits.h include/rdsa/DSNode.h include/rdsa/DSSupport.h include/rdsa/DataStructure.h lib/rDSA/Basic.cpp lib/rDSA/BottomUpClosure.cpp lib/rDSA/CallTargets.cpp lib/rDSA/CompleteBottomUp.cpp lib/rDSA/DataStructure.cpp lib/rDSA/DataStructureAA.cpp lib/rDSA/DataStructureStats.cpp lib/rDSA/EquivClassGraphs.cpp lib/rDSA/GraphChecker.cpp lib/rDSA/Local.cpp lib/rDSA/Printer.cpp lib/rDSA/StdLibPass.cpp lib/rDSA/Steensgaard.cpp lib/rDSA/TopDownClosure.cpp

Andrew Lenharth alenhar2 at cs.uiuc.edu
Wed Aug 5 08:06:45 PDT 2009


Author: alenhar2
Date: Wed Aug  5 10:06:44 2009
New Revision: 78193

URL: http://llvm.org/viewvc/llvm-project?rev=78193&view=rev
Log:
Allow union types by tracking pointers per byte offset and cleanup interfaces

Modified:
    poolalloc/trunk/include/rdsa/DSGraphTraits.h
    poolalloc/trunk/include/rdsa/DSNode.h
    poolalloc/trunk/include/rdsa/DSSupport.h
    poolalloc/trunk/include/rdsa/DataStructure.h
    poolalloc/trunk/lib/rDSA/Basic.cpp
    poolalloc/trunk/lib/rDSA/BottomUpClosure.cpp
    poolalloc/trunk/lib/rDSA/CallTargets.cpp
    poolalloc/trunk/lib/rDSA/CompleteBottomUp.cpp
    poolalloc/trunk/lib/rDSA/DataStructure.cpp
    poolalloc/trunk/lib/rDSA/DataStructureAA.cpp
    poolalloc/trunk/lib/rDSA/DataStructureStats.cpp
    poolalloc/trunk/lib/rDSA/EquivClassGraphs.cpp
    poolalloc/trunk/lib/rDSA/GraphChecker.cpp
    poolalloc/trunk/lib/rDSA/Local.cpp
    poolalloc/trunk/lib/rDSA/Printer.cpp
    poolalloc/trunk/lib/rDSA/StdLibPass.cpp
    poolalloc/trunk/lib/rDSA/Steensgaard.cpp
    poolalloc/trunk/lib/rDSA/TopDownClosure.cpp

Modified: poolalloc/trunk/include/rdsa/DSGraphTraits.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/rdsa/DSGraphTraits.h?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/include/rdsa/DSGraphTraits.h (original)
+++ poolalloc/trunk/include/rdsa/DSGraphTraits.h Wed Aug  5 10:06:44 2009
@@ -34,10 +34,10 @@
   DSNodeIterator(NodeTy *N) : Node(N), Offset(0) {}   // begin iterator
   DSNodeIterator(NodeTy *N, bool) : Node(N) {         // Create end iterator
     if (N != 0) {
-      Offset = N->getNumLinks() << DS::PointerShift;
+      Offset = N->getNumLinks();
       if (Offset == 0 && Node->getForwardNode() &&
           Node->isDeadNode())        // Model Forward link
-        Offset += DS::PointerSize;
+        Offset += 1;
     } else {
       Offset = 0;
     }
@@ -66,7 +66,7 @@
   pointer operator->() const { return operator*(); }
 
   _Self& operator++() {                // Preincrement
-    Offset += (1 << DS::PointerShift);
+    Offset += 1;
     return *this;
   }
   _Self operator++(int) { // Postincrement

Modified: poolalloc/trunk/include/rdsa/DSNode.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/rdsa/DSNode.h?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/include/rdsa/DSNode.h (original)
+++ poolalloc/trunk/include/rdsa/DSNode.h Wed Aug  5 10:06:44 2009
@@ -195,9 +195,7 @@
   /// hasLink - Return true if this memory object has a link in slot LinkNo
   ///
   bool hasLink(unsigned Offset) const {
-    assert((Offset & ((1 << DS::PointerShift)-1)) == 0 &&
-           "Pointer offset not aligned correctly!");
-    unsigned Index = Offset >> DS::PointerShift;
+    unsigned Index = Offset;
     assert(Index < Links.size() && "Link index is out of range!");
     return Links[Index].getNode();
   }
@@ -205,16 +203,12 @@
   /// getLink - Return the link at the specified offset.
   ///
   DSNodeHandle &getLink(unsigned Offset) {
-    assert((Offset & ((1 << DS::PointerShift)-1)) == 0 &&
-           "Pointer offset not aligned correctly!");
-    unsigned Index = Offset >> DS::PointerShift;
+    unsigned Index = Offset;
     assert(Index < Links.size() && "Link index is out of range!");
     return Links[Index];
   }
   const DSNodeHandle &getLink(unsigned Offset) const {
-    assert((Offset & ((1 << DS::PointerShift)-1)) == 0 &&
-           "Pointer offset not aligned correctly!");
-    unsigned Index = Offset >> DS::PointerShift;
+    unsigned Index = Offset;
     assert(Index < Links.size() && "Link index is out of range!");
     return Links[Index];
   }
@@ -264,17 +258,11 @@
   /// instead one of the higher level methods should be used, below.
   ///
   void setLink(unsigned Offset, const DSNodeHandle &NH) {
-    assert((Offset & ((1 << DS::PointerShift)-1)) == 0 &&
-           "Pointer offset not aligned correctly!");
-    unsigned Index = Offset >> DS::PointerShift;
+    unsigned Index = Offset;
     assert(Index < Links.size() && "Link index is out of range!");
     Links[Index] = NH;
   }
 
-  /// getPointerSize - Return the size of a pointer for the current target.
-  ///
-  unsigned getPointerSize() const { return DS::PointerSize; }
-
   /// addEdgeTo - Add an edge from the current node to the specified node.  This
   /// can cause merging of nodes in the graph.
   ///

Modified: poolalloc/trunk/include/rdsa/DSSupport.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/rdsa/DSSupport.h?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/include/rdsa/DSSupport.h (original)
+++ poolalloc/trunk/include/rdsa/DSSupport.h Wed Aug  5 10:06:44 2009
@@ -30,17 +30,6 @@
 class DSGraph;                 // A graph for a function
 class ReachabilityCloner;
 
-namespace DS { // FIXME: After the paper, this should get cleaned up
-  enum { PointerShift = 2,     // 64bit ptrs = 3, 32 bit ptrs = 2
-         PointerSize = 1 << PointerShift
-  };
-
-  /// isPointerType - Return true if this first class type is big enough to hold
-  /// a pointer.
-  ///
-  bool isPointerType(const Type *Ty);
-}
-
 //===----------------------------------------------------------------------===//
 /// DSNodeHandle - Implement a "handle" to a data structure node that takes care
 /// of all of the add/un'refing of the node to prevent the backpointers in the

Modified: poolalloc/trunk/include/rdsa/DataStructure.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/rdsa/DataStructure.h?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/include/rdsa/DataStructure.h (original)
+++ poolalloc/trunk/include/rdsa/DataStructure.h Wed Aug  5 10:06:44 2009
@@ -140,23 +140,24 @@
 
   virtual void releaseMemory();
 
-  virtual bool hasDSGraph(const Function &F) const {
-    return DSInfo.find(&F) != DSInfo.end();
+  virtual bool hasDSGraph(const Function* F) const {
+    return DSInfo.find(F) != DSInfo.end();
   }
 
   /// getDSGraph - Return the data structure graph for the specified function.
   ///
-  virtual DSGraph *getDSGraph(const Function &F) const {
-    hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(&F);
+  virtual DSGraph *getDSGraph(const Function* F) const {
+    hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(F);
     assert(I != DSInfo.end() && "Function not in module!");
     return I->second;
   }
 
-  void setDSGraph(const Function& F, DSGraph* G) {
-    DSInfo[&F] = G;
+  void setDSGraph(const Function* F, DSGraph* G) {
+    DSInfo[F] = G;
   }
 
-  DSGraph* getOrCreateGraph(const Function* F);
+  DSGraph* getOrFetchDSGraph(const Function* F);
+
 
   DSGraph* getGlobalsGraph() const { return GlobalsGraph; }
 
@@ -394,7 +395,7 @@
                                                   hash_set<DSNode*> &Visited);
 
   void InlineCallersIntoGraph(DSGraph* G);
-  void ComputePostOrder(const Function &F, hash_set<DSGraph*> &Visited,
+  void ComputePostOrder(const Function* F, hash_set<DSGraph*> &Visited,
                         std::vector<DSGraph*> &PostOrder);
 };
 
@@ -437,11 +438,11 @@
   
   /// getDSGraph - Return the data structure graph for the specified function.
   ///
-  virtual DSGraph *getDSGraph(const Function &F) const {
+  virtual DSGraph *getDSGraph(const Function* F) const {
     return getResultGraph();
   }
   
-  virtual bool hasDSGraph(const Function &F) const {
+  virtual bool hasDSGraph(const Function* F) const {
     return true;
   }
 

Modified: poolalloc/trunk/lib/rDSA/Basic.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/Basic.cpp?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/lib/rDSA/Basic.cpp (original)
+++ poolalloc/trunk/lib/rDSA/Basic.cpp Wed Aug  5 10:06:44 2009
@@ -77,7 +77,7 @@
       Node->foldNodeCompletely();
       Node->maskNodeTypes(DSNode::IncompleteNode);
 
-      setDSGraph(*F, G);
+      setDSGraph(F, G);
     }
   }
  

Modified: poolalloc/trunk/lib/rDSA/BottomUpClosure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/BottomUpClosure.cpp?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/lib/rDSA/BottomUpClosure.cpp (original)
+++ poolalloc/trunk/lib/rDSA/BottomUpClosure.cpp Wed Aug  5 10:06:44 2009
@@ -52,19 +52,19 @@
   Function *MainFunc = M.getFunction("main");
   if (MainFunc && !MainFunc->isDeclaration()) {
     calculateGraphs(MainFunc, Stack, NextID, ValMap);
-    CloneAuxIntoGlobal(getDSGraph(*MainFunc));
+    CloneAuxIntoGlobal(getDSGraph(MainFunc));
   } else {
     DEBUG(errs() << debugname << ": No 'main' function found!\n");
   }
 
   // Calculate the graphs for any functions that are unreachable from main...
   for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
-    if (!I->isDeclaration() && !hasDSGraph(*I)) {
+    if (!I->isDeclaration() && !hasDSGraph(I)) {
       if (MainFunc)
         DEBUG(errs() << debugname << ": Function unreachable from main: "
 	      << I->getName() << "\n");
       calculateGraphs(I, Stack, NextID, ValMap);     // Calculate all graphs.
-      CloneAuxIntoGlobal(getDSGraph(*I));
+      CloneAuxIntoGlobal(getDSGraph(I));
     }
 
   // If we computed any temporary indcallgraphs, free them now.
@@ -97,7 +97,7 @@
   // into the main function's graph so that the main function contains all of
   // the information about global pools and GV usage in the program.
   if (MainFunc && !MainFunc->isDeclaration()) {
-    DSGraph* MainGraph = getOrCreateGraph(MainFunc);
+    DSGraph* MainGraph = getDSGraph(MainFunc);
     const DSGraph* GG = MainGraph->getGlobalsGraph();
     ReachabilityCloner RC(MainGraph, GG,
                           DSGraph::DontCloneCallNodes |
@@ -229,7 +229,7 @@
     return Min;
   }
 
-  DSGraph* Graph = getOrCreateGraph(F);
+  DSGraph* Graph = getOrFetchDSGraph(F);
 
   // Find all callee functions.
   std::vector<const Function*> CalleeFunctions;
@@ -315,7 +315,7 @@
     unsigned SCCSize = 1;
     const Function *NF = Stack.back();
     ValMap[NF] = ~0U;
-    DSGraph* SCCGraph = getDSGraph(*NF);
+    DSGraph* SCCGraph = getDSGraph(NF);
 
     // First thing first, collapse all of the DSGraphs into a single graph for
     // the entire SCC.  Splice all of the graphs into one and discard all of the
@@ -326,13 +326,13 @@
       NF = Stack.back();
       ValMap[NF] = ~0U;
 
-      DSGraph* NFG = getDSGraph(*NF);
+      DSGraph* NFG = getDSGraph(NF);
 
       if (NFG != SCCGraph) {
         // Update the Function -> DSG map.
         for (DSGraph::retnodes_iterator I = NFG->retnodes_begin(),
                E = NFG->retnodes_end(); I != E; ++I)
-          setDSGraph(*I->first, SCCGraph);
+          setDSGraph(I->first, SCCGraph);
         
         SCCGraph->spliceFrom(NFG);
         delete NFG;
@@ -467,11 +467,11 @@
          ii != ee; ++ii) 
       callee_add(TheCall, *ii);
 
-    if (CalledFuncs.size() == 1 && (isComplete || hasDSGraph(*CalledFuncs[0]))) {
+    if (CalledFuncs.size() == 1 && (isComplete || hasDSGraph(CalledFuncs[0]))) {
       const Function *Callee = CalledFuncs[0];
 
       // Get the data structure graph for the called function.
-      GI = getDSGraph(*Callee);  // Graph to inline
+      GI = getDSGraph(Callee);  // Graph to inline
       DEBUG(GI->AssertGraphOK(); GI->getGlobalsGraph()->AssertGraphOK());
       DEBUG(errs() << "    Inlining graph for " << Callee->getName()
 	    << "[" << GI->getGraphSize() << "+"
@@ -500,7 +500,7 @@
       
       if (!isComplete) {
         for (unsigned x = 0; x < CalledFuncs.size(); )
-          if (!hasDSGraph(*CalledFuncs[x]))
+          if (!hasDSGraph(CalledFuncs[x]))
             CalledFuncs.erase(CalledFuncs.begin() + x);
           else
             ++x;
@@ -516,7 +516,7 @@
             E = CalledFuncs.end();
           
           // Start with a copy of the first graph.
-          GI = IndCallGraph.first = new DSGraph(getDSGraph(**I), GlobalECs);
+          GI = IndCallGraph.first = new DSGraph(getDSGraph(*I), GlobalECs);
           GI->setGlobalsGraph(Graph->getGlobalsGraph());
           std::vector<DSNodeHandle> &Args = IndCallGraph.second;
           
@@ -529,7 +529,7 @@
             // If the graph already contains the nodes for the function, don't
             // bother merging it in again.
             if (!GI->containsFunction(*I)) {
-              GI->cloneInto(getDSGraph(**I));
+              GI->cloneInto(getDSGraph(*I));
               ++NumInlines;
             }
             
@@ -616,11 +616,11 @@
          ii != ee; ++ii)
       callee_add(TheCall, *ii);
 
-    if (CalledFuncs.size() == 1 && hasDSGraph(*CalledFuncs[0])) {
+    if (CalledFuncs.size() == 1 && hasDSGraph(CalledFuncs[0])) {
       const Function *Callee = CalledFuncs[0];
 
       // Get the data structure graph for the called function.
-      GI = getDSGraph(*Callee);  // Graph to inline
+      GI = getDSGraph(Callee);  // Graph to inline
       if (GI == Graph) continue;
       DEBUG(errs() << "    Inlining graph for " << Callee->getName()
 	    << "[" << GI->getGraphSize() << "+"
@@ -646,7 +646,7 @@
       DEBUG(errs() << "\n");
       
       for (unsigned x = 0; x < CalledFuncs.size(); )
-        if (!hasDSGraph(*CalledFuncs[x]))
+        if (!hasDSGraph(CalledFuncs[x]))
           CalledFuncs.erase(CalledFuncs.begin() + x);
         else
           ++x;
@@ -665,7 +665,7 @@
           E = CalledFuncs.end();
         
         // Start with a copy of the first graph.
-        GI = IndCallGraph.first = new DSGraph(getDSGraph(**I), GlobalECs);
+        GI = IndCallGraph.first = new DSGraph(getDSGraph(*I), GlobalECs);
         GI->setGlobalsGraph(Graph->getGlobalsGraph());
         std::vector<DSNodeHandle> &Args = IndCallGraph.second;
         
@@ -678,7 +678,7 @@
           // If the graph already contains the nodes for the function, don't
           // bother merging it in again.
           if (!GI->containsFunction(*I)) {
-            GI->cloneInto(getDSGraph(**I));
+            GI->cloneInto(getDSGraph(*I));
             ++NumInlines;
           }
           

Modified: poolalloc/trunk/lib/rDSA/CallTargets.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/CallTargets.cpp?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/lib/rDSA/CallTargets.cpp (original)
+++ poolalloc/trunk/lib/rDSA/CallTargets.cpp Wed Aug  5 10:06:44 2009
@@ -64,7 +64,7 @@
                 CompleteSites.insert(cs);
               } else {
                 IndCall++;
-                DSNode* N = T->getDSGraph(*cs.getCaller())
+                DSNode* N = T->getDSGraph(cs.getCaller())
                   ->getNodeForValue(cs.getCalledValue()).getNode();
                 assert (N && "CallTarget: findIndTargets: No DSNode!\n");
                 N->addFullFunctionList(IndMap[cs]);

Modified: poolalloc/trunk/lib/rDSA/CompleteBottomUp.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/CompleteBottomUp.cpp?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/lib/rDSA/CompleteBottomUp.cpp (original)
+++ poolalloc/trunk/lib/rDSA/CompleteBottomUp.cpp Wed Aug  5 10:06:44 2009
@@ -53,7 +53,7 @@
     if (*ii) {
       callee_iterator csi = callee_begin(*ii), cse = callee_end(*ii); 
       if (csi != cse) ++csi;
-      DSGraph* G = getOrCreateGraph((*ii)->getParent()->getParent());
+      DSGraph* G = getOrFetchDSGraph((*ii)->getParent()->getParent());
       for ( ; csi != cse; ++csi) {
         G->getNodeForValue(*csi).mergeWith(G->getNodeForValue((*ii)->getOperand(0)));
         G->getNodeForValue((*ii)->getOperand(0)).getNode()->setGlobalMarker();

Modified: poolalloc/trunk/lib/rDSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/DataStructure.cpp?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/lib/rDSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/rDSA/DataStructure.cpp Wed Aug  5 10:06:44 2009
@@ -44,34 +44,12 @@
   STATISTIC (NumDNE            , "Number of nodes removed by reachability");
   STATISTIC (NumTrivialDNE     , "Number of nodes trivially removed");
   STATISTIC (NumTrivialGlobalDNE, "Number of globals trivially removed");
-#ifdef LLVA_KERNEL
-  STATISTIC (LostPools         , "Number of pools lost to DSNode Merge");
-#endif
   static cl::opt<unsigned>
   DSAFieldLimit("dsa-field-limit", cl::Hidden,
                 cl::desc("Number of fields to track before collapsing a node"),
                 cl::init(256));
 }
 
-#if 0
-#define TIME_REGION(VARNAME, DESC) \
-   NamedRegionTimer VARNAME(DESC)
-#else
-#define TIME_REGION(VARNAME, DESC)
-#endif
-
-using namespace DS;
-
-//
-// Function: DS::isPointerType()
-//
-// Description:
-//  This returns whether the given type is a pointer.
-//
-bool DS::isPointerType(const Type *Ty) {
-  return isa<llvm::PointerType>(Ty);
-}
-
 /// isForwarding - Return true if this NodeHandle is forwarding to another
 /// one.
 bool DSNodeHandle::isForwarding() const {
@@ -538,7 +516,7 @@
     // If this node would have to have an unreasonable number of fields, just
     // collapse it.  This can occur for fortran common blocks, which have stupid
     // things like { [100000000 x double], [1000000 x double] }.
-    unsigned NumFields = (NewTySize+DS::PointerSize-1) >> DS::PointerShift;
+    unsigned NumFields = NewTySize;
     if (NumFields > DSAFieldLimit) {
       foldNodeCompletely();
       return true;
@@ -566,7 +544,7 @@
     // If this node would have to have an unreasonable number of fields, just
     // collapse it.  This can occur for fortran common blocks, which have stupid
     // things like { [100000000 x double], [1000000 x double] }.
-    unsigned NumFields = (NewTySize+Offset+DS::PointerSize-1) >> DS::PointerShift;
+    unsigned NumFields = NewTySize+Offset;
     if (NumFields > DSAFieldLimit) {
       foldNodeCompletely();
       return true;
@@ -953,7 +931,7 @@
   // Make all of the outgoing links of N now be outgoing links of CurNodeH.
   //
   for (unsigned i = 0; i < N->getNumLinks(); ++i) {
-    DSNodeHandle &Link = N->getLink(i << DS::PointerShift);
+    DSNodeHandle &Link = N->getLink(i);
     if (Link.getNode()) {
       // Compute the offset into the current node at which to
       // merge this link.  In the common case, this is a linear
@@ -964,7 +942,7 @@
       unsigned MergeOffset = 0;
       DSNode *CN = CurNodeH.getNode();
       if (CN->Size != 1)
-        MergeOffset = ((i << DS::PointerShift)+NOffset) % CN->getSize();
+        MergeOffset = (i+NOffset) % CN->getSize();
       CN->addEdgeTo(MergeOffset, Link);
     }
   }
@@ -1091,7 +1069,7 @@
   // reason, we must always go through NH.
   DN = 0;
   for (unsigned i = 0, e = SN->getNumLinks(); i != e; ++i) {
-    const DSNodeHandle &SrcEdge = SN->getLink(i << DS::PointerShift);
+    const DSNodeHandle &SrcEdge = SN->getLink(i);
     if (!SrcEdge.isNull()) {
       const DSNodeHandle &DestEdge = getClonedNH(SrcEdge);
       // Compute the offset into the current node at which to
@@ -1103,7 +1081,7 @@
       unsigned MergeOffset = 0;
       DSNode *CN = NH.getNode();
       if (CN->getSize() != 1)
-        MergeOffset = ((i << DS::PointerShift)+NH.getOffset()) % CN->getSize();
+        MergeOffset = (i+NH.getOffset()) % CN->getSize();
       CN->addEdgeTo(MergeOffset, DestEdge);
     }
   }
@@ -1296,7 +1274,7 @@
   // For this reason, we must always go through NH.
   DN = 0;
   for (unsigned i = 0, e = SN->getNumLinks(); i != e; ++i) {
-    const DSNodeHandle &SrcEdge = SN->getLink(i << DS::PointerShift);
+    const DSNodeHandle &SrcEdge = SN->getLink(i);
     if (!SrcEdge.isNull()) {
       // Compute the offset into the current node at which to
       // merge this link.  In the common case, this is a linear
@@ -1306,7 +1284,7 @@
       // links at offset zero.
       DSNode *CN = SCNH.getNode();
       unsigned MergeOffset =
-        ((i << DS::PointerShift)+SCNH.getOffset()) % CN->getSize();
+        (i+SCNH.getOffset()) % CN->getSize();
 
       DSNodeHandle Tmp = CN->getLink(MergeOffset);
       if (!Tmp.isNull()) {
@@ -1321,7 +1299,7 @@
 
         unsigned MergeOffset = 0;
         CN = SCNH.getNode();
-        MergeOffset = ((i << DS::PointerShift)+SCNH.getOffset()) %CN->getSize();
+        MergeOffset = (i+SCNH.getOffset()) %CN->getSize();
         CN->getLink(MergeOffset).mergeWith(Tmp);
       }
     }
@@ -1528,7 +1506,6 @@
 /// The CloneFlags member controls various aspects of the cloning process.
 ///
 void DSGraph::cloneInto( DSGraph* G, unsigned CloneFlags) {
-  TIME_REGION(X, "cloneInto");
   assert(G != this && "Cannot clone graph into itself!");
 
   NodeMapTy OldNodeMap;
@@ -1547,10 +1524,6 @@
     OldNodeMap[I] = New;
   }
 
-#ifndef NDEBUG
-  Timer::addPeakMemoryMeasurement();
-#endif
-
   // Rewrite the links in the new nodes to point into the current graph now.
   // Note that we don't loop over the node's list to do this.  The problem is
   // that remaping links can cause recursive merging to happen, which means
@@ -1773,8 +1746,6 @@
 void DSGraph::mergeInGraph(const DSCallSite &CS,
                            std::vector<DSNodeHandle> &Args,
                            const DSGraph &Graph, unsigned CloneFlags) {
-  TIME_REGION(X, "mergeInGraph");
-
   assert((CloneFlags & DontCloneCallNodes) &&
          "Doesn't support copying of call nodes!");
 
@@ -2180,7 +2151,6 @@
 // we don't have to perform any non-trivial analysis here.
 //
 void DSGraph::removeTriviallyDeadNodes(bool updateForwarders) {
-  TIME_REGION(X, "removeTriviallyDeadNodes");
 
   if (updateForwarders) {
     /// NOTE: This code is disabled.  This slows down DSA on 177.mesa
@@ -2189,26 +2159,22 @@
     // Loop over all of the nodes in the graph, calling getNode on each field.
     // This will cause all nodes to update their forwarding edges, causing
     // forwarded nodes to be delete-able.
-    { TIME_REGION(X, "removeTriviallyDeadNodes:node_iterate");
-      for (node_iterator NI = node_begin(), E = node_end(); NI != E; ++NI) {
-        DSNode &N = *NI;
-        for (unsigned l = 0, e = N.getNumLinks(); l != e; ++l)
-          N.getLink(l*N.getPointerSize()).getNode();
-      }
+    for (node_iterator NI = node_begin(), E = node_end(); NI != E; ++NI) {
+      DSNode &N = *NI;
+      for (unsigned l = 0, e = N.getNumLinks(); l != e; ++l)
+	N.getLink(l).getNode();
     }
     
     // NOTE: This code is disabled.  Though it should, in theory, allow us to
     // remove more nodes down below, the scan of the scalar map is incredibly
     // expensive for certain programs (with large SCCs).  In the future, if we can
     // make the scalar map scan more efficient, then we can reenable this.
-    { TIME_REGION(X, "removeTriviallyDeadNodes:scalarmap");
       
-      // Likewise, forward any edges from the scalar nodes.  While we are at it,
-      // clean house a bit.
-      for (DSScalarMap::iterator I = ScalarMap.begin(),E = ScalarMap.end();I != E;){
-        I->second.getNode();
-        ++I;
-      }
+    // Likewise, forward any edges from the scalar nodes.  While we are at it,
+    // clean house a bit.
+    for (DSScalarMap::iterator I = ScalarMap.begin(),E = ScalarMap.end();I != E;){
+      I->second.getNode();
+      ++I;
     }
   }
 
@@ -2352,8 +2318,6 @@
   // merging...
   removeTriviallyDeadNodes();
 
-  TIME_REGION(X, "removeDeadNodes");
-
   // FIXME: Merge non-trivially identical call nodes...
 
   // Alive - a set that holds all nodes found to be reachable/alive.
@@ -2371,7 +2335,6 @@
                               DSGraph::StripIncompleteBit);
 
   // Mark all nodes reachable by (non-global) scalar nodes as alive...
-{ TIME_REGION(Y, "removeDeadNodes:scalarscan");
   for (DSScalarMap::iterator I = ScalarMap.begin(), E = ScalarMap.end();
        I != E; ++I)
     if (isa<GlobalValue>(I->first)) {             // Keep track of global nodes
@@ -2391,7 +2354,6 @@
     } else {
       I->second.getNode()->markReachableNodes(Alive);
     }
-}
 
   // The return values are alive as well.
   for (ReturnNodesTy::iterator I = ReturnNodes.begin(), E = ReturnNodes.end();
@@ -2584,7 +2546,7 @@
   unsigned N2Size = N2->getSize();
   if (N2Size == 0) return;   // No edges to map to.
 
-  for (unsigned i = 0, e = N1->getSize(); i < e; i += DS::PointerSize) {
+  for (unsigned i = 0, e = N1->getSize(); i < e; i += 1) {
     const DSNodeHandle &N1NH = N1->getLink(i);
     // Don't call N2->getLink if not needed (avoiding crash if N2Idx is not
     // aligned right).
@@ -2665,7 +2627,6 @@
 /// nodes reachable from them from the globals graph into the current graph.
 ///
 void DSGraph::updateFromGlobalGraph() {
-  TIME_REGION(X, "updateFromGlobalGraph");
   ReachabilityCloner RC(this, GlobalsGraph, 0);
 
   // Clone the non-up-to-date global nodes into this graph.
@@ -2697,12 +2658,12 @@
 void DataStructures::deleteValue(Value *V) {
   if (const Function *F = getFnForValue(V)) {  // Function local value?
     // If this is a function local value, just delete it from the scalar map!
-    getDSGraph(*F)->getScalarMap().eraseIfExists(V);
+    getDSGraph(F)->getScalarMap().eraseIfExists(V);
     return;
   }
   
   if (Function *F = dyn_cast<Function>(V)) {
-    assert(getDSGraph(*F)->getReturnNodes().size() == 1 &&
+    assert(getDSGraph(F)->getReturnNodes().size() == 1 &&
            "cannot handle scc's");
     delete DSInfo[F];
     DSInfo.erase(F);
@@ -2716,14 +2677,14 @@
   if (From == To) return;
   if (const Function *F = getFnForValue(From)) {  // Function local value?
     // If this is a function local value, just delete it from the scalar map!
-    getDSGraph(*F)->getScalarMap().copyScalarIfExists(From, To);
+    getDSGraph(F)->getScalarMap().copyScalarIfExists(From, To);
     return;
   }
   
   if (Function *FromF = dyn_cast<Function>(From)) {
     Function *ToF = cast<Function>(To);
     assert(!DSInfo.count(ToF) && "New Function already exists!");
-    DSGraph *NG = new DSGraph(getDSGraph(*FromF), GlobalECs);
+    DSGraph *NG = new DSGraph(getDSGraph(FromF), GlobalECs);
     DSInfo[ToF] = NG;
     assert(NG->getReturnNodes().size() == 1 && "Cannot copy SCC's yet!");
     
@@ -2735,7 +2696,7 @@
   }
   
   if (const Function *F = getFnForValue(To)) {
-    getDSGraph(*F)->getScalarMap().copyScalarIfExists(From, To);
+    getDSGraph(F)->getScalarMap().copyScalarIfExists(From, To);
     return;
   }
   
@@ -2745,12 +2706,12 @@
   abort();
 }
 
-DSGraph* DataStructures::getOrCreateGraph(const Function* F) {
+DSGraph* DataStructures::getOrFetchDSGraph(const Function* F) {
   assert(F && "No function");
   DSGraph *&G = DSInfo[F];
   if (!G) {
     //Clone or Steal the Source Graph
-    DSGraph* BaseGraph = GraphSource->getDSGraph(*F);
+    DSGraph* BaseGraph = GraphSource->getDSGraph(F);
     if (Clone) {
       G = new DSGraph(BaseGraph, GlobalECs, DSGraph::DontCloneAuxCallNodes);
     } else {

Modified: poolalloc/trunk/lib/rDSA/DataStructureAA.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/DataStructureAA.cpp?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/lib/rDSA/DataStructureAA.cpp (original)
+++ poolalloc/trunk/lib/rDSA/DataStructureAA.cpp Wed Aug  5 10:06:44 2009
@@ -113,11 +113,11 @@
 //
 DSGraph *DSAA::getGraphForValue(const Value *V) {
   if (const Instruction *I = dyn_cast<Instruction>(V))
-    return TD->getDSGraph(*I->getParent()->getParent());
+    return TD->getDSGraph(I->getParent()->getParent());
   else if (const Argument *A = dyn_cast<Argument>(V))
-    return TD->getDSGraph(*A->getParent());
+    return TD->getDSGraph(A->getParent());
   else if (const BasicBlock *BB = dyn_cast<BasicBlock>(V))
-    return TD->getDSGraph(*BB->getParent());
+    return TD->getDSGraph(BB->getParent());
   return 0;
 }
 
@@ -178,7 +178,7 @@
   if (CS.getInstruction() == MapCS.getInstruction()) {
     {
       const Function *Caller = CS.getInstruction()->getParent()->getParent();
-      DSGraph* CallerTDGraph = TD->getDSGraph(*Caller);
+      DSGraph* CallerTDGraph = TD->getDSGraph(Caller);
 
       // Figure out which node in the TD graph this pointer corresponds to.
       DSScalarMap &CallerSM = CallerTDGraph->getScalarMap();
@@ -229,7 +229,7 @@
     // the portion of the program we have analyzed, we can draw conclusions
     // based on whether the global escapes the program.
     Function *Caller = CS.getInstruction()->getParent()->getParent();
-    DSGraph *G = TD->getDSGraph(*Caller);
+    DSGraph *G = TD->getDSGraph(Caller);
     DSScalarMap::iterator NI = G->getScalarMap().find(P);
     if (NI == G->getScalarMap().end()) {
       // If it wasn't in the local function graph, check the global graph.  This
@@ -251,8 +251,8 @@
   // Get the graphs for the callee and caller.  Note that we want the BU graph
   // for the callee because we don't want all caller's effects incorporated!
   const Function *Caller = CS.getInstruction()->getParent()->getParent();
-  DSGraph* CallerTDGraph = TD->getDSGraph(*Caller);
-  DSGraph* CalleeBUGraph = BU->getDSGraph(*F);
+  DSGraph* CallerTDGraph = TD->getDSGraph(Caller);
+  DSGraph* CalleeBUGraph = BU->getDSGraph(F);
 
   // Figure out which node in the TD graph this pointer corresponds to.
   DSScalarMap &CallerSM = CallerTDGraph->getScalarMap();

Modified: poolalloc/trunk/lib/rDSA/DataStructureStats.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/DataStructureStats.cpp?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/lib/rDSA/DataStructureStats.cpp (original)
+++ poolalloc/trunk/lib/rDSA/DataStructureStats.cpp Wed Aug  5 10:06:44 2009
@@ -39,7 +39,7 @@
                                 "Number of loads/stores which are untyped");
 
   class DSGraphStats : public FunctionPass, public InstVisitor<DSGraphStats> {
-    void countCallees(const Function &F);
+    void countCallees(const Function* F);
     const DSGraph *TDGraph;
 
     DSNode *getNodeForValue(Value *V);
@@ -83,7 +83,7 @@
 }
 
 
-void DSGraphStats::countCallees(const Function& F) {
+void DSGraphStats::countCallees(const Function* F) {
   unsigned numIndirectCalls = 0, totalNumCallees = 0;
 
   for (DSGraph::fc_iterator I = TDGraph->fc_begin(), E = TDGraph->fc_end();
@@ -98,7 +98,7 @@
         ++numIndirectCalls;
       } else {
         DEBUG(errs() << "WARNING: No callee in Function '" 
-	      << F.getNameStr() << "' at call: \n"
+	      << F->getNameStr() << "' at call: \n"
 	      << *I->getCallSite().getInstruction());
       }
     }
@@ -107,7 +107,7 @@
   NumIndirectCalls += numIndirectCalls;
 
   if (numIndirectCalls) {
-    DEBUG(errs() << "  In function " << F.getName() << ":  "
+    DEBUG(errs() << "  In function " << F->getName() << ":  "
 	  << (totalNumCallees / (double) numIndirectCalls)
 	  << " average callees per indirect call\n");
   }
@@ -150,8 +150,8 @@
 
 
 bool DSGraphStats::runOnFunction(Function& F) {
-  TDGraph = getAnalysis<TDDataStructures>().getDSGraph(F);
-  countCallees(F);
+  TDGraph = getAnalysis<TDDataStructures>().getDSGraph(&F);
+  countCallees(&F);
   visit(F);
   return true;
 }

Modified: poolalloc/trunk/lib/rDSA/EquivClassGraphs.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/EquivClassGraphs.cpp?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/lib/rDSA/EquivClassGraphs.cpp (original)
+++ poolalloc/trunk/lib/rDSA/EquivClassGraphs.cpp Wed Aug  5 10:06:44 2009
@@ -65,13 +65,13 @@
          MI != GlobalECs.member_end(); ++MI) {
       if (const Function* F = dyn_cast<Function>(*MI)) {
         if (!BaseGraph) {
-          BaseGraph = getOrCreateGraph(F);
+          BaseGraph = getOrFetchDSGraph(F);
           BaseGraph->getFunctionArgumentsForCall(F, Args);
         } else if (BaseGraph->containsFunction(F)) {
           //already merged
         } else {
           std::vector<DSNodeHandle> NextArgs;
-          BaseGraph->cloneInto(getOrCreateGraph(F));
+          BaseGraph->cloneInto(getOrFetchDSGraph(F));
           BaseGraph->getFunctionArgumentsForCall(F, NextArgs);
           unsigned i = 0, e = Args.size();
           for (; i != e; ++i) {
@@ -80,7 +80,7 @@
           }
           for (e = NextArgs.size(); i != e; ++i)
             Args.push_back(NextArgs[i]);
-          setDSGraph(*F, BaseGraph);
+          setDSGraph(F, BaseGraph);
         }       
       }
     }

Modified: poolalloc/trunk/lib/rDSA/GraphChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/GraphChecker.cpp?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/lib/rDSA/GraphChecker.cpp (original)
+++ poolalloc/trunk/lib/rDSA/GraphChecker.cpp Wed Aug  5 10:06:44 2009
@@ -109,9 +109,9 @@
 ///
 bool DSGC::runOnFunction(Function &F) {
   switch (DSPass) {
-  case local: verify(getAnalysis<LocalDataStructures>().getDSGraph(F)); break;
-  case bu:    verify(getAnalysis<BUDataStructures>().getDSGraph(F)); break;
-  case td:    verify(getAnalysis<TDDataStructures>().getDSGraph(F)); break;
+  case local: verify(getAnalysis<LocalDataStructures>().getDSGraph(&F)); break;
+  case bu:    verify(getAnalysis<BUDataStructures>().getDSGraph(&F)); break;
+  case td:    verify(getAnalysis<TDDataStructures>().getDSGraph(&F)); break;
   }
 
   return false;

Modified: poolalloc/trunk/lib/rDSA/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/Local.cpp?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/lib/rDSA/Local.cpp (original)
+++ poolalloc/trunk/lib/rDSA/Local.cpp Wed Aug  5 10:06:44 2009
@@ -910,7 +910,7 @@
       DSGraph* G = new DSGraph(GlobalECs, getTargetData(), GlobalsGraph);
       GraphBuilderLocal GGB(*I, G->getOrCreateReturnNodeFor(*I), G, *this);
       G->getAuxFunctionCalls() = G->getFunctionCalls();
-      setDSGraph(*I, G);
+      setDSGraph(I, G);
       propagateUnknownFlag(G);
     }
 

Modified: poolalloc/trunk/lib/rDSA/Printer.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/Printer.cpp?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/lib/rDSA/Printer.cpp (original)
+++ poolalloc/trunk/lib/rDSA/Printer.cpp Wed Aug  5 10:06:44 2009
@@ -15,7 +15,7 @@
 
 #include "rdsa/DataStructure.h"
 #include "rdsa/DSGraph.h"
-#include "dsa/DSGraphTraits.h"
+#include "rdsa/DSGraphTraits.h"
 #include "llvm/Module.h"
 #include "llvm/Constants.h"
 #include "llvm/Assembly/Writer.h"
@@ -132,13 +132,13 @@
   static bool edgeTargetsEdgeSource(const void *Node,
                                     DSNode::const_iterator I) {
     unsigned O = I.getNode()->getLink(I.getOffset()).getOffset();
-    return (O >> DS::PointerShift) != 0;
+    return O != 0;
   }
 
   static DSNode::const_iterator getEdgeTarget(const DSNode *Node,
                                               DSNode::const_iterator I) {
     unsigned O = I.getNode()->getLink(I.getOffset()).getOffset();
-    unsigned LinkNo = O >> DS::PointerShift;
+    unsigned LinkNo = O;
     const DSNode *N = *I;
     DSNode::const_iterator R = N->begin();
     for (; LinkNo; --LinkNo)
@@ -174,7 +174,7 @@
           
           // Add edge from return node to real destination
           DSNode *DestNode = I->second.getNode();
-          int EdgeDest = I->second.getOffset() >> DS::PointerShift;
+          int EdgeDest = I->second.getOffset();
           if (EdgeDest == 0) EdgeDest = -1;
           GW.emitEdge(I->first, -1, DestNode,
                       EdgeDest, "arrowtail=tee,color=gray63");
@@ -196,7 +196,7 @@
 
         // Add edge from return node to real destination
         DSNode *RetNode = I->second.getNode();
-        int RetEdgeDest = I->second.getOffset() >> DS::PointerShift;;
+        int RetEdgeDest = I->second.getOffset();
         if (RetEdgeDest == 0) RetEdgeDest = -1;
         GW.emitEdge((void*)I->first, -1, RetNode,
                     RetEdgeDest, "arrowtail=tee,color=gray63");
@@ -220,7 +220,7 @@
                         &EdgeSourceCaptions);
 
       if (DSNode *N = Call.getRetVal().getNode()) {
-        int EdgeDest = Call.getRetVal().getOffset() >> DS::PointerShift;
+        int EdgeDest = Call.getRetVal().getOffset();
         if (EdgeDest == 0) EdgeDest = -1;
         GW.emitEdge(&Call, 0, N, EdgeDest, "color=gray63,tailclip=false");
       }
@@ -234,7 +234,7 @@
 
       for (unsigned j = 0, e = Call.getNumPtrArgs(); j != e; ++j)
         if (DSNode *N = Call.getPtrArg(j).getNode()) {
-          int EdgeDest = Call.getPtrArg(j).getOffset() >> DS::PointerShift;
+          int EdgeDest = Call.getPtrArg(j).getOffset();
           if (EdgeDest == 0) EdgeDest = -1;
           GW.emitEdge(&Call, j+2, N, EdgeDest, "color=gray63,tailclip=false");
         }
@@ -286,8 +286,8 @@
 
   unsigned TotalNumNodes = 0, TotalCallNodes = 0;
   for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
-    if (C.hasDSGraph(*I)) {
-      DSGraph* Gr = C.getDSGraph((Function&)*I);
+    if (C.hasDSGraph(I)) {
+      DSGraph* Gr = C.getDSGraph(I);
       unsigned NumCalls = Gr->shouldPrintAuxCalls() ?
         Gr->getAuxFunctionCalls().size() : Gr->getFunctionCalls().size();
       bool IsDuplicateGraph = false;

Modified: poolalloc/trunk/lib/rDSA/StdLibPass.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/StdLibPass.cpp?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/lib/rDSA/StdLibPass.cpp (original)
+++ poolalloc/trunk/lib/rDSA/StdLibPass.cpp Wed Aug  5 10:06:44 2009
@@ -181,7 +181,7 @@
        ii != ee; ++ii)
     if (CallInst* CI = dyn_cast<CallInst>(ii))
       if (CI->getOperand(0) == F) {
-        DSGraph* Graph = getDSGraph(*CI->getParent()->getParent());
+        DSGraph* Graph = getDSGraph(CI->getParent()->getParent());
         //delete the call
         DEBUG(errs() << "Removing " << F->getNameStr() << " from " 
 	      << CI->getParent()->getParent()->getNameStr() << "\n");
@@ -195,7 +195,7 @@
   //Clone Module
   for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) 
     if (!I->isDeclaration())
-      getOrCreateGraph(&*I);
+      getOrFetchDSGraph(I);
 
   //Trust the readnone annotation
   for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) 
@@ -224,7 +224,7 @@
              ii != ee; ++ii)
           if (CallInst* CI = dyn_cast<CallInst>(ii))
             if (CI->getOperand(0) == F) {
-              DSGraph* Graph = getDSGraph(*CI->getParent()->getParent());
+              DSGraph* Graph = getDSGraph(CI->getParent()->getParent());
               if (recFuncs[x].action.read[0])
                 Graph->getNodeForValue(CI).getNode()->setReadMarker();
               if (recFuncs[x].action.write[0])

Modified: poolalloc/trunk/lib/rDSA/Steensgaard.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/Steensgaard.cpp?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/lib/rDSA/Steensgaard.cpp (original)
+++ poolalloc/trunk/lib/rDSA/Steensgaard.cpp Wed Aug  5 10:06:44 2009
@@ -72,7 +72,7 @@
   //
   for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
     if (!I->isDeclaration()) {
-      ResultGraph->spliceFrom(DS->getDSGraph(*I));
+      ResultGraph->spliceFrom(DS->getDSGraph(I));
     }
   }
 

Modified: poolalloc/trunk/lib/rDSA/TopDownClosure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/TopDownClosure.cpp?rev=78193&r1=78192&r2=78193&view=diff

==============================================================================
--- poolalloc/trunk/lib/rDSA/TopDownClosure.cpp (original)
+++ poolalloc/trunk/lib/rDSA/TopDownClosure.cpp Wed Aug  5 10:06:44 2009
@@ -51,7 +51,7 @@
   Visited.insert(N);
 
   for (unsigned i = 0, e = N->getNumLinks(); i != e; ++i) {
-    DSNodeHandle &NH = N->getLink(i*N->getPointerSize());
+    DSNodeHandle &NH = N->getLink(i);
     if (DSNode *NN = NH.getNode()) {
       std::vector<const Function*> Functions;
       NN->addFullFunctionList(Functions);
@@ -112,12 +112,12 @@
 
   // Calculate top-down from main...
   if (Function *F = M.getFunction("main"))
-    ComputePostOrder(*F, VisitedGraph, PostOrder);
+    ComputePostOrder(F, VisitedGraph, PostOrder);
 
   // Next calculate the graphs for each unreachable function...
   for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
     if (!I->isDeclaration())
-      ComputePostOrder(*I, VisitedGraph, PostOrder);
+      ComputePostOrder(I, VisitedGraph, PostOrder);
 
   VisitedGraph.clear();   // Release memory!
 }
@@ -146,11 +146,11 @@
 }
 
 
-void TDDataStructures::ComputePostOrder(const Function &F,
+void TDDataStructures::ComputePostOrder(const Function* F,
                                         hash_set<DSGraph*> &Visited,
                                         std::vector<DSGraph*> &PostOrder) {
-  if (F.isDeclaration()) return;
-  DSGraph* G = getOrCreateGraph(&F);
+  if (F->isDeclaration()) return;
+  DSGraph* G = getOrFetchDSGraph(F);
   if (Visited.count(G)) return;
   Visited.insert(G);
 
@@ -159,7 +159,7 @@
     Instruction *CallI = CI->getCallSite().getInstruction();
     for (callee_iterator I = callee_begin(CallI),
            E = callee_end(CallI); I != E; ++I)
-      ComputePostOrder(**I, Visited, PostOrder);
+      ComputePostOrder(*I, Visited, PostOrder);
   }
 
   PostOrder.push_back(G);
@@ -287,7 +287,7 @@
     if (CI->isDirectCall()) {
       if (!CI->getCalleeFunc()->isDeclaration() &&
           !DSG->getReturnNodes().count(CI->getCalleeFunc()))
-        CallerEdges[getOrCreateGraph(CI->getCalleeFunc())]
+        CallerEdges[getOrFetchDSGraph(CI->getCalleeFunc())]
           .push_back(CallerCallEdge(DSG, &*CI, CI->getCalleeFunc()));
       continue;
     }
@@ -298,7 +298,7 @@
       callee_begin(CallI), IPE = callee_end(CallI);
 
     // Skip over all calls to this graph (SCC calls).
-    while (IPI != IPE && getDSGraph(**IPI) == DSG)
+    while (IPI != IPE && getDSGraph(*IPI) == DSG)
       ++IPI;
 
     // All SCC calls?
@@ -308,14 +308,14 @@
     ++IPI;
 
     // Skip over more SCC calls.
-    while (IPI != IPE && getDSGraph(**IPI) == DSG)
+    while (IPI != IPE && getDSGraph(*IPI) == DSG)
       ++IPI;
 
     // If there is exactly one callee from this call site, remember the edge in
     // CallerEdges.
     if (IPI == IPE) {
       if (!FirstCallee->isDeclaration())
-        CallerEdges[getOrCreateGraph(FirstCallee)]
+        CallerEdges[getOrFetchDSGraph(FirstCallee)]
           .push_back(CallerCallEdge(DSG, &*CI, FirstCallee));
       continue;
     }
@@ -360,7 +360,7 @@
       // exactly once.
       DSCallSite *NCS = &IndCallGraph->getFunctionCalls().front();
       for (unsigned i = 0, e = Callees.size(); i != e; ++i) {
-        DSGraph* CalleeGraph = getDSGraph(*Callees[i]);
+        DSGraph* CalleeGraph = getDSGraph(Callees[i]);
         if (CalleeGraph != DSG)
           CallerEdges[CalleeGraph].push_back(CallerCallEdge(IndCallGraph, NCS,
                                                             Callees[i]));





More information about the llvm-commits mailing list