[llvm] 2addaed - [docs] Use ExecutorAddr::toPtr() in ORC documentation.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Wed May 31 15:16:01 PDT 2023
Author: Mike Rostecki
Date: 2023-05-31T15:15:55-07:00
New Revision: 2addaeda18adb5a26320693f9b34df8495b8a225
URL: https://github.com/llvm/llvm-project/commit/2addaeda18adb5a26320693f9b34df8495b8a225
DIFF: https://github.com/llvm/llvm-project/commit/2addaeda18adb5a26320693f9b34df8495b8a225.diff
LOG: [docs] Use ExecutorAddr::toPtr() in ORC documentation.
The partial move from JITTargetAddress to ExecutorAddr in 8b1771bd9f30 did not
update the ORC or Kaleidoscope documents. This patch fixes the inconsistency.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D150458
Added:
Modified:
llvm/docs/ORCv2.rst
llvm/docs/tutorial/BuildingAJIT1.rst
llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst
Removed:
################################################################################
diff --git a/llvm/docs/ORCv2.rst b/llvm/docs/ORCv2.rst
index 203f389dab233..fbe9eee962a7e 100644
--- a/llvm/docs/ORCv2.rst
+++ b/llvm/docs/ORCv2.rst
@@ -124,7 +124,7 @@ module ``M`` loaded on a ThreadSafeContext ``Ctx``:
return EntrySym.takeError();
// Cast the entry point address to a function pointer.
- auto *Entry = (void(*)())EntrySym.getAddress();
+ auto *Entry = EntrySym.getAddress().toPtr<void(*)()>();
// Call into JIT'd code.
Entry();
@@ -204,7 +204,7 @@ In ORC, this would translate into API calls on a hypothetical CXXCompilingLayer
// Look up the JIT'd main, cast it to a function pointer, then call it.
auto MainSym = ExitOnErr(ES.lookup({&MainJD}, "main"));
- auto *Main = (int(*)(int, char*[]))MainSym.getAddress();
+ auto *Main = MainSym.getAddress().toPtr<int(*)(int, char *[])>();
int Result = Main(...);
diff --git a/llvm/docs/tutorial/BuildingAJIT1.rst b/llvm/docs/tutorial/BuildingAJIT1.rst
index 8c82dbe4c1a7f..8d79eb9eb3ca2 100644
--- a/llvm/docs/tutorial/BuildingAJIT1.rst
+++ b/llvm/docs/tutorial/BuildingAJIT1.rst
@@ -77,7 +77,7 @@ will look like:
JIT J;
J.addModule(buildModule());
- auto *Main = (int(*)(int, char*[]))J.lookup("main").getAddress();
+ auto *Main = J.lookup("main").getAddress().toPtr<int(*)(int, char *[])>();
int Result = Main();
The APIs that we build in these tutorials will all be variations on this simple
diff --git a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst
index 32db7b59db948..79bb1f1c8f842 100644
--- a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst
+++ b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst
@@ -317,7 +317,7 @@ look like this:
// Get the symbol's address and cast it to the right type (takes no
// arguments, returns a double) so we can call it as a native function.
- double (*FP)() = (double (*)())(intptr_t)ExprSymbol.getAddress();
+ double (*FP)() = ExprSymbol.getAddress().toPtr<double (*)()>();
fprintf(stderr, "Evaluated to %f\n", FP());
// Delete the anonymous expression module from the JIT.
More information about the llvm-commits
mailing list