Go to the documentation of this file.
14 #ifndef LLVM_EXECUTIONENGINE_JITLINK_MEMORYFLAGS_H
15 #define LLVM_EXECUTIONENGINE_JITLINK_MEMORYFLAGS_H
41 std::underlying_type_t<sys::Memory::ProtectionFlags> PF = 0;
90 using underlying_type = uint8_t;
91 static constexpr
unsigned BitsForProt = 3;
92 static constexpr
unsigned BitsForDeallocPolicy = 1;
93 static constexpr
unsigned MaxIdentifiers =
94 1U << (BitsForProt + BitsForDeallocPolicy);
97 static constexpr
unsigned NumGroups = MaxIdentifiers;
109 :
Id(static_cast<underlying_type>(MP) |
110 (static_cast<underlying_type>(MDP) << BitsForProt)) {}
114 return static_cast<MemProt>(
Id & ((1U << BitsForProt) - 1));
136 underlying_type
Id = 0;
144 using ElemT = std::pair<AllocGroup, T>;
147 static bool compareKey(
const ElemT &
E,
const AllocGroup &
G) {
164 return (
I->first ==
G) ?
I :
end();
167 bool empty()
const {
return Elems.empty(); }
168 size_t size()
const {
return Elems.size(); }
172 if (
I == Elems.end() ||
I->first !=
G)
194 using UT = std::underlying_type_t<jitlink::MemProt>;
222 #endif // LLVM_EXECUTIONENGINE_JITLINK_MEMORYFLAGS_H
friend bool operator<(const AllocGroup &LHS, const AllocGroup &RHS)
This is an optimization pass for GlobalISel generic memory operations.
@ Standard
Standard memory should be deallocated when the deallocate method is called for the finalized allocati...
#define LLVM_MARK_AS_BITMASK_ENUM(LargestValue)
LLVM_MARK_AS_BITMASK_ENUM lets you opt in an individual enum type so you can perform bitwise operatio...
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 jitlink::AllocGroup &LHS, const jitlink::AllocGroup &RHS)
static jitlink::AllocGroup getEmptyKey()
MemProt getMemProt() const
Returns the MemProt for this group.
AllocGroup(MemProt MP)
Create an AllocGroup from a MemProt only – uses MemoryDeallocationPolicy::Standard.
A pair of memory protections and allocation policies.
T & operator[](AllocGroup G)
static jitlink::MemProt getTombstoneKey()
static bool isEqual(const jitlink::MemProt &LHS, const jitlink::MemProt &RHS)
static unsigned getHashValue(const jitlink::MemProt &Val)
An information struct used to provide DenseMap with the various necessary components for a given valu...
raw_ostream & operator<<(raw_ostream &OS, const Block &B)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Function object to check whether the first component of a std::pair compares less than the first comp...
static unsigned getHashValue(const jitlink::AllocGroup &Val)
static jitlink::AllocGroup getTombstoneKey()
This class implements an extremely fast bulk output stream that can only output to a stream.
MemProt
Describes Read/Write/Exec permissions for memory.
MemDeallocPolicy getMemDeallocPolicy() const
Returns the MemoryDeallocationPolicy for this group.
AllocGroupSmallMap(std::initializer_list< std::pair< AllocGroup, T >> Inits)
static jitlink::MemProt getEmptyKey()
AllocGroup(MemProt MP, MemDeallocPolicy MDP)
Create an AllocGroup from a MemProt and a MemoryDeallocationPolicy.
A specialized small-map for AllocGroups.
typename VectorTy::iterator iterator
friend bool operator==(const AllocGroup &LHS, const AllocGroup &RHS)
sys::Memory::ProtectionFlags toSysMemoryProtectionFlags(MemProt MP)
Convert a MemProt value to a corresponding sys::Memory::ProtectionFlags value.
AllocGroup()=default
Create a default AllocGroup.
iterator find(AllocGroup G)
static constexpr unsigned NumGroups
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.
void sort(IteratorTy Start, IteratorTy End)
typename SuperClass::iterator iterator
AllocGroupSmallMap()=default
@ Finalize
Finalize memory should be overwritten and then deallocated after all finalization functions have been...
friend bool operator!=(const AllocGroup &LHS, const AllocGroup &RHS)
iterator insert(iterator I, T &&Elt)