| 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/TargetProcessControlTypes.h" |
| 27 | |
| 28 | #include <cstdint> |
| 29 | |
| 30 | namespace llvm::orc::rt::sps_ci { |
| 31 | |
| 32 | /// The executor-side memory-manager instance. This is a data symbol (the |
| 33 | /// allocator object) -- passed as the first argument to each call below -- not |
| 34 | /// a wrapper to call. |
| 35 | inline constexpr char SimpleNativeMemoryMapInstanceName[] = |
| 36 | "orc_rt_ci_SimpleNativeMemoryMap_Instance" ; |
| 37 | |
| 38 | /// Reserve an address range of the given size; returns its base. |
| 39 | struct MemMgrReserve { |
| 40 | static constexpr char Name[] = "orc_rt_ci_sps_SimpleNativeMemoryMap_reserve" ; |
| 41 | using SPSSig = shared::SPSExpected<shared::SPSExecutorAddr>( |
| 42 | shared::SPSExecutorAddr, uint64_t); |
| 43 | }; |
| 44 | |
| 45 | /// Apply a finalize request; returns a key for the initialized allocation. |
| 46 | struct MemMgrInitialize { |
| 47 | static constexpr char Name[] = |
| 48 | "orc_rt_ci_sps_SimpleNativeMemoryMap_initialize" ; |
| 49 | using SPSSig = shared::SPSExpected<shared::SPSExecutorAddr>( |
| 50 | shared::SPSExecutorAddr, shared::SPSFinalizeRequest); |
| 51 | }; |
| 52 | |
| 53 | /// Deinitialize the allocations with the given base addresses (running their |
| 54 | /// deallocation actions) without releasing their memory. |
| 55 | struct MemMgrDeinitialize { |
| 56 | static constexpr char Name[] = |
| 57 | "orc_rt_ci_sps_SimpleNativeMemoryMap_deinitializeMultiple" ; |
| 58 | using SPSSig = shared::SPSError(shared::SPSExecutorAddr, |
| 59 | shared::SPSSequence<shared::SPSExecutorAddr>); |
| 60 | }; |
| 61 | |
| 62 | /// Release the allocations with the given base addresses. |
| 63 | struct MemMgrRelease { |
| 64 | static constexpr char Name[] = |
| 65 | "orc_rt_ci_sps_SimpleNativeMemoryMap_releaseMultiple" ; |
| 66 | using SPSSig = shared::SPSError(shared::SPSExecutorAddr, |
| 67 | shared::SPSSequence<shared::SPSExecutorAddr>); |
| 68 | }; |
| 69 | |
| 70 | } // namespace llvm::orc::rt::sps_ci |
| 71 | |
| 72 | #endif // LLVM_EXECUTIONENGINE_ORC_SHARED_SPSCI_SIMPLENATIVEMEMORYMAPSPSCI_H |
| 73 | |