LLVM API Documentation

Public Member Functions | Friends
llvm::BumpPtrAllocator Class Reference

#include <Allocator.h>

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 >
TAllocate ()
template<typename T >
TAllocate (size_t Num)
template<typename T >
TAllocate (size_t Num, size_t Alignment)
void Deallocate (const void *)
unsigned GetNumSlabs () const
void PrintStats () const
size_t getTotalMemory () const
 Compute the total physical memory allocated by this allocator.

Friends

class SpecificBumpPtrAllocator

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 90 of file Allocator.h.


Constructor & Destructor Documentation

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

Definition at line 24 of file Allocator.cpp.

llvm::BumpPtrAllocator::~BumpPtrAllocator ( )

Definition at line 29 of file Allocator.cpp.


Member Function Documentation

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 155 of file Allocator.h.

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 162 of file Allocator.h.

References Allocate().

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 169 of file Allocator.h.

References Allocate(), and T.

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

Definition at line 139 of file Allocator.cpp.

References llvm::MemSlab::NextPtr.

size_t llvm::BumpPtrAllocator::getTotalMemory ( ) const

Compute the total physical memory allocated by this allocator.

Definition at line 147 of file Allocator.cpp.

References llvm::MemSlab::NextPtr.

void llvm::BumpPtrAllocator::PrintStats ( ) const

Definition at line 155 of file Allocator.cpp.

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

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.

Definition at line 79 of file Allocator.cpp.

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

Referenced by llvm::SelectionDAG::clear(), llvm::SpecificBumpPtrAllocator< T >::DestroyAll(), llvm::yaml::Scanner::getNext(), llvm::LiveStacks::releaseMemory(), llvm::LiveIntervals::releaseMemory(), llvm::SlotIndexes::releaseMemory(), llvm::ScalarEvolution::releaseMemory(), and llvm::MCContext::reset().


Friends And Related Function Documentation

friend class SpecificBumpPtrAllocator [friend]

Definition at line 138 of file Allocator.h.


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