14#ifndef LLVM_SUPPORT_RECYCLER_H
15#define LLVM_SUPPORT_RECYCLER_H
33template <
class T,
size_t Size = sizeof(T),
size_t Align = alignof(T)>
40 FreeNode *FreeList =
nullptr;
45 FreeList = FreeList->Next;
50 void push(FreeNode *
N) {
61 assert(!FreeList &&
"Non-empty recycler deleted!");
67 template<
class AllocatorType>
70 T *t =
reinterpret_cast<T *
>(pop_val());
82 template<
class SubClass,
class AllocatorType>
84 static_assert(
alignof(SubClass) <=
Align,
85 "Recycler allocation alignment is less than object align!");
86 static_assert(
sizeof(SubClass) <=
Size,
87 "Recycler allocation size is less than object size!");
88 return FreeList ?
reinterpret_cast<SubClass *
>(pop_val())
92 template<
class AllocatorType>
97 template<
class SubClass,
class AllocatorType>
99 push(
reinterpret_cast<FreeNode *
>(Element));
105template <
class T,
size_t Size,
size_t Align>
108 for (
auto *
I = FreeList;
I;
I =
I->Next)
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)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Allocate memory in an ever growing pool, as if by bump-pointer.
Recycler - This class manages a linked-list of deallocated nodes and facilitates reusing deallocated ...
void clear(BumpPtrAllocator &)
Special case for BumpPtrAllocator which has an empty Deallocate() function.
void clear(AllocatorType &Allocator)
clear - Release all the tracked allocations to the allocator.
void Deallocate(AllocatorType &, SubClass *Element)
SubClass * Allocate(AllocatorType &Allocator)
T * Allocate(AllocatorType &Allocator)
This file defines classes to implement an intrusive doubly linked list class (i.e.
This is an optimization pass for GlobalISel generic memory operations.
void PrintRecyclerStats(size_t Size, size_t Align, size_t FreeListSize)
PrintRecyclingAllocatorStats - Helper for RecyclingAllocator for printing statistics.
This struct is a compact representation of a valid (non-zero power of two) alignment.