LLVM: include/llvm/Support/RecyclingAllocator.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_SUPPORT_RECYCLINGALLOCATOR_H

15#define LLVM_SUPPORT_RECYCLINGALLOCATOR_H

16

18

19namespace llvm {

20

21

22

23

24template <class AllocatorType, class T, size_t Size = sizeof(T),

25 size_t Align = alignof(T)>

27private:

28

29

31

32

33

34 AllocatorType Allocator;

35

36public:

38

39

40

41

42 template

44

45 T *Allocate() { return Base.Allocate(Allocator); }

46

47

48

49

50 template

51 void Deallocate(SubClass* E) { return Base.Deallocate(Allocator, E); }

52

54 Allocator.PrintStats();

55 Base.PrintStats();

56 }

57};

58

59}

60

61template<class AllocatorType, class T, size_t Size, size_t Align>

62inline void *operator new(size_t size,

65 assert(size <= Size && "allocation size exceeded");

67}

68

69template<class AllocatorType, class T, size_t Size, size_t Align>

70inline void operator delete(void *E,

73 A.Deallocate(E);

74}

75

76#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

Recycler - This class manages a linked-list of deallocated nodes and facilitates reusing deallocated ...

RecyclingAllocator - This class wraps an Allocator, adding the functionality of recycling deleted obj...

Definition RecyclingAllocator.h:26

SubClass * Allocate()

Allocate - Return a pointer to storage for an object of type SubClass.

Definition RecyclingAllocator.h:43

~RecyclingAllocator()

Definition RecyclingAllocator.h:37

void Deallocate(SubClass *E)

Deallocate - Release storage for the pointed-to object.

Definition RecyclingAllocator.h:51

T * Allocate()

Definition RecyclingAllocator.h:45

void PrintStats()

Definition RecyclingAllocator.h:53

This is an optimization pass for GlobalISel generic memory operations.

This struct is a compact representation of a valid (non-zero power of two) alignment.