1 //===----- EPCGenericMemoryAccess.cpp - Generic EPC MemoryAccess impl -----===//
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
7 //===----------------------------------------------------------------------===//
9 #include "llvm/ExecutionEngine/Orc/EPCGenericMemoryAccess.h"
10 #include "llvm/ExecutionEngine/Orc/LookupAndRecordAddrs.h"
15 /// Create from a ExecutorProcessControl instance.
16 Expected
<std::unique_ptr
<EPCGenericMemoryAccess
>>
17 EPCGenericMemoryAccess::CreateUsingOrcRTFuncs(ExecutionSession
&ES
,
18 JITDylib
&OrcRuntimeJD
) {
20 StringRef GlobalPrefix
= "";
21 if (ES
.getExecutorProcessControl().getTargetTriple().isOSBinFormatMachO())
25 if (auto Err
= lookupAndRecordAddrs(
26 ES
, LookupKind::Static
, makeJITDylibSearchOrder(&OrcRuntimeJD
),
27 {{ES
.intern((GlobalPrefix
+ "__orc_rt_write_uint8s_wrapper").str()),
29 {ES
.intern((GlobalPrefix
+ "__orc_rt_write_uint16s_wrapper").str()),
31 {ES
.intern((GlobalPrefix
+ "__orc_rt_write_uint32s_wrapper").str()),
33 {ES
.intern((GlobalPrefix
+ "__orc_rt_write_uint64s_wrapper").str()),
35 {ES
.intern((GlobalPrefix
+ "__orc_rt_write_buffers_wrapper").str()),
37 return std::move(Err
);
39 return std::make_unique
<EPCGenericMemoryAccess
>(
40 ES
.getExecutorProcessControl(), FAs
);
43 } // end namespace orc
44 } // end namespace llvm