LLVM 19.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
25namespace llvm {
26namespace 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
This file provides a collection of function (or more generally, callable) type erasure utilities supp...
#define H(x, y, z)
Definition: MD5.cpp:57
ExecutorAddr DylibHandle
A handle used to represent a loaded dylib in the target process.
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:162
SymbolLookupFlags
Lookup flags that apply to each symbol in a lookup.
Definition: Core.h:145
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.
LookupKind
Describes the kind of lookup being performed.
Definition: Core.h:157
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18