LLVM: include/llvm/ExecutionEngine/Orc/RedirectionManager.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_EXECUTIONENGINE_ORC_REDIRECTIONMANAGER_H
14#define LLVM_EXECUTIONENGINE_ORC_REDIRECTIONMANAGER_H
15
18
19namespace llvm {
20namespace orc {
21
22
23
25public:
27
28
29
31
32
33
36 return redirect(JD, {{std::move(Symbol), NewDest}});
37 }
38
39private:
40 virtual void anchor();
41};
42
43
44
46public:
47
48
51
52
53
58
59
60 virtual void
63};
64
65
66
68public:
72 InitialDests(std::move(InitialDests)) {}
73
75 return "RedirectableSymbolMaterializationUnit";
76 }
77
78 void materialize(std::unique_ptr R) override {
79 RM.emitRedirectableSymbols(std::move(R), std::move(InitialDests));
80 }
81
83 InitialDests.erase(Name);
84 }
85
86private:
88 convertToFlags(const SymbolMap &InitialDests) {
90 for (auto [K, V] : InitialDests)
91 Flags[K] = V.getFlags();
93 }
94
95 RedirectableSymbolManager &RM;
97};
98
99}
100}
101
102#endif
Lightweight error class with error context and mandatory checking.
StringRef - Represent a constant reference to a string, i.e.
Represents a defining location for a JIT symbol.
Represents a JIT'd dynamic library.
MaterializationUnit(Interface I)
StringRef getName() const override
Return the name of this materialization unit.
Definition RedirectionManager.h:74
RedirectableMaterializationUnit(RedirectableSymbolManager &RM, SymbolMap InitialDests)
Definition RedirectionManager.h:69
void discard(const JITDylib &JD, const SymbolStringPtr &Name) override
Implementations of this method should discard the given symbol from the source (e....
Definition RedirectionManager.h:82
void materialize(std::unique_ptr< MaterializationResponsibility > R) override
Implementations of this method should materialize all symbols in the materialzation unit,...
Definition RedirectionManager.h:78
Base class for managing redirectable symbols in which a call gets redirected to another symbol in run...
Definition RedirectionManager.h:45
LLVM_ABI Error createRedirectableSymbols(ResourceTrackerSP RT, SymbolMap InitialDests)
Create redirectable symbols with given symbol names and initial desitnation symbol addresses.
Error createRedirectableSymbol(ResourceTrackerSP RT, SymbolStringPtr Symbol, ExecutorSymbolDef InitialDest)
Create a single redirectable symbol with given symbol name and initial desitnation symbol address.
Definition RedirectionManager.h:54
virtual void emitRedirectableSymbols(std::unique_ptr< MaterializationResponsibility > MR, SymbolMap InitialDests)=0
Emit redirectable symbol.
Base class for performing redirection of call to symbol to another symbol in runtime.
Definition RedirectionManager.h:24
virtual Error redirect(JITDylib &JD, const SymbolMap &NewDests)=0
Change the redirection destination of given symbols to new destination symbols.
virtual ~RedirectionManager()=default
Error redirect(JITDylib &JD, SymbolStringPtr Symbol, ExecutorSymbolDef NewDest)
Change the redirection destination of given symbol to new destination symbol.
Definition RedirectionManager.h:34
Pointer to a pooled string representing a symbol name.
IntrusiveRefCntPtr< ResourceTracker > ResourceTrackerSP
DenseMap< SymbolStringPtr, ExecutorSymbolDef > SymbolMap
A map from symbol names (as SymbolStringPtrs) to JITSymbols (address/flags pairs).
DenseMap< SymbolStringPtr, JITSymbolFlags > SymbolFlagsMap
A map from symbol names (as SymbolStringPtrs) to JITSymbolFlags.
This is an optimization pass for GlobalISel generic memory operations.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.