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

Chris Lattner lattner at cs.uiuc.edu
Sun Feb 13 13:25:06 PST 2005



Changes in directory llvm-poolalloc/lib/PoolAllocate:

PointerCompress.cpp updated: 1.10 -> 1.11
---
Log message:

Implement transformation of pool frees.


---
Diffs of the changes:  (+10 -1)

 PointerCompress.cpp |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletion(-)


Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp
diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.10 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.11
--- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.10	Sun Feb 13 15:11:35 2005
+++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp	Sun Feb 13 15:24:53 2005
@@ -562,6 +562,7 @@
   new CallInst(PtrComp.PoolDestroyPC, Ops, "", &CI);
   CI.eraseFromParent();
 }
+
 void InstructionRewriter::visitPoolAlloc(CallInst &CI) {
   // Transform to poolalloc_pc if necessary.
   const CompressedPoolInfo *PI = getPoolInfo(&CI);
@@ -575,7 +576,15 @@
 }
 
 void InstructionRewriter::visitPoolFree(CallInst &CI) {
-  // Transform to poolfree_pc if necessary.
+  // Transform to poolfree_pc if the pool is compressed.
+  const CompressedPoolInfo *PI = getPoolInfo(CI.getOperand(2));
+  if (PI == 0) return;  // Not a free to a compressed pool.
+
+  std::vector<Value*> Ops;
+  Ops.push_back(CI.getOperand(1));
+  Ops.push_back(getTransformedValue(CI.getOperand(2)));
+  new CallInst(PtrComp.PoolFreePC, Ops, "", &CI);
+  CI.eraseFromParent();
 }
 
 void InstructionRewriter::visitCallInst(CallInst &CI) {






More information about the llvm-commits mailing list