Modularize code a bit
authorChris Lattner <sabre@nondot.org>
Fri, 29 Mar 2002 06:21:38 +0000 (06:21 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 29 Mar 2002 06:21:38 +0000 (06:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2040 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/OldPoolAllocate.cpp

index 64616cd8fb649d745fad51be2c4a994de580a619..9671c8049ddcb2736b03edec303dcd86c63873ed 100644 (file)
@@ -66,6 +66,15 @@ namespace {
     //
     void addPoolPrototypes(Module *M);
 
+
+    // CreatePools - Insert instructions into the function we are processing to
+    // create all of the memory pool objects themselves.  This also inserts
+    // destruction code.  Add an alloca for each pool that is allocated to the
+    // PoolDescriptors vector.
+    //
+    void CreatePools(Function *F, const vector<AllocDSNode*> &Allocs,
+                     vector<AllocaInst*> &PoolDescriptors);
+
     // processFunction - Convert a function to use pool allocation where
     // available.
     //
@@ -143,6 +152,22 @@ bool PoolAllocate::processFunction(Function *F) {
   for (unsigned i = 0, e = Scalars.size(); i != e; ++i)
     Scalars[i].first->dump();
 
+  // Insert instructions into the function we are processing to create all of
+  // the memory pool objects themselves.  This also inserts destruction code.
+  vector<AllocaInst*> PoolDescriptors;
+  CreatePools(F, Allocs, PoolDescriptors);
+
+  return true;
+}
+
+
+// CreatePools - Insert instructions into the function we are processing to
+// create all of the memory pool objects themselves.  This also inserts
+// destruction code.  Add an alloca for each pool that is allocated to the
+// PoolDescriptors vector.
+//
+void PoolAllocate::CreatePools(Function *F, const vector<AllocDSNode*> &Allocs,
+                               vector<AllocaInst*> &PoolDescriptors) {
   // FIXME: This should use an IP version of the UnifyAllExits pass!
   vector<BasicBlock*> ReturnNodes;
   for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I)
@@ -187,8 +212,6 @@ bool PoolAllocate::processFunction(Function *F) {
   F->getEntryNode()->getInstList().insert(F->getEntryNode()->begin()+1,
                                           EntryNodeInsts.begin(),
                                           EntryNodeInsts.end());
-
-  return false;
 }