| 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 | |
| 13 | #include "llvm/Support/Allocator.h" |
| 14 | #include "llvm/Support/raw_ostream.h" |
| 15 | |
| 16 | namespace llvm { |
| 17 | |
| 18 | namespace detail { |
| 19 | |
| 20 | void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t TotalMemory) { |
| 21 | errs() << "\nNumber of memory regions: " << NumSlabs << '\n' |
| 22 | << "Bytes allocated: " << TotalMemory << '\n' |
| 23 | << " (includes alignment, etc)\n" ; |
| 24 | } |
| 25 | |
| 26 | } // namespace detail |
| 27 | |
| 28 | void PrintRecyclerStats(size_t Size, |
| 29 | size_t Align, |
| 30 | size_t FreeListSize) { |
| 31 | errs() << "Recycler element size: " << Size << '\n' |
| 32 | << "Recycler element alignment: " << Align << '\n' |
| 33 | << "Number of elements free for recycling: " << FreeListSize << '\n'; |
| 34 | } |
| 35 | |
| 36 | } // namespace llvm |
| 37 | |