[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.
This commit is contained in:
Lang Hames 2020-04-17 21:19:11 -07:00
parent 8e0c5f7200
commit c6ade39ba0
2 changed files with 15 additions and 8 deletions

View File

@ -85,8 +85,21 @@ public:
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);

View File

@ -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");