LLVM 20.0.0git
EPCGenericDylibManager.h
Go to the documentation of this file.
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
24
25namespace llvm {
26namespace orc {
27
28class SymbolLookupSet;
29
31public:
32 /// Function addresses for memory access.
33 struct SymbolAddrs {
37 };
38
39 /// Create an EPCGenericMemoryAccess instance from a given set of
40 /// function addrs.
43
44 /// Create an EPCGenericMemoryAccess instance from a given set of
45 /// function addrs.
47 : EPC(EPC), SAs(SAs) {}
48
49 /// Loads the dylib with the given name.
51
52 /// Looks up symbols within the given dylib.
55 std::promise<MSVCPExpected<std::vector<ExecutorSymbolDef>>> RP;
56 auto RF = RP.get_future();
57 lookupAsync(H, Lookup, [&RP](auto R) { RP.set_value(std::move(R)); });
58 return RF.get();
59 }
60
61 /// Looks up symbols within the given dylib.
64 std::promise<MSVCPExpected<std::vector<ExecutorSymbolDef>>> RP;
65 auto RF = RP.get_future();
66 lookupAsync(H, Lookup, [&RP](auto R) { RP.set_value(std::move(R)); });
67 return RF.get();
68 }
69
71 unique_function<void(Expected<std::vector<ExecutorSymbolDef>>)>;
72
73 /// Looks up symbols within the given dylib.
75 SymbolLookupCompleteFn Complete);
76
77 /// Looks up symbols within the given dylib.
79 SymbolLookupCompleteFn Complete);
80
81private:
83 SymbolAddrs SAs;
84};
85
86} // end namespace orc
87} // end namespace llvm
88
89#endif // LLVM_EXECUTIONENGINE_ORC_EPCGENERICDYLIBMANAGER_H
#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:481
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Expected< std::vector< ExecutorSymbolDef > > lookup(tpctypes::DylibHandle H, const SymbolLookupSet &Lookup)
Looks up symbols within the given dylib.
static Expected< EPCGenericDylibManager > CreateWithDefaultBootstrapSymbols(ExecutorProcessControl &EPC)
Create an EPCGenericMemoryAccess instance from a given set of function addrs.
void lookupAsync(tpctypes::DylibHandle H, const SymbolLookupSet &Lookup, SymbolLookupCompleteFn Complete)
Looks up symbols within the given dylib.
Expected< std::vector< ExecutorSymbolDef > > lookup(tpctypes::DylibHandle H, const RemoteSymbolLookupSet &Lookup)
Looks up symbols within the given dylib.
Expected< tpctypes::DylibHandle > open(StringRef Path, uint64_t Mode)
Loads the dylib with the given name.
EPCGenericDylibManager(ExecutorProcessControl &EPC, SymbolAddrs SAs)
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.
A set of symbols to look up, each associated with a SymbolLookupFlags value.
Definition: Core.h:183
unique_function is a type-erasing functor similar to std::function.
std::vector< RemoteSymbolLookupSetElement > RemoteSymbolLookupSet
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Function addresses for memory access.