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

Chris Lattner lattner at cs.uiuc.edu
Wed Feb 9 11:04:58 PST 2005



Changes in directory poolalloc/lib/PoolAllocate:

PoolAllocate.h updated: 1.38 -> 1.39
PoolAllocate.cpp updated: 1.101 -> 1.102

---
Log message:

When pool allocating, make sure the DSGraph's are kept up-to-date to reflect
new pool descriptors added to the program.


---
Diffs of the changes:  (+12 -5)

Index: poolalloc/lib/PoolAllocate/PoolAllocate.h
diff -u poolalloc/lib/PoolAllocate/PoolAllocate.h:1.38 poolalloc/lib/PoolAllocate/PoolAllocate.h:1.39
--- poolalloc/lib/PoolAllocate/PoolAllocate.h:1.38	Tue Feb  8 18:09:56 2005
+++ poolalloc/lib/PoolAllocate/PoolAllocate.h	Wed Feb  9 13:04:47 2005
@@ -208,7 +208,8 @@
   /// pools specified in the NodesToPA list.  This adds an entry to the
   /// PoolDescriptors map for each DSNode.
   ///
-  void CreatePools(Function &F, const std::vector<const DSNode*> &NodesToPA,
+  void CreatePools(Function &F, DSGraph &G, 
+                   const std::vector<const DSNode*> &NodesToPA,
                    std::map<const DSNode*, Value*> &PoolDescriptors);
   
   void TransformBody(DSGraph &g, PA::FuncInfo &fi,


Index: poolalloc/lib/PoolAllocate/PoolAllocate.cpp
diff -u poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.101 poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.102
--- poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.101	Tue Feb  8 18:09:56 2005
+++ poolalloc/lib/PoolAllocate/PoolAllocate.cpp	Wed Feb  9 13:04:48 2005
@@ -463,7 +463,7 @@
 // the DSNodes specified by the NodesToPA list.  This adds an entry to the
 // PoolDescriptors map for each DSNode.
 //
-void PoolAllocate::CreatePools(Function &F,
+void PoolAllocate::CreatePools(Function &F, DSGraph &DSG,
                                const std::vector<const DSNode*> &NodesToPA,
                                std::map<const DSNode*,
                                         Value*> &PoolDescriptors) {
@@ -489,9 +489,15 @@
     if (PoolDesc == 0) {
       // Create a pool descriptor for the pool.  The poolinit will be inserted
       // later.
-      if (!IsMain)
+      if (!IsMain) {
         PoolDesc = new AllocaInst(PoolDescType, 0, "PD", InsertPoint);
-      else {
+
+        // Create a node in DSG to represent the new alloca.
+        DSNode *NewNode = new DSNode(PoolDescType, &DSG);
+        NewNode->setAllocaNodeMarker();  // This is a stack object.
+        NewNode->setModifiedMarker()->setReadMarker();  // This is M/R
+        DSG.getNodeForValue(PoolDesc) = NewNode;
+      } else {
         PoolDesc = CreateGlobalPool(Pool.PoolSize, Pool.PoolAlignment,
                                     InsertPoint);
         if (Pool.NodesInPool.size() == 1 &&
@@ -560,7 +566,7 @@
   if (!FI.NodesToPA.empty()) {
     std::cerr << "[" << F.getName() << "] " << FI.NodesToPA.size()
               << " nodes pool allocatable\n";
-    CreatePools(NewF, FI.NodesToPA, FI.PoolDescriptors);
+    CreatePools(NewF, G, FI.NodesToPA, FI.PoolDescriptors);
   } else {
     DEBUG(std::cerr << "[" << F.getName() << "] transforming body.\n");
   }





More information about the llvm-commits mailing list