LLVM 24.0.0git
Allocator.cpp
Go to the documentation of this file.
1//===--- Allocator.cpp - Simple memory allocation abstraction -------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements the BumpPtrAllocator interface.
10//
11//===----------------------------------------------------------------------===//
12
16
17#include <atomic>
18
19namespace llvm {
20
21namespace detail {
22
23void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t TotalMemory) {
24 errs() << "\nNumber of memory regions: " << NumSlabs << '\n'
25 << "Bytes allocated: " << TotalMemory << '\n'
26 << " (includes alignment, etc)\n";
27}
28
29} // namespace detail
30
32 size_t Align,
33 size_t FreeListSize) {
34 errs() << "Recycler element size: " << Size << '\n'
35 << "Recycler element alignment: " << Align << '\n'
36 << "Number of elements free for recycling: " << FreeListSize << '\n';
37}
38
39namespace parallel::detail {
41 static std::atomic<unsigned> Counter;
42 return Counter.fetch_add(1, std::memory_order_relaxed);
43}
44} // namespace parallel::detail
45
46} // namespace llvm
This file defines the BumpPtrAllocator interface.
A self-contained host- and target-independent arbitrary-precision floating-point software implementat...
Definition ADL.h:123
LLVM_ABI void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t TotalMemory)
Definition Allocator.cpp:23
LLVM_ABI unsigned claimPerThreadAllocatorId()
Return a new process-unique PerThreadAllocator instance id.
Definition Allocator.cpp:40
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void PrintRecyclerStats(size_t Size, size_t Align, size_t FreeListSize)
PrintRecyclingAllocatorStats - Helper for RecyclingAllocator for printing statistics.
Definition Allocator.cpp:31
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39