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

Chris Lattner lattner at cs.uiuc.edu
Tue Feb 15 10:53:07 PST 2005



Changes in directory llvm-poolalloc/lib/PoolAllocate:

PoolAllocate.cpp updated: 1.103 -> 1.104
---
Log message:

Make sure that pool descriptors for global pools end up in DSGraphs.


---
Diffs of the changes:  (+13 -3)

 PoolAllocate.cpp |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)


Index: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp
diff -u llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.103 llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.104
--- llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.103	Mon Feb 14 17:08:52 2005
+++ llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp	Tue Feb 15 12:52:51 2005
@@ -430,6 +430,9 @@
   return false;
 }
 
+/// CreateGlobalPool - Create a global pool descriptor object, and insert a
+/// poolinit for it into main.  IPHint is an instruction that we should insert
+/// the poolinit before if not null.
 GlobalVariable *PoolAllocate::CreateGlobalPool(unsigned RecSize, unsigned Align,
                                                Instruction *IPHint) {
   GlobalVariable *GV =
@@ -437,6 +440,10 @@
                        Constant::getNullValue(PoolDescType), "GlobalPool",
                        CurModule);
 
+  // Update the global DSGraph to include this.
+  DSNode *GNode = ECGraphs->getGlobalsGraph().addObjectToGraph(GV);
+  GNode->setModifiedMarker()->setReadMarker();
+
   Function *MainFunc = CurModule->getMainFunction();
   assert(MainFunc && "No main in program??");
 
@@ -491,13 +498,16 @@
         PoolDesc = new AllocaInst(PoolDescType, 0, "PD", InsertPoint);
 
         // Create a node in DSG to represent the new alloca.
-        DSNode *NewNode = new DSNode(PoolDescType, &DSG);
-        NewNode->setAllocaNodeMarker();  // This is a stack object.
+        DSNode *NewNode = DSG.addObjectToGraph(PoolDesc);
         NewNode->setModifiedMarker()->setReadMarker();  // This is M/R
-        DSG.getNodeForValue(PoolDesc) = NewNode;
       } else {
         PoolDesc = CreateGlobalPool(Pool.PoolSize, Pool.PoolAlignment,
                                     InsertPoint);
+
+        // Add the global node to main's graph.
+        DSNode *NewNode = DSG.addObjectToGraph(PoolDesc);
+        NewNode->setModifiedMarker()->setReadMarker();  // This is M/R
+
         if (Pool.NodesInPool.size() == 1 &&
             !Pool.NodesInPool[0]->isNodeCompletelyFolded())
           ++NumTSPools;






More information about the llvm-commits mailing list