LLVM 23.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
24
25#include <vector>
26
27namespace llvm {
28namespace orc {
29
30/// Record addresses of the given symbols in the given ExecutorAddrs.
31///
32/// Useful for making permanent records of symbol addreses to call or
33/// access in the executor (e.g. runtime support functions in Platform
34/// subclasses).
35///
36/// By default the symbols are looked up using
37/// SymbolLookupFlags::RequiredSymbol, and an error will be generated if any of
38/// the requested symbols are not defined.
39///
40/// If SymbolLookupFlags::WeaklyReferencedSymbol is used then any missing
41/// symbols will have their corresponding address objects set to zero, and
42/// this function will never generate an error (the caller will need to check
43/// addresses before using them).
44///
45/// Asynchronous version.
47 unique_function<void(Error)> OnRecorded, ExecutionSession &ES, LookupKind K,
48 const JITDylibSearchOrder &SearchOrder,
49 std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
51
52/// Record addresses of the given symbols in the given ExecutorAddrs.
53///
54/// Blocking version.
56 ExecutionSession &ES, LookupKind K, const JITDylibSearchOrder &SearchOrder,
57 std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
59
60} // End namespace orc
61} // End namespace llvm
62
63#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...
An ExecutionSession represents a running JIT program.
Definition Core.h:1355
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:177
SymbolLookupFlags
Lookup flags that apply to each symbol in a lookup.
Definition Core.h:161
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:173
This is an optimization pass for GlobalISel generic memory operations.