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/docs/tutorial | |
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/docs/tutorial')
-rw-r--r-- | llvm/docs/tutorial/BuildingAJIT1.rst | 8 | ||||
-rw-r--r-- | llvm/docs/tutorial/BuildingAJIT3.rst | 4 |
2 files changed, 4 insertions, 8 deletions
diff --git a/llvm/docs/tutorial/BuildingAJIT1.rst b/llvm/docs/tutorial/BuildingAJIT1.rst index e51acb48..8c82dbe 100644 --- a/llvm/docs/tutorial/BuildingAJIT1.rst +++ b/llvm/docs/tutorial/BuildingAJIT1.rst @@ -67,7 +67,7 @@ just two functions: 1. ``Error addModule(std::unique_ptr<Module> M)``: Make the given IR module available for execution. -2. ``Expected<JITEvaluatedSymbol> lookup()``: Search for pointers to +2. ``Expected<ExecutorSymbolDef> lookup()``: Search for pointers to symbols (functions or variables) that have been added to the JIT. A basic use-case for this API, executing the 'main' function from a module, @@ -110,7 +110,6 @@ usual include guards and #includes [2]_, we get to the definition of our class: #define LLVM_EXECUTIONENGINE_ORC_KALEIDOSCOPEJIT_H #include "llvm/ADT/StringRef.h" - #include "llvm/ExecutionEngine/JITSymbol.h" #include "llvm/ExecutionEngine/Orc/CompileUtils.h" #include "llvm/ExecutionEngine/Orc/Core.h" #include "llvm/ExecutionEngine/Orc/ExecutionUtils.h" @@ -224,7 +223,7 @@ will build our IR modules. ThreadSafeModule(std::move(M), Ctx))); } - Expected<JITEvaluatedSymbol> lookup(StringRef Name) { + Expected<ExecutorSymbolDef> lookup(StringRef Name) { return ES.lookup({&ES.getMainJITDylib()}, Mangle(Name.str())); } @@ -295,9 +294,6 @@ Here is the code: .. [2] +-----------------------------+-----------------------------------------------+ | File | Reason for inclusion | +=============================+===============================================+ - | JITSymbol.h | Defines the lookup result type | - | | JITEvaluatedSymbol | - +-----------------------------+-----------------------------------------------+ | CompileUtils.h | Provides the SimpleCompiler class. | +-----------------------------+-----------------------------------------------+ | Core.h | Core utilities such as ExecutionSession and | diff --git a/llvm/docs/tutorial/BuildingAJIT3.rst b/llvm/docs/tutorial/BuildingAJIT3.rst index 36ec2e7..d4b3e6f 100644 --- a/llvm/docs/tutorial/BuildingAJIT3.rst +++ b/llvm/docs/tutorial/BuildingAJIT3.rst @@ -119,8 +119,8 @@ to create the compile callback needed for each function. Next we have to update our constructor to initialize the new members. To create an appropriate compile callback manager we use the -createLocalCompileCallbackManager function, which takes a TargetMachine and a -JITTargetAddress to call if it receives a request to compile an unknown +createLocalCompileCallbackManager function, which takes a TargetMachine and an +ExecutorAddr to call if it receives a request to compile an unknown function. In our simple JIT this situation is unlikely to come up, so we'll cheat and just pass '0' here. In a production quality JIT you could give the address of a function that throws an exception in order to unwind the JIT'd |