LLVM 22.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
23
24#include <vector>
25
26namespace llvm {
27namespace orc {
28
29/// Record addresses of the given symbols in the given ExecutorAddrs.
30///
31/// Useful for making permanent records of symbol addreses to call or
32/// access in the executor (e.g. runtime support functions in Platform
33/// subclasses).
34///
35/// By default the symbols are looked up using
36/// SymbolLookupFlags::RequiredSymbol, and an error will be generated if any of
37/// the requested symbols are not defined.
38///
39/// If SymbolLookupFlags::WeaklyReferencedSymbol is used then any missing
40/// symbols will have their corresponding address objects set to zero, and
41/// this function will never generate an error (the caller will need to check
42/// addresses before using them).
43///
44/// Asynchronous version.
46 unique_function<void(Error)> OnRecorded, ExecutionSession &ES, LookupKind K,
47 const JITDylibSearchOrder &SearchOrder,
48 std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
50
51/// Record addresses of the given symbols in the given ExecutorAddrs.
52///
53/// Blocking version.
55 ExecutionSession &ES, LookupKind K, const JITDylibSearchOrder &SearchOrder,
56 std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
58
59/// Record addresses of given symbols in the given ExecutorAddrs.
60///
61/// ExecutorProcessControl lookup version. Lookups are always implicitly
62/// weak.
65 std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
67
68} // End namespace orc
69} // End namespace llvm
70
71#endif // LLVM_EXECUTIONENGINE_ORC_LOOKUPANDRECORDADDRS_H
#define LLVM_ABI
Definition Compiler.h:213
This file provides a collection of function (or more generally, callable) type erasure utilities supp...
#define H(x, y, z)
Definition MD5.cpp:57
An ExecutionSession represents a running JIT program.
Definition Core.h:1355
ExecutorProcessControl supports interaction with a JIT target process.
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:173
SymbolLookupFlags
Lookup flags that apply to each symbol in a lookup.
Definition Core.h:157
LLVM_ABI 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:169
This is an optimization pass for GlobalISel generic memory operations.