LLVM 22.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
25
26namespace llvm {
27namespace orc {
28
29class SymbolLookupSet;
30
32public:
33 /// Function addresses for memory access.
39
40 /// Create an EPCGenericMemoryAccess instance from a given set of
41 /// function addrs.
44
45 /// Create an EPCGenericMemoryAccess instance from a given set of
46 /// function addrs.
48 : EPC(EPC), SAs(SAs) {}
49
50 /// Loads the dylib with the given name.
52
53 /// Looks up symbols within the given dylib.
56 std::promise<MSVCPExpected<std::vector<ExecutorSymbolDef>>> RP;
57 auto RF = RP.get_future();
58 lookupAsync(H, Lookup, [&RP](auto R) { RP.set_value(std::move(R)); });
59 return RF.get();
60 }
61
62 /// Looks up symbols within the given dylib.
65 std::promise<MSVCPExpected<std::vector<ExecutorSymbolDef>>> RP;
66 auto RF = RP.get_future();
67 lookupAsync(H, Lookup, [&RP](auto R) { RP.set_value(std::move(R)); });
68 return RF.get();
69 }
70
72 unique_function<void(Expected<std::vector<ExecutorSymbolDef>>)>;
73
74 /// Looks up symbols within the given dylib.
77 SymbolLookupCompleteFn Complete);
78
79 /// Looks up symbols within the given dylib.
82 SymbolLookupCompleteFn Complete);
83
84private:
86 SymbolAddrs SAs;
87};
88
89} // end namespace orc
90} // end namespace llvm
91
92#endif // LLVM_EXECUTIONENGINE_ORC_EPCGENERICDYLIBMANAGER_H
#define LLVM_ABI
Definition Compiler.h:213
#define H(x, y, z)
Definition MD5.cpp:57
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::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:485
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
Expected< std::vector< ExecutorSymbolDef > > lookup(tpctypes::DylibHandle H, const SymbolLookupSet &Lookup)
Looks up symbols within the given dylib.
static LLVM_ABI Expected< EPCGenericDylibManager > CreateWithDefaultBootstrapSymbols(ExecutorProcessControl &EPC)
Create an EPCGenericMemoryAccess instance from a given set of function addrs.
LLVM_ABI 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.
LLVM_ABI 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.
unique_function< void(Expected< std::vector< ExecutorSymbolDef > >)> SymbolLookupCompleteFn
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:195
unique_function is a type-erasing functor similar to std::function.
ExecutorAddr DylibHandle
A handle used to represent a loaded dylib in the target process.
std::vector< RemoteSymbolLookupSetElement > RemoteSymbolLookupSet
This is an optimization pass for GlobalISel generic memory operations.