1 //===---- OrcRTBridge.h -- Utils for interacting with orc-rt ----*- 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 // Declares types and symbol names provided by the ORC runtime.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_EXECUTIONENGINE_ORC_SHARED_ORCRTBRIDGE_H
14 #define LLVM_EXECUTIONENGINE_ORC_SHARED_ORCRTBRIDGE_H
15 
16 #include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
17 #include "llvm/ExecutionEngine/Orc/Shared/ExecutorSymbolDef.h"
18 #include "llvm/ExecutionEngine/Orc/Shared/SimpleRemoteEPCUtils.h"
19 #include "llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h"
20 
21 namespace llvm {
22 namespace orc {
23 namespace rt {
24 
25 extern const char *SimpleExecutorDylibManagerInstanceName;
26 extern const char *SimpleExecutorDylibManagerOpenWrapperName;
27 extern const char *SimpleExecutorDylibManagerLookupWrapperName;
28 
29 extern const char *SimpleExecutorMemoryManagerInstanceName;
30 extern const char *SimpleExecutorMemoryManagerReserveWrapperName;
31 extern const char *SimpleExecutorMemoryManagerFinalizeWrapperName;
32 extern const char *SimpleExecutorMemoryManagerDeallocateWrapperName;
33 
34 extern const char *ExecutorSharedMemoryMapperServiceInstanceName;
35 extern const char *ExecutorSharedMemoryMapperServiceReserveWrapperName;
36 extern const char *ExecutorSharedMemoryMapperServiceInitializeWrapperName;
37 extern const char *ExecutorSharedMemoryMapperServiceDeinitializeWrapperName;
38 extern const char *ExecutorSharedMemoryMapperServiceReleaseWrapperName;
39 
40 extern const char *MemoryWriteUInt8sWrapperName;
41 extern const char *MemoryWriteUInt16sWrapperName;
42 extern const char *MemoryWriteUInt32sWrapperName;
43 extern const char *MemoryWriteUInt64sWrapperName;
44 extern const char *MemoryWriteBuffersWrapperName;
45 
46 extern const char *RegisterEHFrameSectionWrapperName;
47 extern const char *DeregisterEHFrameSectionWrapperName;
48 
49 extern const char *RunAsMainWrapperName;
50 extern const char *RunAsVoidFunctionWrapperName;
51 extern const char *RunAsIntFunctionWrapperName;
52 
53 using SPSSimpleExecutorDylibManagerOpenSignature =
54     shared::SPSExpected<shared::SPSExecutorAddr>(shared::SPSExecutorAddr,
55                                                  shared::SPSString, uint64_t);
56 
57 using SPSSimpleExecutorDylibManagerLookupSignature =
58     shared::SPSExpected<shared::SPSSequence<shared::SPSExecutorSymbolDef>>(
59         shared::SPSExecutorAddr, shared::SPSExecutorAddr,
60         shared::SPSRemoteSymbolLookupSet);
61 
62 using SPSSimpleExecutorMemoryManagerReserveSignature =
63     shared::SPSExpected<shared::SPSExecutorAddr>(shared::SPSExecutorAddr,
64                                                  uint64_t);
65 using SPSSimpleExecutorMemoryManagerFinalizeSignature =
66     shared::SPSError(shared::SPSExecutorAddr, shared::SPSFinalizeRequest);
67 using SPSSimpleExecutorMemoryManagerDeallocateSignature = shared::SPSError(
68     shared::SPSExecutorAddr, shared::SPSSequence<shared::SPSExecutorAddr>);
69 
70 // ExecutorSharedMemoryMapperService
71 using SPSExecutorSharedMemoryMapperServiceReserveSignature =
72     shared::SPSExpected<
73         shared::SPSTuple<shared::SPSExecutorAddr, shared::SPSString>>(
74         shared::SPSExecutorAddr, uint64_t);
75 using SPSExecutorSharedMemoryMapperServiceInitializeSignature =
76     shared::SPSExpected<shared::SPSExecutorAddr>(
77         shared::SPSExecutorAddr, shared::SPSExecutorAddr,
78         shared::SPSSharedMemoryFinalizeRequest);
79 using SPSExecutorSharedMemoryMapperServiceDeinitializeSignature =
80     shared::SPSError(shared::SPSExecutorAddr,
81                      shared::SPSSequence<shared::SPSExecutorAddr>);
82 using SPSExecutorSharedMemoryMapperServiceReleaseSignature = shared::SPSError(
83     shared::SPSExecutorAddr, shared::SPSSequence<shared::SPSExecutorAddr>);
84 
85 using SPSRunAsMainSignature = int64_t(shared::SPSExecutorAddr,
86                                       shared::SPSSequence<shared::SPSString>);
87 using SPSRunAsVoidFunctionSignature = int32_t(shared::SPSExecutorAddr);
88 using SPSRunAsIntFunctionSignature = int32_t(shared::SPSExecutorAddr, int32_t);
89 } // end namespace rt
90 } // end namespace orc
91 } // end namespace llvm
92 
93 #endif // LLVM_EXECUTIONENGINE_ORC_SHARED_ORCRTBRIDGE_H
94