AMDGPU: Mark test as XFAIL in expensive_checks builds
[llvm-project.git] / llvm / lib / ExecutionEngine / Orc / ObjectLinkingLayer.cpp
blob6688b0935a2de5132b19fbbd0676a2a6d6f4fef3
1 //===------- ObjectLinkingLayer.cpp - JITLink backed ORC ObjectLayer ------===//
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/ObjectLinkingLayer.h"
10 #include "llvm/ExecutionEngine/Orc/DebugUtils.h"
11 #include "llvm/Support/MemoryBuffer.h"
13 #define DEBUG_TYPE "orc"
15 namespace llvm::orc {
17 char ObjectLinkingLayer::ID;
19 using BaseObjectLayer = RTTIExtends<ObjectLinkingLayer, ObjectLayer>;
21 void ObjectLinkingLayer::emit(std::unique_ptr<MaterializationResponsibility> R,
22 std::unique_ptr<MemoryBuffer> O) {
23 assert(O && "Object must not be null");
24 MemoryBufferRef ObjBuffer = O->getMemBufferRef();
26 if (auto G = jitlink::createLinkGraphFromObject(
27 ObjBuffer, getExecutionSession().getSymbolStringPool())) {
28 emit(std::move(R), std::move(*G), std::move(O));
29 } else {
30 R->getExecutionSession().reportError(G.takeError());
31 R->failMaterialization();
32 return;
36 } // namespace llvm::orc