14#ifndef LLVM_EXECUTIONENGINE_ORC_SHARED_MEMORYFLAGS_H
15#define LLVM_EXECUTIONENGINE_ORC_SHARED_MEMORYFLAGS_H
45 std::underlying_type_t<sys::Memory::ProtectionFlags> PF = 0;
96 using underlying_type = uint8_t;
97 static constexpr unsigned BitsForProt = 3;
98 static constexpr unsigned BitsForDeallocPolicy = 1;
99 static constexpr unsigned MaxIdentifiers =
100 1U << (BitsForProt + BitsForDeallocPolicy);
115 : Id(static_cast<underlying_type>(MP) |
116 (static_cast<underlying_type>(MDP) << BitsForProt)) {}
120 return static_cast<MemProt>(Id & ((1U << BitsForProt) - 1));
141 AllocGroup(underlying_type RawId) : Id(RawId) {}
142 underlying_type Id = 0;
150 using ElemT = std::pair<AllocGroup, T>;
153 static bool compareKey(
const ElemT &
E,
const AllocGroup &
G) {
170 return (
I->first ==
G) ?
I :
end();
178 if (
I == Elems.
end() ||
I->first !=
G)
201 using UT = std::underlying_type_t<orc::MemProt>;
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines DenseMapInfo traits for DenseMap.
iterator insert(iterator I, T &&Elt)
A specialized small-map for AllocGroups.
iterator find(AllocGroup G)
T & operator[](AllocGroup G)
AllocGroupSmallMap(std::initializer_list< std::pair< AllocGroup, T > > Inits)
AllocGroupSmallMap()=default
typename VectorTy::iterator iterator
A pair of memory protections and allocation policies.
MemDeallocPolicy getMemDeallocPolicy() const
Returns the MemoryDeallocationPolicy for this group.
static constexpr unsigned NumGroups
MemProt getMemProt() const
Returns the MemProt for this group.
friend bool operator==(const AllocGroup &LHS, const AllocGroup &RHS)
AllocGroup(MemProt MP)
Create an AllocGroup from a MemProt only – uses MemoryDeallocationPolicy::Standard.
AllocGroup()=default
Create a default AllocGroup.
friend bool operator<(const AllocGroup &LHS, const AllocGroup &RHS)
AllocGroup(MemProt MP, MemDeallocPolicy MDP)
Create an AllocGroup from a MemProt and a MemoryDeallocationPolicy.
friend bool operator!=(const AllocGroup &LHS, const AllocGroup &RHS)
This class implements an extremely fast bulk output stream that can only output to a stream.
MemProt
Describes Read/Write/Exec permissions for memory.
MemProt fromSysMemoryProtectionFlags(sys::Memory::ProtectionFlags PF)
Convert a sys::Memory::ProtectionFlags value to a corresponding MemProt value.
MemDeallocPolicy
Describes a memory deallocation policy for memory to be allocated by a JITLinkMemoryManager.
@ Standard
Standard memory should be deallocated when the deallocate method is called for the finalized allocati...
@ Finalize
Finalize memory should be overwritten and then deallocated after all finalization functions have been...
sys::Memory::ProtectionFlags toSysMemoryProtectionFlags(MemProt MP)
Convert a MemProt value to a corresponding sys::Memory::ProtectionFlags value.
raw_ostream & operator<<(raw_ostream &OS, const SymbolStringPtr &Sym)
Render a SymbolStringPtr.
This is an optimization pass for GlobalISel generic memory operations.
void sort(IteratorTy Start, IteratorTy End)
@ LLVM_MARK_AS_BITMASK_ENUM
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
static bool isEqual(const orc::AllocGroup &LHS, const orc::AllocGroup &RHS)
static orc::AllocGroup getEmptyKey()
static orc::AllocGroup getTombstoneKey()
static unsigned getHashValue(const orc::AllocGroup &Val)
static orc::MemProt getEmptyKey()
static bool isEqual(const orc::MemProt &LHS, const orc::MemProt &RHS)
static orc::MemProt getTombstoneKey()
static unsigned getHashValue(const orc::MemProt &Val)
An information struct used to provide DenseMap with the various necessary components for a given valu...
Function object to check whether the first component of a std::pair compares less than the first comp...