From 8b1771bd9f304be39d4dcbdcccedb6d3bcd18200 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Wed, 22 Mar 2023 11:45:10 -0700 Subject: [ORC] Move most ORC APIs to ExecutorAddr, introduce ExecutorSymbolDef. ExecutorAddr was introduced in b8e5f918166 as an eventual replacement for JITTargetAddress. ExecutorSymbolDef is introduced in this patch as a replacement for JITEvaluatedSymbol: ExecutorSymbolDef is an (ExecutorAddr, JITSymbolFlags) pair, where JITEvaluatedSymbol was a (JITTargetAddress, JITSymbolFlags) pair. A number of APIs had already migrated from JITTargetAddress to ExecutorAddr, but many of ORC's internals were still using the older type. This patch aims to address that. Some public APIs are affected as well. If you need to migrate your APIs you can use the following operations: * ExecutorAddr::toPtr replaces jitTargetAddressToPointer and jitTargetAddressToFunction. * ExecutorAddr::fromPtr replace pointerToJITTargetAddress. * ExecutorAddr(JITTargetAddress) creates an ExecutorAddr value from a JITTargetAddress. * ExecutorAddr::getValue() creates a JITTargetAddress value from an ExecutorAddr. JITTargetAddress and JITEvaluatedSymbol will remain in JITSymbol.h for now, but the aim will be to eventually deprecate and remove these types (probably when MCJIT and RuntimeDyld are deprecated). --- llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp') diff --git a/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp b/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp index 9103c62..03dd6b5 100644 --- a/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp +++ b/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp @@ -40,7 +40,7 @@ bool hasInitializerSection(jitlink::LinkGraph &G) { return false; } -JITTargetAddress getJITSymbolPtrForSymbol(Symbol &Sym, const Triple &TT) { +ExecutorAddr getJITSymbolPtrForSymbol(Symbol &Sym, const Triple &TT) { uint64_t CallableAddr = Sym.getAddress().getValue(); switch (TT.getArch()) { case Triple::arm: @@ -53,7 +53,7 @@ JITTargetAddress getJITSymbolPtrForSymbol(Symbol &Sym, const Triple &TT) { default: break; } - return CallableAddr; + return ExecutorAddr(CallableAddr); } JITSymbolFlags getJITSymbolFlagsForSymbol(Symbol &Sym) { @@ -234,7 +234,7 @@ public: auto InternedName = ES.intern(Sym->getName()); auto Ptr = getJITSymbolPtrForSymbol(*Sym, G.getTargetTriple()); auto Flags = getJITSymbolFlagsForSymbol(*Sym); - InternedResult[InternedName] = JITEvaluatedSymbol(Ptr, Flags); + InternedResult[InternedName] = {Ptr, Flags}; if (AutoClaim && !MR->getSymbols().count(InternedName)) { assert(!ExtraSymbolsToClaim.count(InternedName) && "Duplicate symbol to claim?"); @@ -247,7 +247,7 @@ public: auto InternedName = ES.intern(Sym->getName()); auto Ptr = getJITSymbolPtrForSymbol(*Sym, G.getTargetTriple()); auto Flags = getJITSymbolFlagsForSymbol(*Sym); - InternedResult[InternedName] = JITEvaluatedSymbol(Ptr, Flags); + InternedResult[InternedName] = {Ptr, Flags}; if (AutoClaim && !MR->getSymbols().count(InternedName)) { assert(!ExtraSymbolsToClaim.count(InternedName) && "Duplicate symbol to claim?"); -- cgit v1.1