LLVM  13.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 
26 namespace llvm {
27 namespace orc {
28 
29 class LLJITBuilderState;
30 class LLLazyJITBuilderState;
31 class ObjectTransformLayer;
32 class TargetProcessControl;
33 
34 /// A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
35 ///
36 /// Create instances using LLJITBuilder.
37 class LLJIT {
38  template <typename, typename, typename> friend class LLJITBuilderSetters;
39 
40  friend void setUpGenericLLVMIRPlatform(LLJIT &J);
41 
42 public:
43  /// Initializer support for LLJIT.
45  public:
46  virtual ~PlatformSupport();
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  ~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.
71  JITDylib &getMainJITDylib() { return *Main; }
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  /// Create a new JITDylib with the given name and return a reference to it.
80  ///
81  /// JITDylib names must be unique. If the given name is derived from user
82  /// input or elsewhere in the environment then the client should check
83  /// (e.g. by calling getJITDylibByName) that the given name is not already in
84  /// use.
86  return ES->createJITDylib(std::move(Name));
87  }
88 
89  /// Adds an IR module with the given ResourceTracker.
91 
92  /// Adds an IR module to the given JITDylib.
94 
95  /// Adds an IR module to the Main JITDylib.
97  return addIRModule(*Main, std::move(TSM));
98  }
99 
100  /// Adds an object file to the given JITDylib.
101  Error addObjectFile(ResourceTrackerSP RT, std::unique_ptr<MemoryBuffer> Obj);
102 
103  /// Adds an object file to the given JITDylib.
104  Error addObjectFile(JITDylib &JD, std::unique_ptr<MemoryBuffer> Obj);
105 
106  /// Adds an object file to the given JITDylib.
107  Error addObjectFile(std::unique_ptr<MemoryBuffer> Obj) {
108  return addObjectFile(*Main, std::move(Obj));
109  }
110 
111  /// Look up a symbol in JITDylib JD by the symbol's linker-mangled name (to
112  /// look up symbols based on their IR name use the lookup function instead).
115 
116  /// Look up a symbol in JITDylib JD by the symbol's linker-mangled name (to
117  /// look up symbols based on their IR name use the lookup function instead).
119  StringRef Name) {
120  return lookupLinkerMangled(JD, ES->intern(Name));
121  }
122 
123  /// Look up a symbol in the main JITDylib by the symbol's linker-mangled name
124  /// (to look up symbols based on their IR name use the lookup function
125  /// instead).
127  return lookupLinkerMangled(*Main, Name);
128  }
129 
130  /// Look up a symbol in JITDylib JD based on its IR symbol name.
132  return lookupLinkerMangled(JD, mangle(UnmangledName));
133  }
134 
135  /// Look up a symbol in the main JITDylib based on its IR symbol name.
137  return lookup(*Main, UnmangledName);
138  }
139 
140  /// Set the PlatformSupport instance.
141  void setPlatformSupport(std::unique_ptr<PlatformSupport> PS) {
142  this->PS = std::move(PS);
143  }
144 
145  /// Get the PlatformSupport instance.
146  PlatformSupport *getPlatformSupport() { return PS.get(); }
147 
148  /// Run the initializers for the given JITDylib.
150  DEBUG_WITH_TYPE("orc", {
151  dbgs() << "LLJIT running initializers for JITDylib \"" << JD.getName()
152  << "\"\n";
153  });
154  assert(PS && "PlatformSupport must be set to run initializers.");
155  return PS->initialize(JD);
156  }
157 
158  /// Run the deinitializers for the given JITDylib.
160  DEBUG_WITH_TYPE("orc", {
161  dbgs() << "LLJIT running deinitializers for JITDylib \"" << JD.getName()
162  << "\"\n";
163  });
164  assert(PS && "PlatformSupport must be set to run initializers.");
165  return PS->deinitialize(JD);
166  }
167 
168  /// Returns a reference to the ObjLinkingLayer
170 
171  /// Returns a reference to the object transform layer.
173 
174  /// Returns a reference to the IR transform layer.
176 
177  /// Returns a reference to the IR compile layer.
179 
180  /// Returns a linker-mangled version of UnmangledName.
181  std::string mangle(StringRef UnmangledName) const;
182 
183  /// Returns an interned, linker-mangled version of UnmangledName.
185  return ES->intern(mangle(UnmangledName));
186  }
187 
188 protected:
191 
194 
195  /// Create an LLJIT instance with a single compile thread.
196  LLJIT(LLJITBuilderState &S, Error &Err);
197 
199 
200  void recordCtorDtors(Module &M);
201 
202  std::unique_ptr<ExecutionSession> ES;
203  std::unique_ptr<PlatformSupport> PS;
204 
205  JITDylib *Main = nullptr;
206 
209  std::unique_ptr<ThreadPool> CompileThreads;
210 
211  std::unique_ptr<ObjectLayer> ObjLinkingLayer;
212  std::unique_ptr<ObjectTransformLayer> ObjTransformLayer;
213  std::unique_ptr<IRCompileLayer> CompileLayer;
214  std::unique_ptr<IRTransformLayer> TransformLayer;
215  std::unique_ptr<IRTransformLayer> InitHelperTransformLayer;
216 };
217 
218 /// An extended version of LLJIT that supports lazy function-at-a-time
219 /// compilation of LLVM IR.
220 class LLLazyJIT : public LLJIT {
221  template <typename, typename, typename> friend class LLJITBuilderSetters;
222 
223 public:
224 
225  /// Sets the partition function.
226  void
228  CODLayer->setPartitionFunction(std::move(Partition));
229  }
230 
231  /// Returns a reference to the on-demand layer.
233 
234  /// Add a module to be lazily compiled to JITDylib JD.
236 
237  /// Add a module to be lazily compiled to the main JITDylib.
239  return addLazyIRModule(*Main, std::move(M));
240  }
241 
242 private:
243 
244  // Create a single-threaded LLLazyJIT instance.
246 
247  std::unique_ptr<LazyCallThroughManager> LCTMgr;
248  std::unique_ptr<CompileOnDemandLayer> CODLayer;
249 };
250 
252 public:
254  std::function<Expected<std::unique_ptr<ObjectLayer>>(ExecutionSession &,
255  const Triple &)>;
256 
257  using CompileFunctionCreator =
258  std::function<Expected<std::unique_ptr<IRCompileLayer::IRCompiler>>(
260 
262 
263  std::unique_ptr<ExecutionSession> ES;
269  unsigned NumCompileThreads = 0;
271 
272  /// Called prior to JIT class construcion to fix up defaults.
274 };
275 
276 template <typename JITType, typename SetterImpl, typename State>
278 public:
279 
280  /// Set an ExecutionSession for this instance.
281  SetterImpl &setExecutionSession(std::unique_ptr<ExecutionSession> ES) {
282  impl().ES = std::move(ES);
283  return impl();
284  }
285 
286  /// Set the JITTargetMachineBuilder for this instance.
287  ///
288  /// If this method is not called, JITTargetMachineBuilder::detectHost will be
289  /// used to construct a default target machine builder for the host platform.
291  impl().JTMB = std::move(JTMB);
292  return impl();
293  }
294 
295  /// Return a reference to the JITTargetMachineBuilder.
296  ///
298  return impl().JTMB;
299  }
300 
301  /// Set a DataLayout for this instance. If no data layout is specified then
302  /// the target's default data layout will be used.
304  impl().DL = std::move(DL);
305  return impl();
306  }
307 
308  /// Set an ObjectLinkingLayer creation function.
309  ///
310  /// If this method is not called, a default creation function will be used
311  /// that will construct an RTDyldObjectLinkingLayer.
313  LLJITBuilderState::ObjectLinkingLayerCreator CreateObjectLinkingLayer) {
314  impl().CreateObjectLinkingLayer = std::move(CreateObjectLinkingLayer);
315  return impl();
316  }
317 
318  /// Set a CompileFunctionCreator.
319  ///
320  /// If this method is not called, a default creation function wil be used
321  /// that will construct a basic IR compile function that is compatible with
322  /// the selected number of threads (SimpleCompiler for '0' compile threads,
323  /// ConcurrentIRCompiler otherwise).
325  LLJITBuilderState::CompileFunctionCreator CreateCompileFunction) {
326  impl().CreateCompileFunction = std::move(CreateCompileFunction);
327  return impl();
328  }
329 
330  /// Set up an PlatformSetupFunction.
331  ///
332  /// If this method is not called then setUpGenericLLVMIRPlatform
333  /// will be used to configure the JIT's platform support.
334  SetterImpl &
336  impl().SetUpPlatform = std::move(SetUpPlatform);
337  return impl();
338  }
339 
340  /// Set the number of compile threads to use.
341  ///
342  /// If set to zero, compilation will be performed on the execution thread when
343  /// JITing in-process. If set to any other number N, a thread pool of N
344  /// threads will be created for compilation.
345  ///
346  /// If this method is not called, behavior will be as if it were called with
347  /// a zero argument.
348  SetterImpl &setNumCompileThreads(unsigned NumCompileThreads) {
349  impl().NumCompileThreads = NumCompileThreads;
350  return impl();
351  }
352 
353  /// Set a TargetProcessControl object.
354  ///
355  /// If the platform uses ObjectLinkingLayer by default and no
356  /// ObjectLinkingLayerCreator has been set then the TargetProcessControl
357  /// object will be used to supply the memory manager for the
358  /// ObjectLinkingLayer.
360  impl().TPC = &TPC;
361  return impl();
362  }
363 
364  /// Create an instance of the JIT.
366  if (auto Err = impl().prepareForConstruction())
367  return std::move(Err);
368 
369  Error Err = Error::success();
370  std::unique_ptr<JITType> J(new JITType(impl(), Err));
371  if (Err)
372  return std::move(Err);
373  return std::move(J);
374  }
375 
376 protected:
377  SetterImpl &impl() { return static_cast<SetterImpl &>(*this); }
378 };
379 
380 /// Constructs LLJIT instances.
382  : public LLJITBuilderState,
383  public LLJITBuilderSetters<LLJIT, LLJITBuilder, LLJITBuilderState> {};
384 
386  friend class LLLazyJIT;
387 
388 public:
390  std::function<std::unique_ptr<IndirectStubsManager>()>;
391 
394  std::unique_ptr<LazyCallThroughManager> LCTMgr;
396 
398 };
399 
400 template <typename JITType, typename SetterImpl, typename State>
402  : public LLJITBuilderSetters<JITType, SetterImpl, State> {
403 public:
404  /// Set the address in the target address to call if a lazy compile fails.
405  ///
406  /// If this method is not called then the value will default to 0.
408  this->impl().LazyCompileFailureAddr = Addr;
409  return this->impl();
410  }
411 
412  /// Set the lazy-callthrough manager.
413  ///
414  /// If this method is not called then a default, in-process lazy callthrough
415  /// manager for the host platform will be used.
416  SetterImpl &
417  setLazyCallthroughManager(std::unique_ptr<LazyCallThroughManager> LCTMgr) {
418  this->impl().LCTMgr = std::move(LCTMgr);
419  return this->impl();
420  }
421 
422  /// Set the IndirectStubsManager builder function.
423  ///
424  /// If this method is not called then a default, in-process
425  /// IndirectStubsManager builder for the host platform will be used.
428  this->impl().ISMBuilder = std::move(ISMBuilder);
429  return this->impl();
430  }
431 };
432 
433 /// Constructs LLLazyJIT instances.
435  : public LLLazyJITBuilderState,
436  public LLLazyJITBuilderSetters<LLLazyJIT, LLLazyJITBuilder,
437  LLLazyJITBuilderState> {};
438 
439 /// Configure the LLJIT instance to scrape modules for llvm.global_ctors and
440 /// llvm.global_dtors variables and (if present) build initialization and
441 /// deinitialization functions. Platform specific initialization configurations
442 /// should be preferred where available.
444 
445 /// Configure the LLJIT instance to use MachOPlatform support.
446 ///
447 /// Warning: MachOPlatform *requires* that LLJIT be configured to use
448 /// ObjectLinkingLayer (default on platforms supported by JITLink). If
449 /// MachOPlatform is used with RTDyldObjectLinkingLayer it will result in
450 /// undefined behavior).
451 ///
452 /// MachOPlatform installs an ObjectLinkingLayer plugin to scrape initializers
453 /// from the __mod_inits section. It also provides interposes for the dlfcn
454 /// functions (dlopen, dlclose, dlsym, dlerror) that work for JITDylibs as
455 /// well as regular libraries (JITDylibs will be preferenced, so make sure
456 /// your JITDylib names do not shadow any real library paths).
458 
459 /// Configure the LLJIT instance to disable platform support explicitly. This is
460 /// useful in two cases: for platforms that don't have such requirements and for
461 /// platforms, that we have no explicit support yet and that don't work well
462 /// with the generic IR platform.
464 
465 } // End namespace orc
466 } // End namespace llvm
467 
468 #endif // LLVM_EXECUTIONENGINE_ORC_LLJIT_H
llvm::orc::LLJITBuilderSetters::getJITTargetMachineBuilder
Optional< JITTargetMachineBuilder > & getJITTargetMachineBuilder()
Return a reference to the JITTargetMachineBuilder.
Definition: LLJIT.h:297
llvm::orc::LLJIT::recordCtorDtors
void recordCtorDtors(Module &M)
llvm::orc::LLJITBuilderState::NumCompileThreads
unsigned NumCompileThreads
Definition: LLJIT.h:269
llvm::orc::LLJITBuilderState
Definition: LLJIT.h:251
llvm::orc::JITTargetMachineBuilder
A utility class for building TargetMachines for JITs.
Definition: JITTargetMachineBuilder.h:34
llvm
Definition: AllocatorList.h:23
llvm::orc::LLJIT::lookupLinkerMangled
Expected< JITEvaluatedSymbol > 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:118
llvm::orc::JITDylib
A symbol table that supports asynchoronous symbol queries.
Definition: Core.h:894
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::orc::LLJIT::createJITDylib
Expected< JITDylib & > createJITDylib(std::string Name)
Create a new JITDylib with the given name and return a reference to it.
Definition: LLJIT.h:85
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:112
llvm::orc::LLJIT::getMainJITDylib
JITDylib & getMainJITDylib()
Returns a reference to the JITDylib representing the JIT'd main program.
Definition: LLJIT.h:71
llvm::unique_function< Expected< ThreadSafeModule >(ThreadSafeModule, MaterializationResponsibility &R)>
llvm::orc::LLJITBuilderState::JTMB
Optional< JITTargetMachineBuilder > JTMB
Definition: LLJIT.h:264
llvm::orc::LLJITBuilder
Constructs LLJIT instances.
Definition: LLJIT.h:381
llvm::orc::LLJIT::getPlatformSupport
PlatformSupport * getPlatformSupport()
Get the PlatformSupport instance.
Definition: LLJIT.h:146
llvm::orc::LLLazyJITBuilderState::prepareForConstruction
Error prepareForConstruction()
Definition: LLJIT.cpp:1196
llvm::orc::LLJIT::PlatformSupport::setInitTransform
static void setInitTransform(LLJIT &J, IRTransformLayer::TransformFunction T)
Definition: LLJIT.cpp:923
llvm::orc::LLJIT::LLJIT
LLJIT(LLJITBuilderState &S, Error &Err)
Create an LLJIT instance with a single compile thread.
Definition: LLJIT.cpp:1081
llvm::orc::SymbolStringPtr
Pointer to a pooled string representing a symbol name.
Definition: SymbolStringPool.h:50
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:332
llvm::orc::LLJIT::InitHelperTransformLayer
std::unique_ptr< IRTransformLayer > InitHelperTransformLayer
Definition: LLJIT.h:215
llvm::orc::LLLazyJIT::setPartitionFunction
void setPartitionFunction(CompileOnDemandLayer::PartitionFunction Partition)
Sets the partition function.
Definition: LLJIT.h:227
llvm::orc::LLJIT::getTargetTriple
const Triple & getTargetTriple() const
Returns a reference to the triple for this instance.
Definition: LLJIT.h:65
llvm::orc::LLJIT::addObjectFile
Error addObjectFile(ResourceTrackerSP RT, std::unique_ptr< MemoryBuffer > Obj)
Adds an object file to the given JITDylib.
Definition: LLJIT.cpp:1020
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::orc::LLLazyJITBuilderSetters::setLazyCallthroughManager
SetterImpl & setLazyCallthroughManager(std::unique_ptr< LazyCallThroughManager > LCTMgr)
Set the lazy-callthrough manager.
Definition: LLJIT.h:417
llvm::orc::LLJIT::setUpGenericLLVMIRPlatform
friend void setUpGenericLLVMIRPlatform(LLJIT &J)
Configure the LLJIT instance to scrape modules for llvm.global_ctors and llvm.global_dtors variables ...
Definition: LLJIT.cpp:1174
ThreadSafeModule.h
llvm::orc::LLLazyJITBuilderState
Definition: LLJIT.h:385
llvm::orc::LLJITBuilderSetters::setObjectLinkingLayerCreator
SetterImpl & setObjectLinkingLayerCreator(LLJITBuilderState::ObjectLinkingLayerCreator CreateObjectLinkingLayer)
Set an ObjectLinkingLayer creation function.
Definition: LLJIT.h:312
llvm::orc::LLJITBuilderState::TPC
TargetProcessControl * TPC
Definition: LLJIT.h:270
llvm::orc::LLLazyJIT::addLazyIRModule
Error addLazyIRModule(JITDylib &JD, ThreadSafeModule M)
Add a module to be lazily compiled to JITDylib JD.
Definition: LLJIT.cpp:1203
llvm::orc::LLJITBuilderState::CompileFunctionCreator
std::function< Expected< std::unique_ptr< IRCompileLayer::IRCompiler > >(JITTargetMachineBuilder JTMB)> CompileFunctionCreator
Definition: LLJIT.h:259
llvm::orc::LLJIT
A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
Definition: LLJIT.h:37
llvm::Optional
Definition: APInt.h:33
llvm::orc::IRCompileLayer
Definition: IRCompileLayer.h:30
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::orc::LLJIT::setPlatformSupport
void setPlatformSupport(std::unique_ptr< PlatformSupport > PS)
Set the PlatformSupport instance.
Definition: LLJIT.h:141
llvm::orc::LLLazyJITBuilderSetters::setIndirectStubsManagerBuilder
SetterImpl & setIndirectStubsManagerBuilder(LLLazyJITBuilderState::IndirectStubsManagerBuilderFunction ISMBuilder)
Set the IndirectStubsManager builder function.
Definition: LLJIT.h:426
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::orc::LLJIT::createCompileFunction
static Expected< std::unique_ptr< IRCompileLayer::IRCompiler > > createCompileFunction(LLJITBuilderState &S, JITTargetMachineBuilder JTMB)
Definition: LLJIT.cpp:1062
ExecutionUtils.h
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:132
llvm::orc::LLJITBuilderSetters::setTargetProcessControl
SetterImpl & setTargetProcessControl(TargetProcessControl &TPC)
Set a TargetProcessControl object.
Definition: LLJIT.h:359
llvm::orc::LLJITBuilderState::CreateObjectLinkingLayer
ObjectLinkingLayerCreator CreateObjectLinkingLayer
Definition: LLJIT.h:266
DEBUG_WITH_TYPE
#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
llvm::orc::LLJIT::addIRModule
Error addIRModule(ResourceTrackerSP RT, ThreadSafeModule TSM)
Adds an IR module with the given ResourceTracker.
Definition: LLJIT.cpp:1006
llvm::orc::CompileOnDemandLayer::PartitionFunction
std::function< Optional< GlobalValueSet >(GlobalValueSet Requested)> PartitionFunction
Partitioning function.
Definition: CompileOnDemandLayer.h:74
IRTransformLayer.h
llvm::orc::LLJIT::mangle
std::string mangle(StringRef UnmangledName) const
Returns a linker-mangled version of UnmangledName.
Definition: LLJIT.cpp:1151
llvm::orc::LLJITBuilderSetters::setExecutionSession
SetterImpl & setExecutionSession(std::unique_ptr< ExecutionSession > ES)
Set an ExecutionSession for this instance.
Definition: LLJIT.h:281
llvm::orc::LLJIT::mangleAndIntern
SymbolStringPtr mangleAndIntern(StringRef UnmangledName) const
Returns an interned, linker-mangled version of UnmangledName.
Definition: LLJIT.h:184
llvm::orc::LLLazyJIT
An extended version of LLJIT that supports lazy function-at-a-time compilation of LLVM IR.
Definition: LLJIT.h:220
llvm::orc::LLJIT::initialize
Error initialize(JITDylib &JD)
Run the initializers for the given JITDylib.
Definition: LLJIT.h:149
llvm::orc::LLJITBuilderSetters::impl
SetterImpl & impl()
Definition: LLJIT.h:377
llvm::orc::LLLazyJITBuilder
Constructs LLLazyJIT instances.
Definition: LLJIT.h:434
llvm::orc::LLLazyJITBuilderState::TT
Triple TT
Definition: LLJIT.h:392
llvm::orc::LLJITBuilderState::DL
Optional< DataLayout > DL
Definition: LLJIT.h:265
llvm::orc::ObjectLayer
Interface for Layers that accept object files.
Definition: Layer.h:134
llvm::orc::LLJIT::lookup
Expected< JITEvaluatedSymbol > lookup(JITDylib &JD, StringRef UnmangledName)
Look up a symbol in JITDylib JD based on its IR symbol name.
Definition: LLJIT.h:131
llvm::orc::LLJIT::createObjectLinkingLayer
static Expected< std::unique_ptr< ObjectLayer > > createObjectLinkingLayer(LLJITBuilderState &S, ExecutionSession &ES)
Definition: LLJIT.cpp:1038
llvm::orc::LLJITBuilderSetters::setJITTargetMachineBuilder
SetterImpl & setJITTargetMachineBuilder(JITTargetMachineBuilder JTMB)
Set the JITTargetMachineBuilder for this instance.
Definition: LLJIT.h:290
llvm::orc::TargetProcessControl
TargetProcessControl supports interaction with a JIT target process.
Definition: TargetProcessControl.h:32
llvm::orc::LLJITBuilderSetters::setDataLayout
SetterImpl & setDataLayout(Optional< DataLayout > DL)
Set a DataLayout for this instance.
Definition: LLJIT.h:303
llvm::orc::LLJITBuilderSetters::create
Expected< std::unique_ptr< JITType > > create()
Create an instance of the JIT.
Definition: LLJIT.h:365
ThreadPool.h
llvm::orc::setUpMachOPlatform
Error setUpMachOPlatform(LLJIT &J)
Configure the LLJIT instance to use MachOPlatform support.
Definition: LLJIT.cpp:1180
llvm::orc::LLJITBuilderState::ObjectLinkingLayerCreator
std::function< Expected< std::unique_ptr< ObjectLayer > >(ExecutionSession &, const Triple &)> ObjectLinkingLayerCreator
Definition: LLJIT.h:255
IRCompileLayer.h
llvm::orc::LLJIT::ObjTransformLayer
std::unique_ptr< ObjectTransformLayer > ObjTransformLayer
Definition: LLJIT.h:212
llvm::orc::LLJITBuilderSetters::setNumCompileThreads
SetterImpl & setNumCompileThreads(unsigned NumCompileThreads)
Set the number of compile threads to use.
Definition: LLJIT.h:348
llvm::orc::LLJIT::getJITDylibByName
JITDylib * getJITDylibByName(StringRef Name)
Returns the JITDylib with the given name, or nullptr if no JITDylib with that name exists.
Definition: LLJIT.h:75
llvm::orc::LLJIT::getIRCompileLayer
IRCompileLayer & getIRCompileLayer()
Returns a reference to the IR compile layer.
Definition: LLJIT.h:178
llvm::orc::LLJIT::ES
std::unique_ptr< ExecutionSession > ES
Definition: LLJIT.h:202
llvm::orc::LLJIT::CompileThreads
std::unique_ptr< ThreadPool > CompileThreads
Definition: LLJIT.h:209
Addr
uint64_t Addr
Definition: ELFObjHandler.cpp:80
llvm::orc::LLJIT::PlatformSupport::~PlatformSupport
virtual ~PlatformSupport()
Definition: LLJIT.cpp:928
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::orc::LLJIT::lookup
Expected< JITEvaluatedSymbol > lookup(StringRef UnmangledName)
Look up a symbol in the main JITDylib based on its IR symbol name.
Definition: LLJIT.h:136
llvm::orc::setUpGenericLLVMIRPlatform
void setUpGenericLLVMIRPlatform(LLJIT &J)
Configure the LLJIT instance to scrape modules for llvm.global_ctors and llvm.global_dtors variables ...
Definition: LLJIT.cpp:1174
llvm::orc::LLJIT::PlatformSupport::initialize
virtual Error initialize(JITDylib &JD)=0
llvm::orc::LLJIT::CompileLayer
std::unique_ptr< IRCompileLayer > CompileLayer
Definition: LLJIT.h:213
llvm::orc::ResourceTrackerSP
uint8_t IntrusiveRefCntPtr< ResourceTracker > ResourceTrackerSP
Definition: Core.h:44
llvm::orc::LLJITBuilderState::SetUpPlatform
PlatformSetupFunction SetUpPlatform
Definition: LLJIT.h:268
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::orc::LLJIT::lookupLinkerMangled
Expected< JITEvaluatedSymbol > 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:1031
llvm::orc::LLLazyJITBuilderState::IndirectStubsManagerBuilderFunction
std::function< std::unique_ptr< IndirectStubsManager >()> IndirectStubsManagerBuilderFunction
Definition: LLJIT.h:390
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:83
llvm::orc::LLJITBuilderState::ES
std::unique_ptr< ExecutionSession > ES
Definition: LLJIT.h:263
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::orc::LLJITBuilderSetters
Definition: LLJIT.h:277
llvm::orc::LLLazyJITBuilderState::LazyCompileFailureAddr
JITTargetAddress LazyCompileFailureAddr
Definition: LLJIT.h:393
llvm::orc::LLJIT::~LLJIT
~LLJIT()
Destruct this instance.
Definition: LLJIT.cpp:999
llvm::orc::LLJIT::TT
Triple TT
Definition: LLJIT.h:208
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::orc::LLJIT::DL
DataLayout DL
Definition: LLJIT.h:207
llvm::orc::LLJIT::PlatformSupport
Initializer support for LLJIT.
Definition: LLJIT.h:44
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::orc::LLJITBuilderState::PlatformSetupFunction
std::function< Error(LLJIT &J)> PlatformSetupFunction
Definition: LLJIT.h:261
llvm::orc::LLJIT::lookupLinkerMangled
Expected< JITEvaluatedSymbol > 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:126
llvm::orc::LLJIT::getObjLinkingLayer
ObjectLayer & getObjLinkingLayer()
Returns a reference to the ObjLinkingLayer.
Definition: LLJIT.h:169
llvm::orc::LLJITBuilderState::prepareForConstruction
Error prepareForConstruction()
Called prior to JIT class construcion to fix up defaults.
Definition: LLJIT.cpp:930
llvm::orc::LLLazyJITBuilderSetters::setLazyCompileFailureAddr
SetterImpl & setLazyCompileFailureAddr(JITTargetAddress Addr)
Set the address in the target address to call if a lazy compile fails.
Definition: LLJIT.h:407
llvm::orc::LLJIT::TransformLayer
std::unique_ptr< IRTransformLayer > TransformLayer
Definition: LLJIT.h:214
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::orc::LLLazyJIT::addLazyIRModule
Error addLazyIRModule(ThreadSafeModule M)
Add a module to be lazily compiled to the main JITDylib.
Definition: LLJIT.h:238
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::orc::LLLazyJITBuilderState::LCTMgr
std::unique_ptr< LazyCallThroughManager > LCTMgr
Definition: LLJIT.h:394
llvm::orc::ExecutionSession
An ExecutionSession represents a running JIT program.
Definition: Core.h:1221
llvm::orc::LLJIT::addIRModule
Error addIRModule(ThreadSafeModule TSM)
Adds an IR module to the Main JITDylib.
Definition: LLJIT.h:96
llvm::JITTargetAddress
uint64_t JITTargetAddress
Represents an address in the target process's address space.
Definition: JITSymbol.h:42
llvm::orc::LLJIT::getObjTransformLayer
ObjectTransformLayer & getObjTransformLayer()
Returns a reference to the object transform layer.
Definition: LLJIT.h:172
llvm::orc::IRTransformLayer
A layer that applies a transform to emitted modules.
Definition: IRTransformLayer.h:29
llvm::orc::JITDylib::getName
const std::string & getName() const
Get the name for this JITDylib.
Definition: Core.h:911
llvm::orc::LLJIT::Main
JITDylib * Main
Definition: LLJIT.h:205
llvm::orc::LLJIT::PlatformSupport::deinitialize
virtual Error deinitialize(JITDylib &JD)=0
llvm::orc::ObjectTransformLayer
Definition: ObjectTransformLayer.h:25
llvm::orc::LLJITBuilderSetters::setCompileFunctionCreator
SetterImpl & setCompileFunctionCreator(LLJITBuilderState::CompileFunctionCreator CreateCompileFunction)
Set a CompileFunctionCreator.
Definition: LLJIT.h:324
llvm::orc::LLJIT::getIRTransformLayer
IRTransformLayer & getIRTransformLayer()
Returns a reference to the IR transform layer.
Definition: LLJIT.h:175
CompileUtils.h
llvm::orc::LLJITBuilderSetters::setPlatformSetUp
SetterImpl & setPlatformSetUp(LLJITBuilderState::PlatformSetupFunction SetUpPlatform)
Set up an PlatformSetupFunction.
Definition: LLJIT.h:335
llvm::orc::ThreadSafeModule
An LLVM Module together with a shared ThreadSafeContext.
Definition: ThreadSafeModule.h:77
llvm::orc::LLJIT::PS
std::unique_ptr< PlatformSupport > PS
Definition: LLJIT.h:203
llvm::orc::LLJIT::applyDataLayout
Error applyDataLayout(Module &M)
Definition: LLJIT.cpp:1160
llvm::orc::LLJITBuilderState::CreateCompileFunction
CompileFunctionCreator CreateCompileFunction
Definition: LLJIT.h:267
CompileOnDemandLayer.h
llvm::orc::setUpInactivePlatform
Error setUpInactivePlatform(LLJIT &J)
Configure the LLJIT instance to disable platform support explicitly.
Definition: LLJIT.cpp:1189
llvm::orc::LLJIT::deinitialize
Error deinitialize(JITDylib &JD)
Run the deinitializers for the given JITDylib.
Definition: LLJIT.h:159
llvm::orc::LLJIT::addObjectFile
Error addObjectFile(std::unique_ptr< MemoryBuffer > Obj)
Adds an object file to the given JITDylib.
Definition: LLJIT.h:107
llvm::orc::LLLazyJITBuilderSetters
Definition: LLJIT.h:401
llvm::orc::LLLazyJIT::getCompileOnDemandLayer
CompileOnDemandLayer & getCompileOnDemandLayer()
Returns a reference to the on-demand layer.
Definition: LLJIT.h:232
llvm::orc::LLLazyJITBuilderState::ISMBuilder
IndirectStubsManagerBuilderFunction ISMBuilder
Definition: LLJIT.h:395
JITTargetMachineBuilder.h
Debug.h
llvm::orc::LLJIT::ObjLinkingLayer
std::unique_ptr< ObjectLayer > ObjLinkingLayer
Definition: LLJIT.h:211
llvm::orc::LLJIT::getExecutionSession
ExecutionSession & getExecutionSession()
Returns the ExecutionSession for this instance.
Definition: LLJIT.h:62
llvm::orc::CompileOnDemandLayer
Definition: CompileOnDemandLayer.h:62
llvm::orc::LLJIT::getDataLayout
const DataLayout & getDataLayout() const
Returns a reference to the DataLayout for this instance.
Definition: LLJIT.h:68