Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 1 | //===- EPCGenericDylibManager.h -- Generic EPC Dylib management -*- 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 | // Implements dylib loading and searching by making calls to |
||
10 | // ExecutorProcessControl::callWrapper. |
||
11 | // |
||
12 | // This simplifies the implementaton of new ExecutorProcessControl instances, |
||
13 | // as this implementation will always work (at the cost of some performance |
||
14 | // overhead for the calls). |
||
15 | // |
||
16 | //===----------------------------------------------------------------------===// |
||
17 | |||
18 | #ifndef LLVM_EXECUTIONENGINE_ORC_EPCGENERICDYLIBMANAGER_H |
||
19 | #define LLVM_EXECUTIONENGINE_ORC_EPCGENERICDYLIBMANAGER_H |
||
20 | |||
21 | #include "llvm/ExecutionEngine/Orc/ExecutorProcessControl.h" |
||
22 | #include "llvm/ExecutionEngine/Orc/Shared/SimpleRemoteEPCUtils.h" |
||
23 | |||
24 | namespace llvm { |
||
25 | namespace orc { |
||
26 | |||
27 | class SymbolLookupSet; |
||
28 | |||
29 | class EPCGenericDylibManager { |
||
30 | public: |
||
31 | /// Function addresses for memory access. |
||
32 | struct SymbolAddrs { |
||
33 | ExecutorAddr Instance; |
||
34 | ExecutorAddr Open; |
||
35 | ExecutorAddr Lookup; |
||
36 | }; |
||
37 | |||
38 | /// Create an EPCGenericMemoryAccess instance from a given set of |
||
39 | /// function addrs. |
||
40 | static Expected<EPCGenericDylibManager> |
||
41 | CreateWithDefaultBootstrapSymbols(ExecutorProcessControl &EPC); |
||
42 | |||
43 | /// Create an EPCGenericMemoryAccess instance from a given set of |
||
44 | /// function addrs. |
||
45 | EPCGenericDylibManager(ExecutorProcessControl &EPC, SymbolAddrs SAs) |
||
46 | : EPC(EPC), SAs(SAs) {} |
||
47 | |||
48 | /// Loads the dylib with the given name. |
||
49 | Expected<tpctypes::DylibHandle> open(StringRef Path, uint64_t Mode); |
||
50 | |||
51 | /// Looks up symbols within the given dylib. |
||
52 | Expected<std::vector<ExecutorAddr>> lookup(tpctypes::DylibHandle H, |
||
53 | const SymbolLookupSet &Lookup); |
||
54 | |||
55 | /// Looks up symbols within the given dylib. |
||
56 | Expected<std::vector<ExecutorAddr>> |
||
57 | lookup(tpctypes::DylibHandle H, const RemoteSymbolLookupSet &Lookup); |
||
58 | |||
59 | private: |
||
60 | ExecutorProcessControl &EPC; |
||
61 | SymbolAddrs SAs; |
||
62 | }; |
||
63 | |||
64 | } // end namespace orc |
||
65 | } // end namespace llvm |
||
66 | |||
67 | #endif // LLVM_EXECUTIONENGINE_ORC_EPCGENERICDYLIBMANAGER_H |