20constexpr StringRef FnBodySuffix =
"$orc_fnbody";
37 [&MR](
LinkGraph &
G) { return renameFunctionBodies(G, MR); });
56 if ((*Name).ends_with(FnBodySuffix))
57 SymsToRename[(*Name).drop_back(FnBodySuffix.size())] =
60 for (
auto *Sym :
G.defined_symbols()) {
63 auto I = SymsToRename.
find(*Sym->getName());
64 if (
I == SymsToRename.
end())
66 Sym->setName(
G.intern(
G.allocateName(*
I->second)));
77 BaseLayer.addPlugin(std::make_unique<RenamerPlugin>());
81 std::unique_ptr<MemoryBuffer> O,
86 return BaseLayer.add(std::move(RT), std::move(O), std::move(
I));
90 for (
auto &[Name, Flags] :
I.SymbolFlags)
91 if (Flags.isCallable())
92 LazySymbols[Name] = {ES.intern((*Name + FnBodySuffix).str()), Flags};
94 for (
auto &[Name, AI] : LazySymbols) {
95 I.SymbolFlags.erase(Name);
96 I.SymbolFlags[AI.Aliasee] = AI.AliasFlags;
99 if (
auto Err = BaseLayer.add(RT, std::move(O), std::move(
I)))
102 auto &JD = RT->getJITDylib();
103 return JD.define(
lazyReexports(LRMgr, std::move(LazySymbols)), std::move(RT));
107 std::unique_ptr<MaterializationResponsibility> MR,
108 std::unique_ptr<MemoryBuffer> Obj) {
109 return BaseLayer.emit(std::move(MR), std::move(Obj));
iterator find(const_arg_type_t< KeyT > Val)
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
StringRef - Represent a constant reference to a string, i.e.
Represents a JIT'd dynamic library.
void modifyPassConfig(MaterializationResponsibility &MR, jitlink::LinkGraph &LG, jitlink::PassConfiguration &Config) override
Error notifyFailed(MaterializationResponsibility &MR) override
Error notifyRemovingResources(JITDylib &JD, ResourceKey K) override
void notifyTransferringResources(JITDylib &JD, ResourceKey DstKey, ResourceKey SrcKey) override
void emit(std::unique_ptr< MaterializationResponsibility > R, std::unique_ptr< MemoryBuffer > O) override
Emit should materialize the given IR.
LazyObjectLinkingLayer(ObjectLinkingLayer &BaseLayer, LazyReexportsManager &LRMgr)
llvm::Error add(llvm::orc::ResourceTrackerSP RT, std::unique_ptr< MemoryBuffer > O, MaterializationUnit::Interface I) override
Add an object file to the JITDylib targeted by the given tracker.
Plugin instances can be added to the ObjectLinkingLayer to receive callbacks when code is loaded or e...
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
const SymbolFlagsMap & getSymbols() const
Returns the symbol flags map for this responsibility instance.
Non-owning SymbolStringPool entry pointer.
ObjectLayer(ExecutionSession &ES)
ExecutionSession & getExecutionSession()
Returns the execution session for this layer.
An ObjectLayer implementation built on JITLink.
IntrusiveRefCntPtr< ResourceTracker > ResourceTrackerSP
std::unique_ptr< LazyReexportsMaterializationUnit > lazyReexports(LazyCallThroughManager &LCTManager, RedirectableSymbolManager &RSManager, JITDylib &SourceJD, SymbolAliasMap CallableAliases, ImplSymbolMap *SrcJDLoc=nullptr)
Define lazy-reexports based on the given SymbolAliasMap.
DenseMap< SymbolStringPtr, SymbolAliasMapEntry > SymbolAliasMap
A map of Symbols to (Symbol, Flags) pairs.
This is an optimization pass for GlobalISel generic memory operations.
An LinkGraph pass configuration, consisting of a list of pre-prune, post-prune, and post-fixup passes...
LinkGraphPassList PrePrunePasses
Pre-prune passes.