LLVM  14.0.0git
EPCDynamicLibrarySearchGenerator.h
Go to the documentation of this file.
1 //===------------ EPCDynamicLibrarySearchGenerator.h ------------*- 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 // Support loading and searching of dynamic libraries in an executor process
10 // via the ExecutorProcessControl class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_EXECUTIONENGINE_ORC_EPCDYNAMICLIBRARYSEARCHGENERATOR_H
15 #define LLVM_EXECUTIONENGINE_ORC_EPCDYNAMICLIBRARYSEARCHGENERATOR_H
16 
19 
20 namespace llvm {
21 namespace orc {
22 
23 class ExecutorProcessControl;
24 
26 public:
28 
29  /// Create a DynamicLibrarySearchGenerator that searches for symbols in the
30  /// library with the given handle.
31  ///
32  /// If the Allow predicate is given then only symbols matching the predicate
33  /// will be searched for. If the predicate is not given then all symbols will
34  /// be searched for.
38  : EPC(ES.getExecutorProcessControl()), H(H), Allow(std::move(Allow)) {}
39 
40  /// Permanently loads the library at the given path and, on success, returns
41  /// a DynamicLibrarySearchGenerator that will search it for symbol definitions
42  /// in the library. On failure returns the reason the library failed to load.
44  Load(ExecutionSession &ES, const char *LibraryPath,
46 
47  /// Creates a EPCDynamicLibrarySearchGenerator that searches for symbols in
48  /// the target process.
51  SymbolPredicate Allow = SymbolPredicate()) {
52  return Load(ES, nullptr, std::move(Allow));
53  }
54 
56  JITDylibLookupFlags JDLookupFlags,
57  const SymbolLookupSet &Symbols) override;
58 
59 private:
62  SymbolPredicate Allow;
63 };
64 
65 } // end namespace orc
66 } // end namespace llvm
67 
68 #endif // LLVM_EXECUTIONENGINE_ORC_EPCDYNAMICLIBRARYSEARCHGENERATOR_H
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::orc::JITDylib
A symbol table that supports asynchoronous symbol queries.
Definition: Core.h:907
FunctionExtras.h
llvm::unique_function< bool(const SymbolStringPtr &)>
llvm::orc::SymbolLookupSet
A set of symbols to look up, each associated with a SymbolLookupFlags value.
Definition: Core.h:174
llvm::orc::SymbolStringPtr
Pointer to a pooled string representing a symbol name.
Definition: SymbolStringPool.h:50
llvm::orc::ExecutorProcessControl
ExecutorProcessControl supports interaction with a JIT target process.
Definition: ExecutorProcessControl.h:38
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::orc::LookupKind
LookupKind
Describes the kind of lookup being performed.
Definition: Core.h:148
llvm::orc::EPCDynamicLibrarySearchGenerator::Load
static Expected< std::unique_ptr< EPCDynamicLibrarySearchGenerator > > Load(ExecutionSession &ES, const char *LibraryPath, SymbolPredicate Allow=SymbolPredicate())
Permanently loads the library at the given path and, on success, returns a DynamicLibrarySearchGenera...
Definition: EPCDynamicLibrarySearchGenerator.cpp:15
llvm::orc::tpctypes::DylibHandle
JITTargetAddress DylibHandle
A handle used to represent a loaded dylib in the target process.
Definition: TargetProcessControlTypes.h:142
uint64_t
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1609
llvm::orc::DefinitionGenerator
Definition generators can be attached to JITDylibs to generate new definitions for otherwise unresolv...
Definition: Core.h:886
llvm::orc::EPCDynamicLibrarySearchGenerator::tryToGenerate
Error tryToGenerate(LookupState &LS, LookupKind K, JITDylib &JD, JITDylibLookupFlags JDLookupFlags, const SymbolLookupSet &Symbols) override
DefinitionGenerators should override this method to insert new definitions into the parent JITDylib.
Definition: EPCDynamicLibrarySearchGenerator.cpp:26
llvm::orc::LookupState
Wraps state for a lookup-in-progress.
Definition: Core.h:861
llvm::orc::EPCDynamicLibrarySearchGenerator::GetForTargetProcess
static Expected< std::unique_ptr< EPCDynamicLibrarySearchGenerator > > GetForTargetProcess(ExecutionSession &ES, SymbolPredicate Allow=SymbolPredicate())
Creates a EPCDynamicLibrarySearchGenerator that searches for symbols in the target process.
Definition: EPCDynamicLibrarySearchGenerator.h:50
std
Definition: BitVector.h:838
H
#define H(x, y, z)
Definition: MD5.cpp:58
llvm::orc::EPCDynamicLibrarySearchGenerator::SymbolPredicate
unique_function< bool(const SymbolStringPtr &)> SymbolPredicate
Definition: EPCDynamicLibrarySearchGenerator.h:27
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::orc::ExecutionSession
An ExecutionSession represents a running JIT program.
Definition: Core.h:1275
llvm::AArch64CC::LS
@ LS
Definition: AArch64BaseInfo.h:264
llvm::orc::EPCDynamicLibrarySearchGenerator
Definition: EPCDynamicLibrarySearchGenerator.h:25
Core.h
llvm::orc::JITDylibLookupFlags
JITDylibLookupFlags
Lookup flags that apply to each dylib in the search order for a lookup.
Definition: Core.h:126
llvm::orc::EPCDynamicLibrarySearchGenerator::EPCDynamicLibrarySearchGenerator
EPCDynamicLibrarySearchGenerator(ExecutionSession &ES, tpctypes::DylibHandle H, SymbolPredicate Allow=SymbolPredicate())
Create a DynamicLibrarySearchGenerator that searches for symbols in the library with the given handle...
Definition: EPCDynamicLibrarySearchGenerator.h:35