diff options
author | Chris Lattner <sabre@nondot.org> | 2002-03-29 06:21:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-03-29 06:21:38 +0000 |
commit | 66df97d436402a4ff35b838fb072b3142b5d681e (patch) | |
tree | 2d45250b6d0900cadfb385e16fd1d6f53623da49 /llvm/lib | |
parent | e0618ca2bd74bfb7d8a455b815d25b3c54ffdcdb (diff) | |
download | bcm5719-llvm-66df97d436402a4ff35b838fb072b3142b5d681e.tar.gz bcm5719-llvm-66df97d436402a4ff35b838fb072b3142b5d681e.zip |
Modularize code a bit
llvm-svn: 2040
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/IPO/OldPoolAllocate.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/OldPoolAllocate.cpp b/llvm/lib/Transforms/IPO/OldPoolAllocate.cpp index 64616cd8fb6..9671c8049dd 100644 --- a/llvm/lib/Transforms/IPO/OldPoolAllocate.cpp +++ b/llvm/lib/Transforms/IPO/OldPoolAllocate.cpp @@ -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; } |