//===-------- MemoryFlags.h - Memory allocation flags -----------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // Defines types and operations related to memory protection and allocation // lifetimes. // //===----------------------------------------------------------------------===// #ifndef LLVM_EXECUTIONENGINE_ORC_SHARED_MEMORYFLAGS_H #define LLVM_EXECUTIONENGINE_ORC_SHARED_MEMORYFLAGS_H #include "llvm/ADT/BitmaskEnum.h" #include "llvm/ADT/DenseMapInfo.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Memory.h" #include "llvm/Support/raw_ostream.h" namespace llvm { namespace orc { /// Describes Read/Write/Exec permissions for memory. enum class MemProt { … }; /// Print a MemProt as an RWX triple. inline raw_ostream &operator<<(raw_ostream &OS, MemProt MP) { … } /// Convert a MemProt value to a corresponding sys::Memory::ProtectionFlags /// value. inline sys::Memory::ProtectionFlags toSysMemoryProtectionFlags(MemProt MP) { … } /// Convert a sys::Memory::ProtectionFlags value to a corresponding MemProt /// value. inline MemProt fromSysMemoryProtectionFlags(sys::Memory::ProtectionFlags PF) { … } /// Describes a memory lifetime policy for memory to be allocated by a /// JITLinkMemoryManager. /// /// All memory allocated by a call to JITLinkMemoryManager::allocate should be /// deallocated if a call is made to /// JITLinkMemoryManager::InFlightAllocation::abandon. The policies below apply /// to finalized allocations. enum class MemLifetime { … }; /// Print a MemDeallocPolicy. inline raw_ostream &operator<<(raw_ostream &OS, MemLifetime MLP) { … } /// A pair of memory protections and allocation policies. /// /// Optimized for use as a small map key. class AllocGroup { … }; /// A specialized small-map for AllocGroups. /// /// Iteration order is guaranteed to match key ordering. template <typename T> class AllocGroupSmallMap { … }; /// Print an AllocGroup. inline raw_ostream &operator<<(raw_ostream &OS, AllocGroup AG) { … } } // end namespace orc template <> struct DenseMapInfo<orc::MemProt> { … }; template <> struct DenseMapInfo<orc::AllocGroup> { … }; } // end namespace llvm #endif // LLVM_EXECUTIONENGINE_ORC_SHARED_MEMORYFLAGS_H