LLVM API Documentation

llvm::BumpPtrAllocator Class Reference

#include <Allocator.h>

Collaboration diagram for llvm::BumpPtrAllocator:
[legend]

List of all members.

Public Member Functions

 BumpPtrAllocator (size_t size=4096, size_t threshold=4096, SlabAllocator &allocator=DefaultSlabAllocator)
 ~BumpPtrAllocator ()
void Reset ()
void * Allocate (size_t Size, size_t Alignment)
template<typename T>
T * Allocate ()
template<typename T>
T * Allocate (size_t Num)
template<typename T>
T * Allocate (size_t Num, size_t Alignment)
void Deallocate (const void *)
unsigned GetNumSlabs () const
void PrintStats () const


Detailed Description

BumpPtrAllocator - This allocator is useful for containers that need very simple memory allocation strategies. In particular, this just keeps allocating memory, and never deletes it until the entire block is dead. This makes allocation speedy, but must only be used when the trade-off is ok.

Definition at line 85 of file Allocator.h.


Constructor & Destructor Documentation

llvm::BumpPtrAllocator::BumpPtrAllocator ( size_t  size = 4096,
size_t  threshold = 4096,
SlabAllocator &  allocator = DefaultSlabAllocator 
)

Definition at line 23 of file Allocator.cpp.

llvm::BumpPtrAllocator::~BumpPtrAllocator (  ) 

Definition at line 30 of file Allocator.cpp.


Member Function Documentation

void llvm::BumpPtrAllocator::Reset (  ) 

Reset - Deallocate all but the current slab and reset the current pointer to the beginning of it, freeing all memory allocated so far.

Reset - Deallocate all but the current slab and reset the current pointer to the beginning of it, freeing all memory allocated so far.

Definition at line 74 of file Allocator.cpp.

References llvm::MemSlab::NextPtr, and llvm::MemSlab::Size.

Referenced by llvm::SelectionDAG::clear(), llvm::ScalarEvolution::releaseMemory(), llvm::LiveIntervals::releaseMemory(), llvm::LiveStacks::releaseMemory(), and llvm::LoopDependenceAnalysis::releaseMemory().

void * llvm::BumpPtrAllocator::Allocate ( size_t  Size,
size_t  Alignment 
)

template<typename T>
T* llvm::BumpPtrAllocator::Allocate (  )  [inline]

Allocate space, but do not construct, one object.

Definition at line 149 of file Allocator.h.

References T.

Referenced by Allocate().

template<typename T>
T* llvm::BumpPtrAllocator::Allocate ( size_t  Num  )  [inline]

Allocate space for an array of objects. This does not construct the objects though.

Definition at line 156 of file Allocator.h.

References Allocate(), and T.

template<typename T>
T* llvm::BumpPtrAllocator::Allocate ( size_t  Num,
size_t  Alignment 
) [inline]

Allocate space for a specific count of elements and with a specified alignment.

Definition at line 163 of file Allocator.h.

References Allocate(), and T.

void llvm::BumpPtrAllocator::Deallocate ( const void *   )  [inline]

Definition at line 169 of file Allocator.h.

Referenced by llvm::MachineFunction::~MachineFunction().

unsigned llvm::BumpPtrAllocator::GetNumSlabs (  )  const

Definition at line 122 of file Allocator.cpp.

References llvm::MemSlab::NextPtr.

void llvm::BumpPtrAllocator::PrintStats (  )  const

Definition at line 130 of file Allocator.cpp.

References llvm::errs(), and llvm::MemSlab::NextPtr.


The documentation for this class was generated from the following files: