Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
Show All 32 Lines | public: | ||||
StringRef getName() const override { return "<Compile Callbacks>"; } | StringRef getName() const override { return "<Compile Callbacks>"; } | ||||
private: | private: | ||||
void materialize(MaterializationResponsibility R) override { | void materialize(MaterializationResponsibility R) override { | ||||
SymbolMap Result; | SymbolMap Result; | ||||
Result[Name] = JITEvaluatedSymbol(Compile(), JITSymbolFlags::Exported); | Result[Name] = JITEvaluatedSymbol(Compile(), JITSymbolFlags::Exported); | ||||
// No dependencies, so these calls cannot fail. | // No dependencies, so these calls cannot fail. | ||||
cantFail(R.notifyResolved(Result)); | llvm_cantFail(R.notifyResolved(Result)); | ||||
cantFail(R.notifyEmitted()); | llvm_cantFail(R.notifyEmitted()); | ||||
} | } | ||||
void discard(const JITDylib &JD, const SymbolStringPtr &Name) override { | void discard(const JITDylib &JD, const SymbolStringPtr &Name) override { | ||||
llvm_unreachable("Discard should never occur on a LMU?"); | llvm_unreachable("Discard should never occur on a LMU?"); | ||||
} | } | ||||
SymbolStringPtr Name; | SymbolStringPtr Name; | ||||
CompileFunction Compile; | CompileFunction Compile; | ||||
Show All 10 Lines | |||||
Expected<JITTargetAddress> | Expected<JITTargetAddress> | ||||
JITCompileCallbackManager::getCompileCallback(CompileFunction Compile) { | JITCompileCallbackManager::getCompileCallback(CompileFunction Compile) { | ||||
if (auto TrampolineAddr = TP->getTrampoline()) { | if (auto TrampolineAddr = TP->getTrampoline()) { | ||||
auto CallbackName = | auto CallbackName = | ||||
ES.intern(std::string("cc") + std::to_string(++NextCallbackId)); | ES.intern(std::string("cc") + std::to_string(++NextCallbackId)); | ||||
std::lock_guard<std::mutex> Lock(CCMgrMutex); | std::lock_guard<std::mutex> Lock(CCMgrMutex); | ||||
AddrToSymbol[*TrampolineAddr] = CallbackName; | AddrToSymbol[*TrampolineAddr] = CallbackName; | ||||
cantFail(CallbacksJD.define( | llvm_cantFail(CallbacksJD.define( | ||||
std::make_unique<CompileCallbackMaterializationUnit>( | std::make_unique<CompileCallbackMaterializationUnit>( | ||||
std::move(CallbackName), std::move(Compile), | std::move(CallbackName), std::move(Compile), | ||||
ES.allocateVModule()))); | ES.allocateVModule()))); | ||||
return *TrampolineAddr; | return *TrampolineAddr; | ||||
} else | } else | ||||
return TrampolineAddr.takeError(); | return TrampolineAddr.takeError(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 297 Lines • Show Last 20 Lines |