LLVM  10.0.0svn
Memory.cpp
Go to the documentation of this file.
1 //===- Memory.cpp - Memory Handling Support ---------------------*- C++ -*-===//
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 defines some helpful functions for allocating memory and dealing
10 // with memory mapped files
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "llvm/Support/Memory.h"
15 #include "llvm/Config/llvm-config.h"
16 #include "llvm/Support/Valgrind.h"
17 
18 #ifndef NDEBUG
20 #endif // ifndef NDEBUG
21 
22 // Include the platform-specific parts of this class.
23 #ifdef LLVM_ON_UNIX
24 #include "Unix/Memory.inc"
25 #endif
26 #ifdef _WIN32
27 #include "Windows/Memory.inc"
28 #endif
29 
30 #ifndef NDEBUG
31 
32 namespace llvm {
33 namespace sys {
34 
37  "Unrecognized flags");
38 
39  return OS << (PF & Memory::MF_READ ? 'R' : '-')
40  << (PF & Memory::MF_WRITE ? 'W' : '-')
41  << (PF & Memory::MF_EXEC ? 'X' : '-');
42 }
43 
45  return OS << "[ " << MB.base() << " .. "
46  << (void *)((char *)MB.base() + MB.allocatedSize()) << " ] ("
47  << MB.allocatedSize() << " bytes)";
48 }
49 
50 } // end namespace sys
51 } // end namespace llvm
52 
53 #endif // ifndef NDEBUG
This class represents lattice values for constants.
Definition: AllocatorList.h:23
size_t allocatedSize() const
The size as it was allocated.
Definition: Memory.h:40
void * base() const
Definition: Memory.h:37
This class encapsulates the notion of a memory block which has an address and a size.
Definition: Memory.h:32
raw_ostream & operator<<(raw_ostream &OS, const Memory::ProtectionFlags &PF)
Debugging output for Memory::ProtectionFlags.
Definition: Memory.cpp:35
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45