[ORC] Add std::tuple support to SimplePackedSerialization.
[llvm-project.git] / llvm / lib / ExecutionEngine / Orc / EPCGenericMemoryAccess.cpp
blob319909fed7837379743fb9cb2c1534e56d08ccc0
1 //===----- EPCGenericMemoryAccess.cpp - Generic EPC MemoryAccess impl -----===//
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 //===----------------------------------------------------------------------===//
9 #include "llvm/ExecutionEngine/Orc/EPCGenericMemoryAccess.h"
10 #include "llvm/ExecutionEngine/Orc/LookupAndRecordAddrs.h"
12 namespace llvm {
13 namespace orc {
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())
22 GlobalPrefix = "_";
24 FuncAddrs FAs;
25 if (auto Err = lookupAndRecordAddrs(
26 ES, LookupKind::Static, makeJITDylibSearchOrder(&OrcRuntimeJD),
27 {{ES.intern((GlobalPrefix + "__orc_rt_write_uint8s_wrapper").str()),
28 &FAs.WriteUInt8s},
29 {ES.intern((GlobalPrefix + "__orc_rt_write_uint16s_wrapper").str()),
30 &FAs.WriteUInt16s},
31 {ES.intern((GlobalPrefix + "__orc_rt_write_uint32s_wrapper").str()),
32 &FAs.WriteUInt32s},
33 {ES.intern((GlobalPrefix + "__orc_rt_write_uint64s_wrapper").str()),
34 &FAs.WriteUInt64s},
35 {ES.intern((GlobalPrefix + "__orc_rt_write_buffers_wrapper").str()),
36 &FAs.WriteBuffers}}))
37 return std::move(Err);
39 return std::make_unique<EPCGenericMemoryAccess>(
40 ES.getExecutorProcessControl(), FAs);
43 } // end namespace orc
44 } // end namespace llvm