diff options
author | Lang Hames <lhames@gmail.com> | 2023-03-22 11:45:10 -0700 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2023-03-27 17:37:58 -0700 |
commit | 8b1771bd9f304be39d4dcbdcccedb6d3bcd18200 (patch) | |
tree | d4476527433f9c724e2befd071ed0102259d8ebd /llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp | |
parent | 41a964cff0068ba417d355b499f10ecedd4a4636 (diff) | |
download | llvm-8b1771bd9f304be39d4dcbdcccedb6d3bcd18200.zip llvm-8b1771bd9f304be39d4dcbdcccedb6d3bcd18200.tar.gz llvm-8b1771bd9f304be39d4dcbdcccedb6d3bcd18200.tar.bz2 |
[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).
Diffstat (limited to 'llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp index 9606d8e..8f2537d 100644 --- a/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp +++ b/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp @@ -40,7 +40,7 @@ public: private: void materialize(std::unique_ptr<MaterializationResponsibility> R) override { SymbolMap Result; - Result[Name] = JITEvaluatedSymbol(Compile(), JITSymbolFlags::Exported); + Result[Name] = {Compile(), JITSymbolFlags::Exported}; // No dependencies, so these calls cannot fail. cantFail(R->notifyResolved(Result)); cantFail(R->notifyEmitted()); @@ -62,7 +62,7 @@ namespace orc { TrampolinePool::~TrampolinePool() = default; void IndirectStubsManager::anchor() {} -Expected<JITTargetAddress> +Expected<ExecutorAddr> JITCompileCallbackManager::getCompileCallback(CompileFunction Compile) { if (auto TrampolineAddr = TP->getTrampoline()) { auto CallbackName = @@ -78,8 +78,8 @@ JITCompileCallbackManager::getCompileCallback(CompileFunction Compile) { return TrampolineAddr.takeError(); } -JITTargetAddress JITCompileCallbackManager::executeCompileCallback( - JITTargetAddress TrampolineAddr) { +ExecutorAddr +JITCompileCallbackManager::executeCompileCallback(ExecutorAddr TrampolineAddr) { SymbolStringPtr Name; { @@ -91,14 +91,10 @@ JITTargetAddress JITCompileCallbackManager::executeCompileCallback( // callee. if (I == AddrToSymbol.end()) { Lock.unlock(); - std::string ErrMsg; - { - raw_string_ostream ErrMsgStream(ErrMsg); - ErrMsgStream << "No compile callback for trampoline at " - << format("0x%016" PRIx64, TrampolineAddr); - } ES.reportError( - make_error<StringError>(std::move(ErrMsg), inconvertibleErrorCode())); + make_error<StringError>("No compile callback for trampoline at " + + formatv("{0:x}", TrampolineAddr), + inconvertibleErrorCode())); return ErrorHandlerAddress; } else Name = I->second; @@ -120,7 +116,7 @@ JITTargetAddress JITCompileCallbackManager::executeCompileCallback( Expected<std::unique_ptr<JITCompileCallbackManager>> createLocalCompileCallbackManager(const Triple &T, ExecutionSession &ES, - JITTargetAddress ErrorHandlerAddress) { + ExecutorAddr ErrorHandlerAddress) { switch (T.getArch()) { default: return make_error<StringError>( @@ -244,9 +240,9 @@ createLocalIndirectStubsManagerBuilder(const Triple &T) { } } -Constant* createIRTypedAddress(FunctionType &FT, JITTargetAddress Addr) { +Constant* createIRTypedAddress(FunctionType &FT, ExecutorAddr Addr) { Constant *AddrIntVal = - ConstantInt::get(Type::getInt64Ty(FT.getContext()), Addr); + ConstantInt::get(Type::getInt64Ty(FT.getContext()), Addr.getValue()); Constant *AddrPtrVal = ConstantExpr::getCast(Instruction::IntToPtr, AddrIntVal, PointerType::get(&FT, 0)); |