[llvm-commits] CVS: poolalloc/lib/PoolAllocate/PoolAllocate.cpp PoolAllocate.h
Chris Lattner
lattner at cs.uiuc.edu
Tue Nov 9 12:25:49 PST 2004
Changes in directory poolalloc/lib/PoolAllocate:
PoolAllocate.cpp updated: 1.89 -> 1.90
PoolAllocate.h updated: 1.29 -> 1.30
---
Log message:
Tidy up code generated by pool allocator a bit to insert poolinit's in order
instead of in reverse order.
---
Diffs of the changes: (+14 -9)
Index: poolalloc/lib/PoolAllocate/PoolAllocate.cpp
diff -u poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.89 poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.90
--- poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.89 Tue Nov 9 14:16:25 2004
+++ poolalloc/lib/PoolAllocate/PoolAllocate.cpp Tue Nov 9 14:25:39 2004
@@ -389,12 +389,8 @@
return true;
}
- BasicBlock::iterator InsertPt = MainFunc->getEntryBlock().begin();
- while (isa<AllocaInst>(InsertPt)) ++InsertPt;
-
TargetData &TD = getAnalysis<TargetData>();
-
std::cerr << "Pool allocating " << GlobalHeapNodes.size()
<< " global nodes!\n";
@@ -403,12 +399,15 @@
std::vector<Heuristic::OnePool> ResultPools;
CurHeuristic->AssignToPools(NodesToPA, 0, GG, ResultPools);
+ BasicBlock::iterator InsertPt = MainFunc->getEntryBlock().begin();
+ while (isa<AllocaInst>(InsertPt)) ++InsertPt;
+
// Perform all global assignments as specified.
for (unsigned i = 0, e = ResultPools.size(); i != e; ++i) {
Heuristic::OnePool &Pool = ResultPools[i];
Value *PoolDesc = Pool.PoolDesc;
if (PoolDesc == 0) {
- PoolDesc = CreateGlobalPool(Pool.PoolSize);
+ PoolDesc = CreateGlobalPool(Pool.PoolSize, InsertPt);
if (Pool.NodesInPool.size() == 1 &&
!Pool.NodesInPool[0]->isNodeCompletelyFolded())
@@ -430,7 +429,8 @@
return false;
}
-GlobalVariable *PoolAllocate::CreateGlobalPool(unsigned RecSize) {
+GlobalVariable *PoolAllocate::CreateGlobalPool(unsigned RecSize,
+ Instruction *IPHint) {
GlobalVariable *GV =
new GlobalVariable(PoolDescType, false, GlobalValue::InternalLinkage,
Constant::getNullValue(PoolDescType), "GlobalPool",
@@ -439,8 +439,13 @@
Function *MainFunc = CurModule->getMainFunction();
assert(MainFunc && "No main in program??");
- BasicBlock::iterator InsertPt = MainFunc->getEntryBlock().begin();
- while (isa<AllocaInst>(InsertPt)) ++InsertPt;
+ BasicBlock::iterator InsertPt;
+ if (IPHint)
+ InsertPt = IPHint;
+ else {
+ InsertPt = MainFunc->getEntryBlock().begin();
+ while (isa<AllocaInst>(InsertPt)) ++InsertPt;
+ }
unsigned Alignment = 0;
Value *ElSize = ConstantUInt::get(Type::UIntTy, RecSize);
Index: poolalloc/lib/PoolAllocate/PoolAllocate.h
diff -u poolalloc/lib/PoolAllocate/PoolAllocate.h:1.29 poolalloc/lib/PoolAllocate/PoolAllocate.h:1.30
--- poolalloc/lib/PoolAllocate/PoolAllocate.h:1.29 Mon Nov 8 00:18:07 2004
+++ poolalloc/lib/PoolAllocate/PoolAllocate.h Tue Nov 9 14:25:39 2004
@@ -137,7 +137,7 @@
/// CreateGlobalPool - Create a global pool descriptor, initialize it in main,
/// and return a pointer to the global for it.
- GlobalVariable *CreateGlobalPool(unsigned RecSize);
+ GlobalVariable *CreateGlobalPool(unsigned RecSize, Instruction *IPHint = 0);
private:
More information about the llvm-commits
mailing list