LLVM 24.0.0git
HandleLookupInJITDylib.h
Go to the documentation of this file.
1//===- HandleLookupInJITDylib.h - Lookups in JITDylibs ----------*- 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// Protocol-agnostic call-controller handler for executor-initiated symbol
10// lookups in JITDylibs. See HandleLookupInJITDylibSPS.h for the Simple Packed
11// Serialization spec used to bind it.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_EXECUTIONENGINE_ORC_HANDLELOOKUPINJITDYLIB_H
16#define LLVM_EXECUTIONENGINE_ORC_HANDLELOOKUPINJITDYLIB_H
17
19#include "llvm/ADT/StringRef.h"
25
26#include <utility>
27#include <vector>
28
29namespace llvm::orc {
30
31/// Maps an executor-supplied key to the JITDylib that it identifies, returning
32/// null if the key identifies no JITDylib. May be called concurrently.
34
35/// Handler for executor-initiated lookups in JITDylibs. The executor supplies a
36/// key identifying the JITDylib, the JITDylibLookupFlags for the search, and
37/// the set of symbols to look up (each with a flag that is true if the symbol
38/// is required), and receives one result per element of the set, in the same
39/// order.
43 const std::vector<std::pair<StringRef, bool>> &Symbols)>;
44
45/// Create a handler for executor-initiated lookups in JITDylibs, callable via
46/// the ORC runtime's call-controller mechanism. Bind it to the tag with
47/// bindCallControllerHandler, e.g.:
48///
49/// \code{.cpp}
50/// ES.registerCallControllerHandlers(
51/// JD, bindCallControllerHandler<sps::HandleLookupInJITDylibSpec>(
52/// createLookupInJITDylibHandler(ES, std::move(GetJD))));
53/// \endcode
54///
55/// GetJD maps the key supplied by the executor to a JITDylib. What the key is
56/// (e.g. the address of an image header in the executor) is up to whoever
57/// maintains that mapping.
58///
59/// Symbol names are looked up as given (i.e. as linker-mangled names), among
60/// all of the JITDylib's symbols or only its exported symbols, as the
61/// executor's JITDylibLookupFlags specify. A missing required symbol fails the
62/// whole lookup, without materializing anything. A missing weakly referenced
63/// symbol is reported as nullopt, so a null address in the result always means
64/// a symbol defined at address zero.
67
68} // namespace llvm::orc
69
70#endif // LLVM_EXECUTIONENGINE_ORC_HANDLELOOKUPINJITDYLIB_H
#define LLVM_ABI
Definition Compiler.h:211
This file provides a collection of function (or more generally, callable) type erasure utilities supp...
Tagged union holding either a T or a Error.
Definition Error.h:485
An ExecutionSession represents a running JIT program.
Definition Core.h:1096
Represents an address in the executor process.
unique_function is a type-erasing functor similar to std::function.
unique_function< void( unique_function< void(Expected< SymbolLookupResult >)> SendResult, ExecutorAddr Key, JITDylibLookupFlags JDLookupFlags, const std::vector< std::pair< StringRef, bool > > &Symbols)> HandleLookupInJITDylibFn
Handler for executor-initiated lookups in JITDylibs.
unique_function< JITDylibSP(ExecutorAddr Key)> GetJITDylibForKeyFn
Maps an executor-supplied key to the JITDylib that it identifies, returning null if the key identifie...
IntrusiveRefCntPtr< JITDylib > JITDylibSP
Definition Core.h:60
JITDylibLookupFlags
Lookup flags that apply to each dylib in the search order for a lookup.
LLVM_ABI HandleLookupInJITDylibFn createLookupInJITDylibHandler(ExecutionSession &ES, GetJITDylibForKeyFn GetJD)
Create a handler for executor-initiated lookups in JITDylibs, callable via the ORC runtime's call-con...
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key