[llvm-commits] CVS: llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp

Andrew Lenharth alenhar2 at cs.uiuc.edu
Thu Feb 16 07:50:31 PST 2006



Changes in directory llvm-poolalloc/runtime/FL2Allocator:

PoolAllocator.cpp updated: 1.50 -> 1.51
---
Log message:

some programs call memalign, so there should be one

---
Diffs of the changes:  (+7 -0)

 PoolAllocator.cpp |    7 +++++++
 1 files changed, 7 insertions(+)


Index: llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp
diff -u llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp:1.50 llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp:1.51
--- llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp:1.50	Fri May 27 15:46:20 2005
+++ llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp	Thu Feb 16 09:50:09 2006
@@ -854,6 +854,13 @@
   return poolalloc_internal(Pool, NumBytes);
 }
 
+void *poolmemalign(PoolTy<NormalPoolTraits> *Pool,
+                   unsigned Alignment, unsigned NumBytes) {
+  //punt and use pool alloc.
+  //I don't know if this is safe or breaks any assumptions in the runtime
+  intptr_t base = (intptr_t)poolalloc_internal(Pool, NumBytes + Alignment - 1);
+  return (void*)((base + (Alignment - 1)) & ~((intptr_t)Alignment -1));
+}
 
 void poolfree(PoolTy<NormalPoolTraits> *Pool, void *Node) {
   DO_IF_FORCE_MALLOCFREE(free(Node); return);






More information about the llvm-commits mailing list