[ARM] Generate 8.1-m CSINC, CSNEG and CSINV instructions.
[llvm-core.git] / lib / ExecutionEngine / Orc / IRCompileLayer.cpp
blobd311f34179c7c04cddfb2a24716438ae9b15c8d1
1 //===--------------- IRCompileLayer.cpp - IR Compiling Layer --------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
11 namespace llvm {
12 namespace orc {
14 IRCompileLayer::IRCompileLayer(ExecutionSession &ES, ObjectLayer &BaseLayer,
15 CompileFunction Compile)
16 : IRLayer(ES), BaseLayer(BaseLayer), Compile(std::move(Compile)) {}
18 void IRCompileLayer::setNotifyCompiled(NotifyCompiledFunction NotifyCompiled) {
19 std::lock_guard<std::mutex> Lock(IRLayerMutex);
20 this->NotifyCompiled = std::move(NotifyCompiled);
23 void IRCompileLayer::emit(MaterializationResponsibility R,
24 ThreadSafeModule TSM) {
25 assert(TSM && "Module must not be null");
27 if (auto Obj = TSM.withModuleDo(Compile)) {
29 std::lock_guard<std::mutex> Lock(IRLayerMutex);
30 if (NotifyCompiled)
31 NotifyCompiled(R.getVModuleKey(), std::move(TSM));
32 else
33 TSM = ThreadSafeModule();
35 BaseLayer.emit(std::move(R), std::move(*Obj));
36 } else {
37 R.failMaterialization();
38 getExecutionSession().reportError(Obj.takeError());
42 } // End namespace orc.
43 } // End namespace llvm.