]>
git.proxmox.com Git - rustc.git/blob - src/llvm/lib/Support/Allocator.cpp
1 //===--- Allocator.cpp - Simple memory allocation abstraction -------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the BumpPtrAllocator interface.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/Support/Allocator.h"
15 #include "llvm/Support/Compiler.h"
16 #include "llvm/Support/DataTypes.h"
17 #include "llvm/Support/Memory.h"
18 #include "llvm/Support/Recycler.h"
19 #include "llvm/Support/raw_ostream.h"
26 void printBumpPtrAllocatorStats(unsigned NumSlabs
, size_t BytesAllocated
,
28 errs() << "\nNumber of memory regions: " << NumSlabs
<< '\n'
29 << "Bytes used: " << BytesAllocated
<< '\n'
30 << "Bytes allocated: " << TotalMemory
<< '\n'
31 << "Bytes wasted: " << (TotalMemory
- BytesAllocated
)
32 << " (includes alignment, etc)\n";
35 } // End namespace detail.
37 void PrintRecyclerStats(size_t Size
,
39 size_t FreeListSize
) {
40 errs() << "Recycler element size: " << Size
<< '\n'
41 << "Recycler element alignment: " << Align
<< '\n'
42 << "Number of elements free for recycling: " << FreeListSize
<< '\n';