Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:53

0001 //===-- LookupAndRecordAddrs.h - Symbol lookup support utility --*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // Record the addresses of a set of symbols into ExecutorAddr objects.
0010 //
0011 // This can be used to avoid repeated lookup (via ExecutionSession::lookup) of
0012 // the given symbols.
0013 //
0014 //===----------------------------------------------------------------------===//
0015 
0016 #ifndef LLVM_EXECUTIONENGINE_ORC_LOOKUPANDRECORDADDRS_H
0017 #define LLVM_EXECUTIONENGINE_ORC_LOOKUPANDRECORDADDRS_H
0018 
0019 #include "llvm/ADT/FunctionExtras.h"
0020 #include "llvm/ExecutionEngine/Orc/Core.h"
0021 #include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
0022 
0023 #include <vector>
0024 
0025 namespace llvm {
0026 namespace orc {
0027 
0028 /// Record addresses of the given symbols in the given ExecutorAddrs.
0029 ///
0030 /// Useful for making permanent records of symbol addreses to call or
0031 /// access in the executor (e.g. runtime support functions in Platform
0032 /// subclasses).
0033 ///
0034 /// By default the symbols are looked up using
0035 /// SymbolLookupFlags::RequiredSymbol, and an error will be generated if any of
0036 /// the requested symbols are not defined.
0037 ///
0038 /// If SymbolLookupFlags::WeaklyReferencedSymbol is used then any missing
0039 /// symbols will have their corresponding address objects set to zero, and
0040 /// this function will never generate an error (the caller will need to check
0041 /// addresses before using them).
0042 ///
0043 /// Asynchronous version.
0044 void lookupAndRecordAddrs(
0045     unique_function<void(Error)> OnRecorded, ExecutionSession &ES, LookupKind K,
0046     const JITDylibSearchOrder &SearchOrder,
0047     std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
0048     SymbolLookupFlags LookupFlags = SymbolLookupFlags::RequiredSymbol);
0049 
0050 /// Record addresses of the given symbols in the given ExecutorAddrs.
0051 ///
0052 /// Blocking version.
0053 Error lookupAndRecordAddrs(
0054     ExecutionSession &ES, LookupKind K, const JITDylibSearchOrder &SearchOrder,
0055     std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
0056     SymbolLookupFlags LookupFlags = SymbolLookupFlags::RequiredSymbol);
0057 
0058 /// Record addresses of given symbols in the given ExecutorAddrs.
0059 ///
0060 /// ExecutorProcessControl lookup version. Lookups are always implicitly
0061 /// weak.
0062 Error lookupAndRecordAddrs(
0063     ExecutorProcessControl &EPC, tpctypes::DylibHandle H,
0064     std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
0065     SymbolLookupFlags LookupFlags = SymbolLookupFlags::RequiredSymbol);
0066 
0067 } // End namespace orc
0068 } // End namespace llvm
0069 
0070 #endif // LLVM_EXECUTIONENGINE_ORC_LOOKUPANDRECORDADDRS_H