[MIPS GlobalISel] Select MSA vector generic and builtin add
[llvm-complete.git] / lib / ExecutionEngine / Orc / ObjectTransformLayer.cpp
blob815517321b76bea840c318af96692730149d6d64
1 //===---------- ObjectTransformLayer.cpp - Object Transform 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/ObjectTransformLayer.h"
10 #include "llvm/Support/MemoryBuffer.h"
12 namespace llvm {
13 namespace orc {
15 ObjectTransformLayer::ObjectTransformLayer(ExecutionSession &ES,
16 ObjectLayer &BaseLayer,
17 TransformFunction Transform)
18 : ObjectLayer(ES), BaseLayer(BaseLayer), Transform(std::move(Transform)) {}
20 void ObjectTransformLayer::emit(MaterializationResponsibility R,
21 std::unique_ptr<MemoryBuffer> O) {
22 assert(O && "Module must not be null");
24 if (auto TransformedObj = Transform(std::move(O)))
25 BaseLayer.emit(std::move(R), std::move(*TransformedObj));
26 else {
27 R.failMaterialization();
28 getExecutionSession().reportError(TransformedObj.takeError());
32 } // End namespace orc.
33 } // End namespace llvm.