LLVM 17.0.0git
EPCGenericDylibManager.cpp
Go to the documentation of this file.
1//===------- EPCGenericDylibManager.cpp -- Dylib management via EPC -------===//
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
10
14
15namespace llvm {
16namespace orc {
17namespace shared {
18
19template <>
21 SymbolLookupSet::value_type> {
22public:
23 static size_t size(const SymbolLookupSet::value_type &V) {
25 *V.first, V.second == SymbolLookupFlags::RequiredSymbol);
26 }
27
28 static bool serialize(SPSOutputBuffer &OB,
31 OB, *V.first, V.second == SymbolLookupFlags::RequiredSymbol);
32 }
33};
34
35template <>
38public:
39 static constexpr bool available = true;
40};
41
42template <>
44 ExecutorProcessControl::LookupRequest> {
47
48public:
50 return MemberSerialization::size(ExecutorAddr(LR.Handle), LR.Symbols);
51 }
52
53 static bool serialize(SPSOutputBuffer &OB,
55 return MemberSerialization::serialize(OB, ExecutorAddr(LR.Handle),
56 LR.Symbols);
57 }
58};
59
60} // end namespace shared
61
65 SymbolAddrs SAs;
66 if (auto Err = EPC.getBootstrapSymbols(
67 {{SAs.Instance, rt::SimpleExecutorDylibManagerInstanceName},
68 {SAs.Open, rt::SimpleExecutorDylibManagerOpenWrapperName},
69 {SAs.Lookup, rt::SimpleExecutorDylibManagerLookupWrapperName}}))
70 return std::move(Err);
71 return EPCGenericDylibManager(EPC, std::move(SAs));
72}
73
74Expected<tpctypes::DylibHandle> EPCGenericDylibManager::open(StringRef Path,
75 uint64_t Mode) {
77 if (auto Err =
79 SAs.Open, H, SAs.Instance, Path, Mode))
80 return std::move(Err);
81 return H;
82}
83
85EPCGenericDylibManager::lookup(tpctypes::DylibHandle H,
86 const SymbolLookupSet &Lookup) {
87 Expected<std::vector<ExecutorAddr>> Result((std::vector<ExecutorAddr>()));
88 if (auto Err =
90 SAs.Lookup, Result, SAs.Instance, H, Lookup))
91 return std::move(Err);
92 return Result;
93}
94
96EPCGenericDylibManager::lookup(tpctypes::DylibHandle H,
98 Expected<std::vector<ExecutorAddr>> Result((std::vector<ExecutorAddr>()));
99 if (auto Err =
101 SAs.Lookup, Result, SAs.Instance, H, Lookup))
102 return std::move(Err);
103 return Result;
104}
105
106} // end namespace orc
107} // end namespace llvm
#define H(x, y, z)
Definition: MD5.cpp:57
static cl::opt< RegAllocEvictionAdvisorAnalysis::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Development, "development", "for training")))
static int Lookup(ArrayRef< TableEntry > Table, unsigned Opcode)
Tagged union holding either a T or a Error.
Definition: Error.h:470
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
static Expected< EPCGenericDylibManager > CreateWithDefaultBootstrapSymbols(ExecutorProcessControl &EPC)
Create an EPCGenericMemoryAccess instance from a given set of function addrs.
Represents an address in the executor process.
ExecutorProcessControl supports interaction with a JIT target process.
Error getBootstrapSymbols(ArrayRef< std::pair< ExecutorAddr &, StringRef > > Pairs) const
For each (ExecutorAddr&, StringRef) pair, looks up the string in the bootstrap symbols map and writes...
A set of symbols to look up, each associated with a SymbolLookupFlags value.
Definition: Core.h:182
std::pair< SymbolStringPtr, SymbolLookupFlags > value_type
Definition: Core.h:184
A utility class for serializing to a blob from a variadic list.
Output char buffer with overflow check.
static bool serialize(SPSOutputBuffer &OB, const ExecutorProcessControl::LookupRequest &LR)
Specialize to describe how to serialize/deserialize to/from the given concrete type.
Specialize this to implement 'trivial' sequence serialization for a concrete sequence type.
shared::SPSExpected< shared::SPSSequence< shared::SPSExecutorAddr > >(shared::SPSExecutorAddr, shared::SPSExecutorAddr, shared::SPSRemoteSymbolLookupSet) SPSSimpleExecutorDylibManagerLookupSignature
Definition: OrcRTBridge.h:60
shared::SPSExpected< shared::SPSExecutorAddr >(shared::SPSExecutorAddr, shared::SPSString, uint64_t) SPSSimpleExecutorDylibManagerOpenSignature
Definition: OrcRTBridge.h:55
std::vector< RemoteSymbolLookupSetElement > RemoteSymbolLookupSet
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Function addresses for memory access.
A pair of a dylib and a set of symbols to be looked up.