LLVM 20.0.0git
LazyObjectLinkingLayer.h
Go to the documentation of this file.
1//===- LazyObjectLinkingLayer.h - Link objects on first fn call -*- C++ -*-===//
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//===----------------------------------------------------------------------===//
8//
9// Link object files lazily on first call.
10//
11//===----------------------------------------------------------------------===//
12#ifndef LLVM_EXECUTIONENGINE_ORC_LAZYOBJECTLINKINGLAYER_H
13#define LLVM_EXECUTIONENGINE_ORC_LAZYOBJECTLINKINGLAYER_H
14
17
18namespace llvm::orc {
19
20class ObjectLinkingLayer;
21class LazyReexportsManager;
22class RedirectableSymbolManager;
23
24/// LazyObjectLinkingLayer is an adapter for ObjectLinkingLayer that builds
25/// lazy reexports for all function symbols in objects that are/ added to defer
26/// linking until the first call to a function defined in the object.
27///
28/// Linking is performed by emitting the object file via the base
29/// ObjectLinkingLayer.
30///
31/// No partitioning is performed: The first call to any function in the object
32/// will trigger linking of the whole object.
33///
34/// References to data symbols are not lazy and will trigger immediate linking
35/// (same os ObjectlinkingLayer).
37public:
40
41 /// Add an object file to the JITDylib targeted by the given tracker.
43 std::unique_ptr<MemoryBuffer> O,
45
46 void emit(std::unique_ptr<MaterializationResponsibility> R,
47 std::unique_ptr<MemoryBuffer> O) override;
48
49private:
50 class RenamerPlugin;
51
52 ObjectLinkingLayer &BaseLayer;
54};
55
56} // namespace llvm::orc
57
58#endif // LLVM_EXECUTIONENGINE_ORC_LAZYOBJECTLINKINGLAYER_H
#define I(x, y, z)
Definition: MD5.cpp:58
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
LazyObjectLinkingLayer is an adapter for ObjectLinkingLayer that builds lazy reexports for all functi...
void emit(std::unique_ptr< MaterializationResponsibility > R, std::unique_ptr< MemoryBuffer > O) override
Emit should materialize the given IR.
llvm::Error add(llvm::orc::ResourceTrackerSP RT, std::unique_ptr< MemoryBuffer > O, MaterializationUnit::Interface I) override
Add an object file to the JITDylib targeted by the given tracker.
Interface for Layers that accept object files.
Definition: Layer.h:133
An ObjectLayer implementation built on JITLink.