[llvm] d120d77 - [ORC] Simplify construction of EPCIndirectionUtils.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 7 16:28:12 PDT 2023
Author: Lang Hames
Date: 2023-06-07T16:28:07-07:00
New Revision: d120d77f72fe161f1522d698ea268be2dad318cb
URL: https://github.com/llvm/llvm-project/commit/d120d77f72fe161f1522d698ea268be2dad318cb
DIFF: https://github.com/llvm/llvm-project/commit/d120d77f72fe161f1522d698ea268be2dad318cb.diff
LOG: [ORC] Simplify construction of EPCIndirectionUtils.
ExecutionSessions always have an ExecutorProcessControl object now, so we can
construct EPCIndirectionUtil objects directly from an ExecutionSession.
Added:
Modified:
llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h
llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h
llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/LLJITWithExecutorProcessControl.cpp
llvm/include/llvm/ExecutionEngine/Orc/EPCIndirectionUtils.h
Removed:
################################################################################
diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h
index 2be9cde9283d8..5cc6824141cf3 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h
@@ -90,7 +90,7 @@ class KaleidoscopeJIT {
auto ES = std::make_unique<ExecutionSession>(std::move(*EPC));
- auto EPCIU = EPCIndirectionUtils::Create(ES->getExecutorProcessControl());
+ auto EPCIU = EPCIndirectionUtils::Create(*ES);
if (!EPCIU)
return EPCIU.takeError();
diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h
index ecd05d517dc68..db8136a468c70 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h
@@ -175,7 +175,7 @@ class KaleidoscopeJIT {
auto ES = std::make_unique<ExecutionSession>(std::move(*EPC));
- auto EPCIU = EPCIndirectionUtils::Create(ES->getExecutorProcessControl());
+ auto EPCIU = EPCIndirectionUtils::Create(*ES);
if (!EPCIU)
return EPCIU.takeError();
diff --git a/llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/LLJITWithExecutorProcessControl.cpp b/llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/LLJITWithExecutorProcessControl.cpp
index 8d2ac3261e399..a219cab6e2f77 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/LLJITWithExecutorProcessControl.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/LLJITWithExecutorProcessControl.cpp
@@ -144,8 +144,7 @@ int main(int argc, char *argv[]) {
});
// (3) Create stubs and call-through managers:
- auto EPCIU = ExitOnErr(EPCIndirectionUtils::Create(
- J->getExecutionSession().getExecutorProcessControl()));
+ auto EPCIU = ExitOnErr(EPCIndirectionUtils::Create(J->getExecutionSession()));
ExitOnErr(EPCIU->writeResolverBlock(ExecutorAddr::fromPtr(&reenter),
ExecutorAddr::fromPtr(EPCIU.get())));
EPCIU->createLazyCallThroughManager(
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/EPCIndirectionUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/EPCIndirectionUtils.h
index 867a029abc4d4..2834331b21f20 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/EPCIndirectionUtils.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/EPCIndirectionUtils.h
@@ -84,6 +84,12 @@ class EPCIndirectionUtils {
static Expected<std::unique_ptr<EPCIndirectionUtils>>
Create(ExecutorProcessControl &EPC);
+ /// Create based on the ExecutorProcessControl triple.
+ static Expected<std::unique_ptr<EPCIndirectionUtils>>
+ Create(ExecutionSession &ES) {
+ return Create(ES.getExecutorProcessControl());
+ }
+
/// Return a reference to the ExecutorProcessControl object.
ExecutorProcessControl &getExecutorProcessControl() const { return EPC; }
More information about the llvm-commits
mailing list