GTIRB  v2.1.0
GrammaTech Intermediate Representation for Binaries: C++ API
Classes | Typedefs | Functions
Allocator.hpp File Reference
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <iterator>
#include <utility>
#include <vector>
Include dependency graph for Allocator.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  BumpPtrAllocatorImpl< SlabSize, SizeThreshold >
 
class  SpecificBumpPtrAllocator< T >
 

Typedefs

typedef BumpPtrAllocatorImpl BumpPtrAllocator
 

Functions

uintptr_t alignAddr (const void *Addr, size_t Alignment)
 
size_t alignmentAdjustment (const void *Ptr, size_t Alignment)
 
constexpr bool isPowerOf2_64 (uint64_t Value)
 Return true if the argument is a power of two > 0 (64 bit edition.) More...
 
uint64_t NextPowerOf2 (uint64_t A)
 
template<size_t SlabSize, size_t SizeThreshold>
void operator delete (void *, BumpPtrAllocatorImpl< SlabSize, SizeThreshold > &)
 
template<size_t SlabSize, size_t SizeThreshold>
void * operator new (size_t Size, BumpPtrAllocatorImpl< SlabSize, SizeThreshold > &Allocator)
 

Typedef Documentation

◆ BumpPtrAllocator

The standard BumpPtrAllocator which just uses the default template parameters.

Function Documentation

◆ alignAddr()

uintptr_t alignAddr ( const void *  Addr,
size_t  Alignment 
)
inline

Aligns Addr to Alignment bytes, rounding up.

Alignment should be a power of two. This method rounds up, so alignAddr(7, 4) == 8 and alignAddr(8, 4) == 8.

◆ alignmentAdjustment()

size_t alignmentAdjustment ( const void *  Ptr,
size_t  Alignment 
)
inline

Returns the necessary adjustment for aligning Ptr to Alignment bytes, rounding up.

◆ isPowerOf2_64()

constexpr bool isPowerOf2_64 ( uint64_t  Value)
inlineconstexpr

Return true if the argument is a power of two > 0 (64 bit edition.)

◆ NextPowerOf2()

uint64_t NextPowerOf2 ( uint64_t  A)
inline

Returns the next power of two (in 64-bits) that is strictly greater than A. Returns zero on overflow.

◆ operator delete()

template<size_t SlabSize, size_t SizeThreshold>
void operator delete ( void *  ,
BumpPtrAllocatorImpl< SlabSize, SizeThreshold > &   
)

◆ operator new()

template<size_t SlabSize, size_t SizeThreshold>
void* operator new ( size_t  Size,
BumpPtrAllocatorImpl< SlabSize, SizeThreshold > &  Allocator 
)