LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Friends | List of all members
llvm::BumpPtrAllocator Class Reference

#include <Allocator.h>

Public Member Functions

 BumpPtrAllocator (size_t size=4096, size_t threshold=4096)
 
 BumpPtrAllocator (size_t size, size_t threshold, SlabAllocator &allocator)
 
 ~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. More...
 

Friends

template<typename T >
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 
)

Definition at line 29 of file Allocator.cpp.

llvm::BumpPtrAllocator::BumpPtrAllocator ( size_t  size,
size_t  threshold,
SlabAllocator allocator 
)

Definition at line 24 of file Allocator.cpp.

llvm::BumpPtrAllocator::~BumpPtrAllocator ( )

Definition at line 33 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 156 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 163 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 170 of file Allocator.h.

References Allocate(), and T.

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

Definition at line 176 of file Allocator.h.

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

unsigned llvm::BumpPtrAllocator::GetNumSlabs ( ) const

Definition at line 143 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 151 of file Allocator.cpp.

References llvm::MemSlab::NextPtr.

void llvm::BumpPtrAllocator::PrintStats ( ) const

Definition at line 159 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 83 of file Allocator.cpp.

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

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

Friends And Related Function Documentation

template<typename T >
friend class SpecificBumpPtrAllocator
friend

Definition at line 139 of file Allocator.h.


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