Modularize code a bit

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2040 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2002-03-29 06:21:38 +00:00
parent 54ce13f983
commit 9d89190434

View 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;
}