LLVM 17.0.0git
LLJIT.h
Go to the documentation of this file.
1//===----- LLJIT.h -- An ORC-based JIT for compiling LLVM IR ----*- 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// An ORC-based JIT for compiling LLVM IR.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_EXECUTIONENGINE_ORC_LLJIT_H
14#define LLVM_EXECUTIONENGINE_ORC_LLJIT_H
15
23#include "llvm/Support/Debug.h"
25
26namespace llvm {
27namespace orc {
28
29class LLJITBuilderState;
30class LLLazyJITBuilderState;
31class ObjectTransformLayer;
32class ExecutorProcessControl;
33
34/// A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
35///
36/// Create instances using LLJITBuilder.
37class LLJIT {
38 template <typename, typename, typename> friend class LLJITBuilderSetters;
39
40 friend void setUpGenericLLVMIRPlatform(LLJIT &J);
41
42public:
43 /// Initializer support for LLJIT.
45 public:
47
48 virtual Error initialize(JITDylib &JD) = 0;
49
50 virtual Error deinitialize(JITDylib &JD) = 0;
51
52 protected:
53 static void setInitTransform(LLJIT &J,
55 };
56
57 /// Destruct this instance. If a multi-threaded instance, waits for all
58 /// compile threads to complete.
59 virtual ~LLJIT();
60
61 /// Returns the ExecutionSession for this instance.
63
64 /// Returns a reference to the triple for this instance.
65 const Triple &getTargetTriple() const { return TT; }
66
67 /// Returns a reference to the DataLayout for this instance.
68 const DataLayout &getDataLayout() const { return DL; }
69
70 /// Returns a reference to the JITDylib representing the JIT'd main program.
72
73 /// Returns the JITDylib with the given name, or nullptr if no JITDylib with
74 /// that name exists.
76 return ES->getJITDylibByName(Name);
77 }
78
79 /// Load a (real) dynamic library and make its symbols available through a
80 /// new JITDylib with the same name.
81 ///
82 /// If the given *executor* path contains a valid platform dynamic library
83 /// then that library will be loaded, and a new bare JITDylib whose name is
84 /// the given path will be created to make the library's symbols available to
85 /// JIT'd code.
87
88 /// Link a static library into the given JITDylib.
89 ///
90 /// If the given MemoryBuffer contains a valid static archive (or a universal
91 /// binary with an archive slice that fits the LLJIT instance's platform /
92 /// architecture) then it will be added to the given JITDylib using a
93 /// StaticLibraryDefinitionGenerator.
95 std::unique_ptr<MemoryBuffer> LibBuffer);
96
97 /// Link a static library into the given JITDylib.
98 ///
99 /// If the given *host* path contains a valid static archive (or a universal
100 /// binary with an archive slice that fits the LLJIT instance's platform /
101 /// architecture) then it will be added to the given JITDylib using a
102 /// StaticLibraryDefinitionGenerator.
103 Error linkStaticLibraryInto(JITDylib &JD, const char *Path);
104
105 /// Create a new JITDylib with the given name and return a reference to it.
106 ///
107 /// JITDylib names must be unique. If the given name is derived from user
108 /// input or elsewhere in the environment then the client should check
109 /// (e.g. by calling getJITDylibByName) that the given name is not already in
110 /// use.
112 return ES->createJITDylib(std::move(Name));
113 }
114
115 /// Adds an IR module with the given ResourceTracker.
117
118 /// Adds an IR module to the given JITDylib.
120
121 /// Adds an IR module to the Main JITDylib.
123 return addIRModule(*Main, std::move(TSM));
124 }
125
126 /// Adds an object file to the given JITDylib.
127 Error addObjectFile(ResourceTrackerSP RT, std::unique_ptr<MemoryBuffer> Obj);
128
129 /// Adds an object file to the given JITDylib.
130 Error addObjectFile(JITDylib &JD, std::unique_ptr<MemoryBuffer> Obj);
131
132 /// Adds an object file to the given JITDylib.
133 Error addObjectFile(std::unique_ptr<MemoryBuffer> Obj) {
134 return addObjectFile(*Main, std::move(Obj));
135 }
136
137 /// Look up a symbol in JITDylib JD by the symbol's linker-mangled name (to
138 /// look up symbols based on their IR name use the lookup function instead).
141
142 /// Look up a symbol in JITDylib JD by the symbol's linker-mangled name (to
143 /// look up symbols based on their IR name use the lookup function instead).
145 StringRef Name) {
146 return lookupLinkerMangled(JD, ES->intern(Name));
147 }
148
149 /// Look up a symbol in the main JITDylib by the symbol's linker-mangled name
150 /// (to look up symbols based on their IR name use the lookup function
151 /// instead).
153 return lookupLinkerMangled(*Main, Name);
154 }
155
156 /// Look up a symbol in JITDylib JD based on its IR symbol name.
158 return lookupLinkerMangled(JD, mangle(UnmangledName));
159 }
160
161 /// Look up a symbol in the main JITDylib based on its IR symbol name.
163 return lookup(*Main, UnmangledName);
164 }
165
166 /// Set the PlatformSupport instance.
167 void setPlatformSupport(std::unique_ptr<PlatformSupport> PS) {
168 this->PS = std::move(PS);
169 }
170
171 /// Get the PlatformSupport instance.
173
174 /// Run the initializers for the given JITDylib.
176 DEBUG_WITH_TYPE("orc", {
177 dbgs() << "LLJIT running initializers for JITDylib \"" << JD.getName()
178 << "\"\n";
179 });
180 assert(PS && "PlatformSupport must be set to run initializers.");
181 return PS->initialize(JD);
182 }
183
184 /// Run the deinitializers for the given JITDylib.
186 DEBUG_WITH_TYPE("orc", {
187 dbgs() << "LLJIT running deinitializers for JITDylib \"" << JD.getName()
188 << "\"\n";
189 });
190 assert(PS && "PlatformSupport must be set to run initializers.");
191 return PS->deinitialize(JD);
192 }
193
194 /// Returns a reference to the ObjLinkingLayer
196
197 /// Returns a reference to the object transform layer.
199
200 /// Returns a reference to the IR transform layer.
202
203 /// Returns a reference to the IR compile layer.
205
206 /// Returns a linker-mangled version of UnmangledName.
207 std::string mangle(StringRef UnmangledName) const;
208
209 /// Returns an interned, linker-mangled version of UnmangledName.
211 return ES->intern(mangle(UnmangledName));
212 }
213
214protected:
217
220
221 /// Create an LLJIT instance with a single compile thread.
222 LLJIT(LLJITBuilderState &S, Error &Err);
223
225
227
228 std::unique_ptr<ExecutionSession> ES;
229 std::unique_ptr<PlatformSupport> PS;
230
231 JITDylib *Main = nullptr;
232
235 std::unique_ptr<ThreadPool> CompileThreads;
236
237 std::unique_ptr<ObjectLayer> ObjLinkingLayer;
238 std::unique_ptr<ObjectTransformLayer> ObjTransformLayer;
239 std::unique_ptr<IRCompileLayer> CompileLayer;
240 std::unique_ptr<IRTransformLayer> TransformLayer;
241 std::unique_ptr<IRTransformLayer> InitHelperTransformLayer;
242};
243
244/// An extended version of LLJIT that supports lazy function-at-a-time
245/// compilation of LLVM IR.
246class LLLazyJIT : public LLJIT {
247 template <typename, typename, typename> friend class LLJITBuilderSetters;
248
249public:
250
251 /// Sets the partition function.
252 void
254 CODLayer->setPartitionFunction(std::move(Partition));
255 }
256
257 /// Returns a reference to the on-demand layer.
259
260 /// Add a module to be lazily compiled to JITDylib JD.
262
263 /// Add a module to be lazily compiled to the main JITDylib.
265 return addLazyIRModule(*Main, std::move(M));
266 }
267
268private:
269
270 // Create a single-threaded LLLazyJIT instance.
272
273 std::unique_ptr<LazyCallThroughManager> LCTMgr;
274 std::unique_ptr<CompileOnDemandLayer> CODLayer;
275};
276
278public:
280 std::function<Expected<std::unique_ptr<ObjectLayer>>(ExecutionSession &,
281 const Triple &)>;
282
284 std::function<Expected<std::unique_ptr<IRCompileLayer::IRCompiler>>(
286
287 using PlatformSetupFunction = std::function<Error(LLJIT &J)>;
288
289 std::unique_ptr<ExecutorProcessControl> EPC;
290 std::unique_ptr<ExecutionSession> ES;
291 std::optional<JITTargetMachineBuilder> JTMB;
292 std::optional<DataLayout> DL;
296 unsigned NumCompileThreads = 0;
297
298 /// Called prior to JIT class construcion to fix up defaults.
300};
301
302template <typename JITType, typename SetterImpl, typename State>
304public:
305 /// Set a ExecutorProcessControl for this instance.
306 /// This should not be called if ExecutionSession has already been set.
307 SetterImpl &
308 setExecutorProcessControl(std::unique_ptr<ExecutorProcessControl> EPC) {
309 assert(
310 !impl().ES &&
311 "setExecutorProcessControl should not be called if an ExecutionSession "
312 "has already been set");
313 impl().EPC = std::move(EPC);
314 return impl();
315 }
316
317 /// Set an ExecutionSession for this instance.
318 SetterImpl &setExecutionSession(std::unique_ptr<ExecutionSession> ES) {
319 impl().ES = std::move(ES);
320 return impl();
321 }
322
323 /// Set the JITTargetMachineBuilder for this instance.
324 ///
325 /// If this method is not called, JITTargetMachineBuilder::detectHost will be
326 /// used to construct a default target machine builder for the host platform.
328 impl().JTMB = std::move(JTMB);
329 return impl();
330 }
331
332 /// Return a reference to the JITTargetMachineBuilder.
333 ///
334 std::optional<JITTargetMachineBuilder> &getJITTargetMachineBuilder() {
335 return impl().JTMB;
336 }
337
338 /// Set a DataLayout for this instance. If no data layout is specified then
339 /// the target's default data layout will be used.
340 SetterImpl &setDataLayout(std::optional<DataLayout> DL) {
341 impl().DL = std::move(DL);
342 return impl();
343 }
344
345 /// Set an ObjectLinkingLayer creation function.
346 ///
347 /// If this method is not called, a default creation function will be used
348 /// that will construct an RTDyldObjectLinkingLayer.
350 LLJITBuilderState::ObjectLinkingLayerCreator CreateObjectLinkingLayer) {
351 impl().CreateObjectLinkingLayer = std::move(CreateObjectLinkingLayer);
352 return impl();
353 }
354
355 /// Set a CompileFunctionCreator.
356 ///
357 /// If this method is not called, a default creation function wil be used
358 /// that will construct a basic IR compile function that is compatible with
359 /// the selected number of threads (SimpleCompiler for '0' compile threads,
360 /// ConcurrentIRCompiler otherwise).
362 LLJITBuilderState::CompileFunctionCreator CreateCompileFunction) {
363 impl().CreateCompileFunction = std::move(CreateCompileFunction);
364 return impl();
365 }
366
367 /// Set up an PlatformSetupFunction.
368 ///
369 /// If this method is not called then setUpGenericLLVMIRPlatform
370 /// will be used to configure the JIT's platform support.
371 SetterImpl &
373 impl().SetUpPlatform = std::move(SetUpPlatform);
374 return impl();
375 }
376
377 /// Set the number of compile threads to use.
378 ///
379 /// If set to zero, compilation will be performed on the execution thread when
380 /// JITing in-process. If set to any other number N, a thread pool of N
381 /// threads will be created for compilation.
382 ///
383 /// If this method is not called, behavior will be as if it were called with
384 /// a zero argument.
385 SetterImpl &setNumCompileThreads(unsigned NumCompileThreads) {
386 impl().NumCompileThreads = NumCompileThreads;
387 return impl();
388 }
389
390 /// Set an ExecutorProcessControl object.
391 ///
392 /// If the platform uses ObjectLinkingLayer by default and no
393 /// ObjectLinkingLayerCreator has been set then the ExecutorProcessControl
394 /// object will be used to supply the memory manager for the
395 /// ObjectLinkingLayer.
397 impl().EPC = &EPC;
398 return impl();
399 }
400
401 /// Create an instance of the JIT.
403 if (auto Err = impl().prepareForConstruction())
404 return std::move(Err);
405
406 Error Err = Error::success();
407 std::unique_ptr<JITType> J(new JITType(impl(), Err));
408 if (Err)
409 return std::move(Err);
410 return std::move(J);
411 }
412
413protected:
414 SetterImpl &impl() { return static_cast<SetterImpl &>(*this); }
415};
416
417/// Constructs LLJIT instances.
419 : public LLJITBuilderState,
420 public LLJITBuilderSetters<LLJIT, LLJITBuilder, LLJITBuilderState> {};
421
423 friend class LLLazyJIT;
424
425public:
427 std::function<std::unique_ptr<IndirectStubsManager>()>;
428
431 std::unique_ptr<LazyCallThroughManager> LCTMgr;
433
435};
436
437template <typename JITType, typename SetterImpl, typename State>
439 : public LLJITBuilderSetters<JITType, SetterImpl, State> {
440public:
441 /// Set the address in the target address to call if a lazy compile fails.
442 ///
443 /// If this method is not called then the value will default to 0.
445 this->impl().LazyCompileFailureAddr = Addr;
446 return this->impl();
447 }
448
449 /// Set the lazy-callthrough manager.
450 ///
451 /// If this method is not called then a default, in-process lazy callthrough
452 /// manager for the host platform will be used.
453 SetterImpl &
454 setLazyCallthroughManager(std::unique_ptr<LazyCallThroughManager> LCTMgr) {
455 this->impl().LCTMgr = std::move(LCTMgr);
456 return this->impl();
457 }
458
459 /// Set the IndirectStubsManager builder function.
460 ///
461 /// If this method is not called then a default, in-process
462 /// IndirectStubsManager builder for the host platform will be used.
465 this->impl().ISMBuilder = std::move(ISMBuilder);
466 return this->impl();
467 }
468};
469
470/// Constructs LLLazyJIT instances.
472 : public LLLazyJITBuilderState,
473 public LLLazyJITBuilderSetters<LLLazyJIT, LLLazyJITBuilder,
474 LLLazyJITBuilderState> {};
475
476/// Configure the LLJIT instance to use orc runtime support.
478
479/// Configure the LLJIT instance to scrape modules for llvm.global_ctors and
480/// llvm.global_dtors variables and (if present) build initialization and
481/// deinitialization functions. Platform specific initialization configurations
482/// should be preferred where available.
484
485/// Configure the LLJIT instance to disable platform support explicitly. This is
486/// useful in two cases: for platforms that don't have such requirements and for
487/// platforms, that we have no explicit support yet and that don't work well
488/// with the generic IR platform.
490
491} // End namespace orc
492} // End namespace llvm
493
494#endif // LLVM_EXECUTIONENGINE_ORC_LLJIT_H
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
#define DEBUG_WITH_TYPE(TYPE, X)
DEBUG_WITH_TYPE macro - This macro should be used by passes to emit debug information.
Definition: Debug.h:64
uint64_t Addr
std::string Name
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:110
Lightweight error class with error context and mandatory checking.
Definition: Error.h:156
static ErrorSuccess success()
Create a success value.
Definition: Error.h:330
Tagged union holding either a T or a Error.
Definition: Error.h:470
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
std::function< std::optional< GlobalValueSet >(GlobalValueSet Requested)> PartitionFunction
Partitioning function.
An ExecutionSession represents a running JIT program.
Definition: Core.h:1373
Represents an address in the executor process.
ExecutorProcessControl supports interaction with a JIT target process.
A layer that applies a transform to emitted modules.
Represents a JIT'd dynamic library.
Definition: Core.h:964
A utility class for building TargetMachines for JITs.
SetterImpl & setExecutorProcessControl(ExecutorProcessControl &EPC)
Set an ExecutorProcessControl object.
Definition: LLJIT.h:396
std::optional< JITTargetMachineBuilder > & getJITTargetMachineBuilder()
Return a reference to the JITTargetMachineBuilder.
Definition: LLJIT.h:334
SetterImpl & setCompileFunctionCreator(LLJITBuilderState::CompileFunctionCreator CreateCompileFunction)
Set a CompileFunctionCreator.
Definition: LLJIT.h:361
SetterImpl & setNumCompileThreads(unsigned NumCompileThreads)
Set the number of compile threads to use.
Definition: LLJIT.h:385
SetterImpl & setDataLayout(std::optional< DataLayout > DL)
Set a DataLayout for this instance.
Definition: LLJIT.h:340
SetterImpl & setJITTargetMachineBuilder(JITTargetMachineBuilder JTMB)
Set the JITTargetMachineBuilder for this instance.
Definition: LLJIT.h:327
SetterImpl & setExecutorProcessControl(std::unique_ptr< ExecutorProcessControl > EPC)
Set a ExecutorProcessControl for this instance.
Definition: LLJIT.h:308
SetterImpl & setObjectLinkingLayerCreator(LLJITBuilderState::ObjectLinkingLayerCreator CreateObjectLinkingLayer)
Set an ObjectLinkingLayer creation function.
Definition: LLJIT.h:349
SetterImpl & setPlatformSetUp(LLJITBuilderState::PlatformSetupFunction SetUpPlatform)
Set up an PlatformSetupFunction.
Definition: LLJIT.h:372
Expected< std::unique_ptr< JITType > > create()
Create an instance of the JIT.
Definition: LLJIT.h:402
SetterImpl & setExecutionSession(std::unique_ptr< ExecutionSession > ES)
Set an ExecutionSession for this instance.
Definition: LLJIT.h:318
Error prepareForConstruction()
Called prior to JIT class construcion to fix up defaults.
Definition: LLJIT.cpp:655
ObjectLinkingLayerCreator CreateObjectLinkingLayer
Definition: LLJIT.h:293
std::function< Expected< std::unique_ptr< IRCompileLayer::IRCompiler > >(JITTargetMachineBuilder JTMB)> CompileFunctionCreator
Definition: LLJIT.h:285
std::function< Error(LLJIT &J)> PlatformSetupFunction
Definition: LLJIT.h:287
std::unique_ptr< ExecutionSession > ES
Definition: LLJIT.h:290
std::function< Expected< std::unique_ptr< ObjectLayer > >(ExecutionSession &, const Triple &)> ObjectLinkingLayerCreator
Definition: LLJIT.h:281
CompileFunctionCreator CreateCompileFunction
Definition: LLJIT.h:294
std::unique_ptr< ExecutorProcessControl > EPC
Definition: LLJIT.h:289
std::optional< DataLayout > DL
Definition: LLJIT.h:292
std::optional< JITTargetMachineBuilder > JTMB
Definition: LLJIT.h:291
PlatformSetupFunction SetUpPlatform
Definition: LLJIT.h:295
Constructs LLJIT instances.
Definition: LLJIT.h:420
Initializer support for LLJIT.
Definition: LLJIT.h:44
virtual Error deinitialize(JITDylib &JD)=0
virtual Error initialize(JITDylib &JD)=0
static void setInitTransform(LLJIT &J, IRTransformLayer::TransformFunction T)
Definition: LLJIT.cpp:648
A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
Definition: LLJIT.h:37
static Expected< std::unique_ptr< ObjectLayer > > createObjectLinkingLayer(LLJITBuilderState &S, ExecutionSession &ES)
Definition: LLJIT.cpp:828
void setPlatformSupport(std::unique_ptr< PlatformSupport > PS)
Set the PlatformSupport instance.
Definition: LLJIT.h:167
std::unique_ptr< ExecutionSession > ES
Definition: LLJIT.h:228
Error addObjectFile(ResourceTrackerSP RT, std::unique_ptr< MemoryBuffer > Obj)
Adds an object file to the given JITDylib.
Definition: LLJIT.cpp:806
Expected< JITDylib & > createJITDylib(std::string Name)
Create a new JITDylib with the given name and return a reference to it.
Definition: LLJIT.h:111
JITDylib & getMainJITDylib()
Returns a reference to the JITDylib representing the JIT'd main program.
Definition: LLJIT.h:71
const DataLayout & getDataLayout() const
Returns a reference to the DataLayout for this instance.
Definition: LLJIT.h:68
void recordCtorDtors(Module &M)
Error initialize(JITDylib &JD)
Run the initializers for the given JITDylib.
Definition: LLJIT.h:175
Error addIRModule(ThreadSafeModule TSM)
Adds an IR module to the Main JITDylib.
Definition: LLJIT.h:122
ObjectLayer & getObjLinkingLayer()
Returns a reference to the ObjLinkingLayer.
Definition: LLJIT.h:195
Expected< ExecutorAddr > lookupLinkerMangled(JITDylib &JD, StringRef Name)
Look up a symbol in JITDylib JD by the symbol's linker-mangled name (to look up symbols based on thei...
Definition: LLJIT.h:144
IRCompileLayer & getIRCompileLayer()
Returns a reference to the IR compile layer.
Definition: LLJIT.h:204
std::unique_ptr< ObjectTransformLayer > ObjTransformLayer
Definition: LLJIT.h:238
virtual ~LLJIT()
Destruct this instance.
Definition: LLJIT.cpp:750
IRTransformLayer & getIRTransformLayer()
Returns a reference to the IR transform layer.
Definition: LLJIT.h:201
std::string mangle(StringRef UnmangledName) const
Returns a linker-mangled version of UnmangledName.
Definition: LLJIT.cpp:956
JITDylib * Main
Definition: LLJIT.h:231
Expected< ExecutorAddr > lookup(JITDylib &JD, StringRef UnmangledName)
Look up a symbol in JITDylib JD based on its IR symbol name.
Definition: LLJIT.h:157
Expected< JITDylib & > loadPlatformDynamicLibrary(const char *Path)
Load a (real) dynamic library and make its symbols available through a new JITDylib with the same nam...
Definition: LLJIT.cpp:757
std::unique_ptr< IRTransformLayer > InitHelperTransformLayer
Definition: LLJIT.h:241
Error deinitialize(JITDylib &JD)
Run the deinitializers for the given JITDylib.
Definition: LLJIT.h:185
std::unique_ptr< IRCompileLayer > CompileLayer
Definition: LLJIT.h:239
Expected< ExecutorAddr > lookup(StringRef UnmangledName)
Look up a symbol in the main JITDylib based on its IR symbol name.
Definition: LLJIT.h:162
const Triple & getTargetTriple() const
Returns a reference to the triple for this instance.
Definition: LLJIT.h:65
Expected< ExecutorAddr > lookupLinkerMangled(JITDylib &JD, SymbolStringPtr Name)
Look up a symbol in JITDylib JD by the symbol's linker-mangled name (to look up symbols based on thei...
Definition: LLJIT.cpp:817
static Expected< std::unique_ptr< IRCompileLayer::IRCompiler > > createCompileFunction(LLJITBuilderState &S, JITTargetMachineBuilder JTMB)
Definition: LLJIT.cpp:857
PlatformSupport * getPlatformSupport()
Get the PlatformSupport instance.
Definition: LLJIT.h:172
ExecutionSession & getExecutionSession()
Returns the ExecutionSession for this instance.
Definition: LLJIT.h:62
std::unique_ptr< IRTransformLayer > TransformLayer
Definition: LLJIT.h:240
SymbolStringPtr mangleAndIntern(StringRef UnmangledName) const
Returns an interned, linker-mangled version of UnmangledName.
Definition: LLJIT.h:210
DataLayout DL
Definition: LLJIT.h:233
Error addObjectFile(std::unique_ptr< MemoryBuffer > Obj)
Adds an object file to the given JITDylib.
Definition: LLJIT.h:133
Error linkStaticLibraryInto(JITDylib &JD, std::unique_ptr< MemoryBuffer > LibBuffer)
Link a static library into the given JITDylib.
Definition: LLJIT.cpp:770
friend void setUpGenericLLVMIRPlatform(LLJIT &J)
Configure the LLJIT instance to scrape modules for llvm.global_ctors and llvm.global_dtors variables ...
Definition: LLJIT.cpp:986
Error applyDataLayout(Module &M)
Definition: LLJIT.cpp:965
std::unique_ptr< ThreadPool > CompileThreads
Definition: LLJIT.h:235
std::unique_ptr< ObjectLayer > ObjLinkingLayer
Definition: LLJIT.h:237
std::unique_ptr< PlatformSupport > PS
Definition: LLJIT.h:229
JITDylib * getJITDylibByName(StringRef Name)
Returns the JITDylib with the given name, or nullptr if no JITDylib with that name exists.
Definition: LLJIT.h:75
ObjectTransformLayer & getObjTransformLayer()
Returns a reference to the object transform layer.
Definition: LLJIT.h:198
Triple TT
Definition: LLJIT.h:234
Error addIRModule(ResourceTrackerSP RT, ThreadSafeModule TSM)
Adds an IR module with the given ResourceTracker.
Definition: LLJIT.cpp:792
Expected< ExecutorAddr > lookupLinkerMangled(StringRef Name)
Look up a symbol in the main JITDylib by the symbol's linker-mangled name (to look up symbols based o...
Definition: LLJIT.h:152
SetterImpl & setLazyCompileFailureAddr(ExecutorAddr Addr)
Set the address in the target address to call if a lazy compile fails.
Definition: LLJIT.h:444
SetterImpl & setLazyCallthroughManager(std::unique_ptr< LazyCallThroughManager > LCTMgr)
Set the lazy-callthrough manager.
Definition: LLJIT.h:454
SetterImpl & setIndirectStubsManagerBuilder(LLLazyJITBuilderState::IndirectStubsManagerBuilderFunction ISMBuilder)
Set the IndirectStubsManager builder function.
Definition: LLJIT.h:463
ExecutorAddr LazyCompileFailureAddr
Definition: LLJIT.h:430
std::unique_ptr< LazyCallThroughManager > LCTMgr
Definition: LLJIT.h:431
std::function< std::unique_ptr< IndirectStubsManager >()> IndirectStubsManagerBuilderFunction
Definition: LLJIT.h:427
IndirectStubsManagerBuilderFunction ISMBuilder
Definition: LLJIT.h:432
Constructs LLLazyJIT instances.
Definition: LLJIT.h:474
An extended version of LLJIT that supports lazy function-at-a-time compilation of LLVM IR.
Definition: LLJIT.h:246
void setPartitionFunction(CompileOnDemandLayer::PartitionFunction Partition)
Sets the partition function.
Definition: LLJIT.h:253
Error addLazyIRModule(ThreadSafeModule M)
Add a module to be lazily compiled to the main JITDylib.
Definition: LLJIT.h:264
CompileOnDemandLayer & getCompileOnDemandLayer()
Returns a reference to the on-demand layer.
Definition: LLJIT.h:258
Error addLazyIRModule(JITDylib &JD, ThreadSafeModule M)
Add a module to be lazily compiled to JITDylib JD.
Definition: LLJIT.cpp:1006
Interface for Layers that accept object files.
Definition: Layer.h:133
Pointer to a pooled string representing a symbol name.
An LLVM Module together with a shared ThreadSafeContext.
Error setUpOrcPlatform(LLJIT &J)
Configure the LLJIT instance to use orc runtime support.
Definition: LLJIT.cpp:979
void setUpGenericLLVMIRPlatform(LLJIT &J)
Configure the LLJIT instance to scrape modules for llvm.global_ctors and llvm.global_dtors variables ...
Definition: LLJIT.cpp:986
Error setUpInactivePlatform(LLJIT &J)
Configure the LLJIT instance to disable platform support explicitly.
Definition: LLJIT.cpp:992
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163