1//===- SharedMemoryMapSPS.cpp - SPS shared-memory map bindings ------------===//
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#include "llvm/ExecutionEngine/Orc/SharedMemoryMapSPS.h"
10
11#include "llvm/ExecutionEngine/Orc/Core.h"
12#include "llvm/ExecutionEngine/Orc/RecordProxy.h"
13
14namespace llvm::orc::sps {
15
16Expected<SharedMemoryMapBindings> createSharedMemoryMapBindings(JITDylib &JD) {
17 SharedMemoryMapBindings B;
18 // Instance is the executor-side mapper object -- a data symbol passed as the
19 // first argument to each call, not a wrapper to proxy.
20 if (auto Err = lookupAndApply(
21 JD,
22 PrepareFns: {recordAddr(Name: rt::sps_ci::SharedMemoryMapperInstanceName, A: &B.Instance),
23 recordProxy<SharedMemoryMapReserveProxySpec>(P: &B.Reserve),
24 recordProxy<SharedMemoryMapInitializeProxySpec>(P: &B.Initialize),
25 recordProxy<SharedMemoryMapDeinitializeProxySpec>(P: &B.Deinitialize),
26 recordProxy<SharedMemoryMapReleaseProxySpec>(P: &B.Release)}))
27 return std::move(Err);
28 return std::move(B);
29}
30
31Expected<SharedMemoryMapBindings>
32createSharedMemoryMapBindings(ExecutionSession &ES) {
33 return createSharedMemoryMapBindings(JD&: ES.getBootstrapJITDylib());
34}
35
36} // namespace llvm::orc::sps
37