I'll preface by saying I'm new to LLVM - I noticed there is an efficient BumpPtrAllocator - however, I can't figure out how I can allocate IR objects using that allocator. It looks like all the factory methods use regular new/delete. I'm sure someone BumpPtrAllocator is there for a good reason, and someone here has thought of this use case before. Anyone want to comment? Is this a bad idea? Do the optimization passes generate a ton of garbage that needs to be cleaned up immediately? Or would it be reasonably safe to use the BumpPtrAllocator during IR creation, optimization, and codegen, and just delete all the garbage when done with codegen? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080716/4d893b32/attachment.html>
On Jul 16, 2008, at 10:12 AM, Jonathan Brumley wrote:> > I'll preface by saying I'm new to LLVM - > > I noticed there is an efficient BumpPtrAllocator - however, I can't > figure out how I can allocate IR objects using that allocator. It > looks like all the factory methods use regular new/delete. > > I'm sure someone BumpPtrAllocator is there for a good reason, and > someone here has thought of this use case before. Anyone want to > comment? Is this a bad idea? Do the optimization passes generate a > ton of garbage that needs to be cleaned up immediately? > > Or would it be reasonably safe to use the BumpPtrAllocator during IR > creation, optimization, and codegen, and just delete all the garbage > when done with codegen?Unfortunately, LLVM IR objects don't allow you to allocate them with a custom allocator right now, sorry! Generally optimization passes produce transient data from maps on the side and other data structures they build. This sort of data *is* very useful to use an allocator for. -Chris
Apparently Analagous Threads
- Identifying objects within BumpPtrAllocator.
- [cfe-dev] Identifying objects within BumpPtrAllocator.
- [LLVMdev] Static destructor problem with recent HEAD
- [LLVMdev] Static destructor problem with recent HEAD
- [LLVMdev] RFC: Reduce the memory footprint of DIEs (and DIEValues)