[llvm-commits] CVS: poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp EquivClassGraphs.h

Chris Lattner lattner at cs.uiuc.edu
Mon Nov 1 12:37:10 PST 2004



Changes in directory poolalloc/lib/PoolAllocate:

EquivClassGraphs.cpp updated: 1.10 -> 1.11
EquivClassGraphs.h updated: 1.8 -> 1.9

---
Log message:

Get rid of the EquivClassGraphArgsInfo class, and the map that held it.
We only need one instance of the vector that it contains at a time.


---
Diffs of the changes:  (+8 -33)

Index: poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp
diff -u poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp:1.10 poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp:1.11
--- poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp:1.10	Mon Nov  1 13:54:06 2004
+++ poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp	Mon Nov  1 14:37:00 2004
@@ -115,7 +115,7 @@
 //
 void PA::EquivClassGraphs::buildIndirectFunctionSets(Module &M) {
   const ActualCalleesTy& AC = CBU->getActualCallees();
-
+  
   // Loop over all of the indirect calls in the program.  If a call site can
   // call multiple different functions, we need to unify all of the callees into
   // the same equivalence class.
@@ -196,11 +196,12 @@
       // equivalence graph.
       DSGraph *mergedG = &getOrCreateGraph(*LF);
 
-      // Record the argument nodes for use in merging later below
-      EquivClassGraphArgsInfo& GraphInfo = getECGraphInfo(mergedG);
+      // Record the argument nodes for use in merging later below.
+      std::vector<DSNodeHandle> ArgNodes;  
+
       for (Function::aiterator AI1 = LF->abegin(); AI1 != LF->aend(); ++AI1)
         if (DS::isPointerType(AI1->getType()))
-          GraphInfo.argNodes.push_back(mergedG->getNodeForValue(AI1));
+          ArgNodes.push_back(mergedG->getNodeForValue(AI1));
       
       // Merge in the graphs of all other functions in this equiv. class.  Note
       // that two or more functions may have the same graph, and it only needs
@@ -234,14 +235,14 @@
         // Merge the function arguments with all argument nodes found so far.
         // If there are extra function args, add them to the vector of argNodes
         Function::aiterator AI2 = F->abegin(), AI2end = F->aend();
-        for (unsigned arg=0, numArgs=GraphInfo.argNodes.size();
+        for (unsigned arg=0, numArgs = ArgNodes.size();
              arg != numArgs && AI2 != AI2end; ++AI2, ++arg)
           if (DS::isPointerType(AI2->getType()))
-            GraphInfo.argNodes[arg].mergeWith(mergedG->getNodeForValue(AI2));
+            ArgNodes[arg].mergeWith(mergedG->getNodeForValue(AI2));
 
         for ( ; AI2 != AI2end; ++AI2)
           if (DS::isPointerType(AI2->getType()))
-            GraphInfo.argNodes.push_back(mergedG->getNodeForValue(AI2));
+            ArgNodes.push_back(mergedG->getNodeForValue(AI2));
         DEBUG(mergedG->AssertGraphOK());
       }
     }


Index: poolalloc/lib/PoolAllocate/EquivClassGraphs.h
diff -u poolalloc/lib/PoolAllocate/EquivClassGraphs.h:1.8 poolalloc/lib/PoolAllocate/EquivClassGraphs.h:1.9
--- poolalloc/lib/PoolAllocate/EquivClassGraphs.h:1.8	Mon Nov  1 13:54:06 2004
+++ poolalloc/lib/PoolAllocate/EquivClassGraphs.h	Mon Nov  1 14:37:00 2004
@@ -28,18 +28,6 @@
 class Function;
 
 namespace PA {
-
-  /// EquivClassGraphArgsInfo - Information about the set of argument nodes 
-  /// in a DS graph (the number of argument nodes is the max of argument nodes
-  /// for all functions folded into the graph).
-  /// FIXME: This class is only used temporarily and could be eliminated.
-  ///  
-  struct EquivClassGraphArgsInfo {
-    const DSGraph* ECGraph;
-    std::vector<DSNodeHandle> argNodes;
-    EquivClassGraphArgsInfo() : ECGraph(NULL) {}
-  };
-
   /// EquivClassGraphs - This is the same as the complete bottom-up graphs, but
   /// with functions partitioned into equivalence classes and a single merged
   /// DS graph for all functions in an equivalence class.  After this merging,
@@ -61,10 +49,6 @@
     // same function pointer are in the same class.
     EquivalenceClasses<Function*> FuncECs;
 
-    // Each equivalence class graph contains several functions.
-    // Remember their argument nodes (and return nodes?)
-    std::map<const DSGraph*, EquivClassGraphArgsInfo> ECGraphInfo;
-    
     /// OneCalledFunction - For each indirect call, we keep track of one
     /// target of the call.  This is used to find equivalence class called by
     /// a call site.
@@ -112,16 +96,6 @@
       return FuncECs.getEqClass(leaderF);
     }
 
-    /// getECGraphInfo - Get the graph info object with arg nodes info
-    /// 
-    EquivClassGraphArgsInfo &getECGraphInfo(const DSGraph* G) {
-      assert(G != NULL && "getECGraphInfo: Null graph!");
-      EquivClassGraphArgsInfo& GraphInfo = ECGraphInfo[G];
-      if (GraphInfo.ECGraph == NULL)
-        GraphInfo.ECGraph = G;
-      return GraphInfo;
-    }
-
     DSGraph &getGlobalsGraph() const {
       return *GlobalsGraph;
     }





More information about the llvm-commits mailing list