14#ifndef LLVM_SUPPORT_ARRAYRECYCLER_H
15#define LLVM_SUPPORT_ARRAYRECYCLER_H
35 static_assert(
Align >=
alignof(FreeList),
"Object underaligned");
36 static_assert(
sizeof(
T) >=
sizeof(FreeList),
"Objects are too small");
43 T *pop(
unsigned Idx) {
46 FreeList *Entry = Bucket[
Idx];
50 Bucket[
Idx] = Entry->Next;
52 return reinterpret_cast<T*
>(Entry);
56 void push(
unsigned Idx,
T *
Ptr) {
57 assert(
Ptr &&
"Cannot recycle NULL pointer");
58 FreeList *Entry =
reinterpret_cast<FreeList*
>(
Ptr);
61 Entry->Next = Bucket[
Idx];
98 assert(Bucket.
empty() &&
"Non-empty ArrayRecycler deleted!");
103 template<
class AllocatorType>
106 while (
T *
Ptr = pop(Bucket.
size() - 1))
124 template<
class AllocatorType>
This file defines the BumpPtrAllocator interface.
#define __asan_poison_memory_region(p, size)
#define __asan_unpoison_memory_region(p, size)
#define __msan_allocated_memory(p, size)
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
static unsigned getSize(unsigned Kind)
The size of an allocated array is represented by a Capacity instance.
Capacity getNext() const
Get the next larger capacity.
size_t getSize() const
Get the number of elements in an array with this capacity.
static Capacity get(size_t N)
Get the capacity of an array that can hold at least N elements.
unsigned getBucket() const
Get the bucket number for this capacity.
Recycle small arrays allocated from a BumpPtrAllocator.
T * allocate(Capacity Cap, AllocatorType &Allocator)
Allocate an array of at least the requested capacity.
void clear(BumpPtrAllocator &)
Special case for BumpPtrAllocator which has an empty Deallocate() function.
void clear(AllocatorType &Allocator)
Release all the tracked allocations to the allocator.
void deallocate(Capacity Cap, T *Ptr)
Deallocate an array with the specified Capacity.
Allocate memory in an ever growing pool, as if by bump-pointer.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This is an optimization pass for GlobalISel generic memory operations.
unsigned Log2_64_Ceil(uint64_t Value)
Return the ceil log base 2 of the specified value, 64 if the value is zero.
This struct is a compact representation of a valid (non-zero power of two) alignment.