[llvm] c6ade39 - [ORC] Replace LLJIT::defineAbsolute with an LLJIT::define convenience method.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 18 15:18:47 PDT 2020
Author: Lang Hames
Date: 2020-04-18T14:16:54-07:00
New Revision: c6ade39ba083b92faf93fee42272f07749d4041a
URL: https://github.com/llvm/llvm-project/commit/c6ade39ba083b92faf93fee42272f07749d4041a
DIFF: https://github.com/llvm/llvm-project/commit/c6ade39ba083b92faf93fee42272f07749d4041a.diff
LOG: [ORC] Replace LLJIT::defineAbsolute with an LLJIT::define convenience method.
LLJIT::defineAbsolute did not mangle its Name argument, which is inconsistent
with the behavior of other LLJIT methods (e.g. lookup). Since it is currently
unused anyway, this commit replaces it with a generic 'define' convenience
method for adding MaterializationUnits to the main JITDylib. This simplifies
use of the generic absoluteSymbols function (as well as the symbolAlias,
reexports and other functions that generate MaterializationUnits) with LLJIT.
Added:
Modified:
llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
index 7d38d0884162..96f8e169e7dc 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -85,8 +85,21 @@ class LLJIT {
return ES->createJITDylib(std::move(Name));
}
- /// Convenience method for defining an absolute symbol.
- Error defineAbsolute(StringRef Name, JITEvaluatedSymbol Address);
+ /// A convenience method for defining MUs in LLJIT's Main JITDylib. This can
+ /// be useful for succinctly defining absolute symbols, aliases and
+ /// re-exports.
+ template <typename MUType>
+ Error define(std::unique_ptr<MUType> &&MU) {
+ return Main->define(std::move(MU));
+ }
+
+ /// A convenience method for defining MUs in LLJIT's Main JITDylib. This can
+ /// be usedful for succinctly defining absolute symbols, aliases and
+ /// re-exports.
+ template <typename MUType>
+ Error define(std::unique_ptr<MUType> &MU) {
+ return Main->define(MU);
+ }
/// Adds an IR module to the given JITDylib.
Error addIRModule(JITDylib &JD, ThreadSafeModule TSM);
diff --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
index e3ca3dbd8ddc..0ee1beef8bf1 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -965,12 +965,6 @@ LLJIT::~LLJIT() {
CompileThreads->wait();
}
-Error LLJIT::defineAbsolute(StringRef Name, JITEvaluatedSymbol Sym) {
- auto InternedName = ES->intern(Name);
- SymbolMap Symbols({{InternedName, Sym}});
- return Main->define(absoluteSymbols(std::move(Symbols)));
-}
-
Error LLJIT::addIRModule(JITDylib &JD, ThreadSafeModule TSM) {
assert(TSM && "Can not add null module");
More information about the llvm-commits
mailing list