LLVM  14.0.0git
LookupAndRecordAddrs.h
Go to the documentation of this file.
1 //===-- LookupAndRecordAddrs.h - Symbol lookup support utility --*- 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 // Record the addresses of a set of symbols into ExecutorAddr objects.
10 //
11 // This can be used to avoid repeated lookup (via ExecutionSession::lookup) of
12 // the given symbols.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_EXECUTIONENGINE_ORC_LOOKUPANDRECORDADDRS_H
17 #define LLVM_EXECUTIONENGINE_ORC_LOOKUPANDRECORDADDRS_H
18 
22 
23 #include <vector>
24 
25 namespace llvm {
26 namespace orc {
27 
28 /// Record addresses of the given symbols in the given ExecutorAddrs.
29 ///
30 /// Useful for making permanent records of symbol addreses to call or
31 /// access in the executor (e.g. runtime support functions in Platform
32 /// subclasses).
33 ///
34 /// By default the symbols are looked up using
35 /// SymbolLookupFlags::RequiredSymbol, and an error will be generated if any of
36 /// the requested symbols are not defined.
37 ///
38 /// If SymbolLookupFlags::WeaklyReferencedSymbol is used then any missing
39 /// symbols will have their corresponding address objects set to zero, and
40 /// this function will never generate an error (the caller will need to check
41 /// addresses before using them).
42 ///
43 /// Asynchronous version.
45  unique_function<void(Error)> OnRecorded, ExecutionSession &ES, LookupKind K,
46  const JITDylibSearchOrder &SearchOrder,
47  std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
49 
50 /// Record addresses of the given symbols in the given ExecutorAddrs.
51 ///
52 /// Blocking version.
54  ExecutionSession &ES, LookupKind K, const JITDylibSearchOrder &SearchOrder,
55  std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
57 
58 /// Record addresses of given symbols in the given ExecutorAddrs.
59 ///
60 /// ExecutorProcessControl lookup version. Lookups are always implicitly
61 /// weak.
63  ExecutorProcessControl &EPC, tpctypes::DylibHandle H,
64  std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
66 
67 } // End namespace orc
68 } // End namespace llvm
69 
70 #endif // LLVM_EXECUTIONENGINE_ORC_LOOKUPANDRECORDADDRS_H
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::lltok::Error
@ Error
Definition: LLToken.h:21
FunctionExtras.h
llvm::orc::LookupKind
LookupKind
Describes the kind of lookup being performed.
Definition: Core.h:149
llvm::orc::SymbolLookupFlags
SymbolLookupFlags
Lookup flags that apply to each symbol in a lookup.
Definition: Core.h:137
llvm::orc::tpctypes::DylibHandle
JITTargetAddress DylibHandle
A handle used to represent a loaded dylib in the target process.
Definition: TargetProcessControlTypes.h:142
llvm::orc::JITDylibSearchOrder
std::vector< std::pair< JITDylib *, JITDylibLookupFlags > > JITDylibSearchOrder
A list of (JITDylib*, JITDylibLookupFlags) pairs to be used as a search order during symbol lookup.
Definition: Core.h:154
H
#define H(x, y, z)
Definition: MD5.cpp:58
ExecutorAddress.h
Core.h
llvm::orc::SymbolLookupFlags::RequiredSymbol
@ RequiredSymbol
llvm::orc::lookupAndRecordAddrs
void lookupAndRecordAddrs(unique_function< void(Error)> OnRecorded, ExecutionSession &ES, LookupKind K, const JITDylibSearchOrder &SearchOrder, std::vector< std::pair< SymbolStringPtr, ExecutorAddr * >> Pairs, SymbolLookupFlags LookupFlags=SymbolLookupFlags::RequiredSymbol)
Record addresses of the given symbols in the given ExecutorAddrs.
Definition: LookupAndRecordAddrs.cpp:16