LLVM 22.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
18
19namespace llvm::orc {
20
24
25/// LazyObjectLinkingLayer is an adapter for ObjectLinkingLayer that builds
26/// lazy reexports for all function symbols in objects that are/ added to defer
27/// linking until the first call to a function defined in the object.
28///
29/// Linking is performed by emitting the object file via the base
30/// ObjectLinkingLayer.
31///
32/// No partitioning is performed: The first call to any function in the object
33/// will trigger linking of the whole object.
34///
35/// References to data symbols are not lazy and will trigger immediate linking
36/// (same os ObjectlinkingLayer).
38public:
41
42 /// Add an object file to the JITDylib targeted by the given tracker.
44 std::unique_ptr<MemoryBuffer> O,
46
47 void emit(std::unique_ptr<MaterializationResponsibility> R,
48 std::unique_ptr<MemoryBuffer> O) override;
49
50private:
51 class RenamerPlugin;
52
53 ObjectLinkingLayer &BaseLayer;
55};
56
57} // namespace llvm::orc
58
59#endif // LLVM_EXECUTIONENGINE_ORC_LAZYOBJECTLINKINGLAYER_H
#define LLVM_ABI
Definition Compiler.h:213
#define I(x, y, z)
Definition MD5.cpp:58
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
void emit(std::unique_ptr< MaterializationResponsibility > R, std::unique_ptr< MemoryBuffer > O) override
Emit should materialize the given IR.
LazyObjectLinkingLayer(ObjectLinkingLayer &BaseLayer, LazyReexportsManager &LRMgr)
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.
ObjectLayer(ExecutionSession &ES)
Definition Layer.cpp:167
An ObjectLayer implementation built on JITLink.
Base class for managing redirectable symbols in which a call gets redirected to another symbol in run...
IntrusiveRefCntPtr< ResourceTracker > ResourceTrackerSP
Definition Core.h:52