| 1 | //===-- SimpleNativeMemoryMapSPSCI.h - SPS CI for mem mgmt ------*- 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 | // SPS controller-interface descriptors for the runtime's SimpleNativeMemoryMap |
| 10 | // interface. The instance address of the executor-side manager is passed as |
| 11 | // the first argument to each call. |
| 12 | // |
| 13 | // The names below are the SimpleNativeMemoryMap defaults. Callers may resolve |
| 14 | // these operations under other names, so a descriptor's Name is a default |
| 15 | // rather than a fixed part of the contract. |
| 16 | // |
| 17 | // See CallSPSCI.h for a description of the descriptor scheme. |
| 18 | // |
| 19 | //===----------------------------------------------------------------------===// |
| 20 | |
| 21 | #ifndef LLVM_EXECUTIONENGINE_ORC_SHARED_SPSCI_SIMPLENATIVEMEMORYMAPSPSCI_H |
| 22 | #define LLVM_EXECUTIONENGINE_ORC_SHARED_SPSCI_SIMPLENATIVEMEMORYMAPSPSCI_H |
| 23 | |
| 24 | #include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h" |
| 25 | #include "llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h" |
| 26 | #include "llvm/ExecutionEngine/Orc/Shared/SymbolNameSpec.h" |
| 27 | #include "llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h" |
| 28 | |
| 29 | #include <cstdint> |
| 30 | |
| 31 | namespace llvm::orc::rt::sps_ci { |
| 32 | |
| 33 | /// The executor-side memory-manager instance. This is a data symbol (the |
| 34 | /// allocator object) -- passed as the first argument to each call below -- not |
| 35 | /// a wrapper to call. |
| 36 | inline constexpr SymbolNameSpec SimpleNativeMemoryMapInstanceName = |
| 37 | SymbolNameSpec::verbatim(Name: "orc_rt_ci_SimpleNativeMemoryMap_Instance" ); |
| 38 | |
| 39 | /// Reserve an address range of the given size; returns its base. |
| 40 | struct MemMgrReserve { |
| 41 | static constexpr SymbolNameSpec Name = |
| 42 | SymbolNameSpec::verbatim(Name: "orc_rt_ci_sps_SimpleNativeMemoryMap_reserve" ); |
| 43 | using SPSSig = shared::SPSExpected<shared::SPSExecutorAddr>( |
| 44 | shared::SPSExecutorAddr, uint64_t); |
| 45 | }; |
| 46 | |
| 47 | /// Apply a finalize request; returns a key for the initialized allocation. |
| 48 | struct MemMgrInitialize { |
| 49 | static constexpr SymbolNameSpec Name = SymbolNameSpec::verbatim( |
| 50 | Name: "orc_rt_ci_sps_SimpleNativeMemoryMap_initialize" ); |
| 51 | using SPSSig = shared::SPSExpected<shared::SPSExecutorAddr>( |
| 52 | shared::SPSExecutorAddr, shared::SPSFinalizeRequest); |
| 53 | }; |
| 54 | |
| 55 | /// Deinitialize the allocations with the given base addresses (running their |
| 56 | /// deallocation actions) without releasing their memory. |
| 57 | struct MemMgrDeinitialize { |
| 58 | static constexpr SymbolNameSpec Name = SymbolNameSpec::verbatim( |
| 59 | Name: "orc_rt_ci_sps_SimpleNativeMemoryMap_deinitializeMultiple" ); |
| 60 | using SPSSig = shared::SPSError(shared::SPSExecutorAddr, |
| 61 | shared::SPSSequence<shared::SPSExecutorAddr>); |
| 62 | }; |
| 63 | |
| 64 | /// Release the allocations with the given base addresses. |
| 65 | struct MemMgrRelease { |
| 66 | static constexpr SymbolNameSpec Name = SymbolNameSpec::verbatim( |
| 67 | Name: "orc_rt_ci_sps_SimpleNativeMemoryMap_releaseMultiple" ); |
| 68 | using SPSSig = shared::SPSError(shared::SPSExecutorAddr, |
| 69 | shared::SPSSequence<shared::SPSExecutorAddr>); |
| 70 | }; |
| 71 | |
| 72 | } // namespace llvm::orc::rt::sps_ci |
| 73 | |
| 74 | #endif // LLVM_EXECUTIONENGINE_ORC_SHARED_SPSCI_SIMPLENATIVEMEMORYMAPSPSCI_H |
| 75 | |