1//===- SimpleMemoryMapSPS.cpp - SPS 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/SimpleMemoryMapSPS.h"
10
11#include "llvm/ExecutionEngine/Orc/Core.h"
12#include "llvm/ExecutionEngine/Orc/RecordProxy.h"
13
14namespace llvm::orc::sps {
15
16Expected<SimpleMemoryMapBindings> createSimpleMemoryMapBindings(JITDylib &JD) {
17 SimpleMemoryMapBindings B;
18 // Instance is the executor-side manager object -- a data symbol passed as the
19 // first argument to each call, not a wrapper to proxy. The proxies resolve to
20 // the specs' default (SimpleNativeMemoryMap) names.
21 if (auto Err = lookupAndApply(
22 JD, PrepareFns: {recordAddr(Name: rt::sps_ci::SimpleNativeMemoryMapInstanceName,
23 A: &B.Instance),
24 recordProxy<MemMgrReserveProxySpec>(P: &B.Reserve),
25 recordProxy<MemMgrInitializeProxySpec>(P: &B.Initialize),
26 recordProxy<MemMgrDeinitializeProxySpec>(P: &B.Deinitialize),
27 recordProxy<MemMgrReleaseProxySpec>(P: &B.Release)}))
28 return std::move(Err);
29 return std::move(B);
30}
31
32Expected<SimpleMemoryMapBindings>
33createSimpleMemoryMapBindings(ExecutionSession &ES) {
34 return createSimpleMemoryMapBindings(JD&: ES.getBootstrapJITDylib());
35}
36
37} // namespace llvm::orc::sps
38