LLVM
15.0.0git
lib
Support
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
17
#ifndef NDEBUG
18
#include "
llvm/Support/raw_ostream.h
"
19
#endif // ifndef NDEBUG
20
21
// Include the platform-specific parts of this class.
22
#ifdef LLVM_ON_UNIX
23
#include "
Unix/Memory.inc
"
24
#endif
25
#ifdef _WIN32
26
#include "
Windows/Memory.inc
"
27
#endif
28
29
#ifndef NDEBUG
30
31
namespace
llvm
{
32
namespace
sys {
33
34
raw_ostream
&
operator<<
(
raw_ostream
&OS,
const
Memory::ProtectionFlags
&PF) {
35
assert
((PF & ~(
Memory::MF_READ
|
Memory::MF_WRITE
|
Memory::MF_EXEC
)) == 0 &&
36
"Unrecognized flags"
);
37
38
return
OS << (PF &
Memory::MF_READ
?
'R'
:
'-'
)
39
<< (PF &
Memory::MF_WRITE
?
'W'
:
'-'
)
40
<< (PF &
Memory::MF_EXEC
?
'X'
:
'-'
);
41
}
42
43
raw_ostream
&
operator<<
(
raw_ostream
&OS,
const
MemoryBlock
&MB) {
44
return
OS <<
"[ "
<< MB.
base
() <<
" .. "
45
<< (
void
*)((
char
*)MB.
base
() + MB.
allocatedSize
()) <<
" ] ("
46
<< MB.
allocatedSize
() <<
" bytes)"
;
47
}
48
49
}
// end namespace sys
50
}
// end namespace llvm
51
52
#endif // ifndef NDEBUG
llvm::sys::Memory::MF_READ
@ MF_READ
Definition:
Memory.h:55
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:
AddressRanges.h:17
llvm::sys::Memory::MF_WRITE
@ MF_WRITE
Definition:
Memory.h:56
llvm::sys::MemoryBlock
This class encapsulates the notion of a memory block which has an address and a size.
Definition:
Memory.h:31
Memory.inc
llvm::sys::Memory::ProtectionFlags
ProtectionFlags
Definition:
Memory.h:54
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition:
raw_ostream.h:54
llvm::sys::MemoryBlock::base
void * base() const
Definition:
Memory.h:36
llvm::sys::MemoryBlock::allocatedSize
size_t allocatedSize() const
The size as it was allocated.
Definition:
Memory.h:39
llvm::sys::Memory::MF_EXEC
@ MF_EXEC
Definition:
Memory.h:57
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Memory.h
llvm::sys::operator<<
raw_ostream & operator<<(raw_ostream &OS, const Memory::ProtectionFlags &PF)
Debugging output for Memory::ProtectionFlags.
Definition:
Memory.cpp:34
raw_ostream.h
Memory.inc
Generated on Fri May 27 2022 03:35:32 for LLVM by
1.8.17