LLVM  8.0.0svn
OrcCBindingsStack.h
Go to the documentation of this file.
1 //===- OrcCBindingsStack.h - Orc JIT stack for C bindings -----*- C++ -*---===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_LIB_EXECUTIONENGINE_ORC_ORCCBINDINGSSTACK_H
11 #define LLVM_LIB_EXECUTIONENGINE_ORC_ORCCBINDINGSSTACK_H
12 
13 #include "llvm-c/OrcBindings.h"
14 #include "llvm-c/TargetMachine.h"
15 #include "llvm/ADT/STLExtras.h"
16 #include "llvm/ADT/StringRef.h"
27 #include "llvm/IR/DataLayout.h"
28 #include "llvm/IR/Mangler.h"
29 #include "llvm/IR/Module.h"
31 #include "llvm/Support/Error.h"
34 #include <algorithm>
35 #include <cstdint>
36 #include <functional>
37 #include <map>
38 #include <memory>
39 #include <set>
40 #include <string>
41 #include <vector>
42 
43 namespace llvm {
44 
45 class OrcCBindingsStack;
46 
49 
50 namespace detail {
51 
52 // FIXME: Kill this off once the Layer concept becomes an interface.
53 class GenericLayer {
54 public:
55  virtual ~GenericLayer() = default;
56 
57  virtual JITSymbol findSymbolIn(orc::VModuleKey K, const std::string &Name,
58  bool ExportedSymbolsOnly) = 0;
59  virtual Error removeModule(orc::VModuleKey K) = 0;
60  };
61 
62  template <typename LayerT> class GenericLayerImpl : public GenericLayer {
63  public:
64  GenericLayerImpl(LayerT &Layer) : Layer(Layer) {}
65 
66  JITSymbol findSymbolIn(orc::VModuleKey K, const std::string &Name,
67  bool ExportedSymbolsOnly) override {
68  return Layer.findSymbolIn(K, Name, ExportedSymbolsOnly);
69  }
70 
72  return Layer.removeModule(K);
73  }
74 
75  private:
76  LayerT &Layer;
77  };
78 
79  template <>
80  class GenericLayerImpl<orc::RTDyldObjectLinkingLayer> : public GenericLayer {
81  private:
83  public:
84  GenericLayerImpl(LayerT &Layer) : Layer(Layer) {}
85 
86  JITSymbol findSymbolIn(orc::VModuleKey K, const std::string &Name,
87  bool ExportedSymbolsOnly) override {
88  return Layer.findSymbolIn(K, Name, ExportedSymbolsOnly);
89  }
90 
92  return Layer.removeObject(K);
93  }
94 
95  private:
96  LayerT &Layer;
97  };
98 
99  template <typename LayerT>
100  std::unique_ptr<GenericLayerImpl<LayerT>> createGenericLayer(LayerT &Layer) {
101  return llvm::make_unique<GenericLayerImpl<LayerT>>(Layer);
102  }
103 
104 } // end namespace detail
105 
107 public:
108 
112  using CODLayerT =
114 
115  using CallbackManagerBuilder =
116  std::function<std::unique_ptr<CompileCallbackMgr>()>;
117 
119 
120 private:
121 
123 
124  class CBindingsResolver : public orc::SymbolResolver {
125  public:
126  CBindingsResolver(OrcCBindingsStack &Stack,
127  LLVMOrcSymbolResolverFn ExternalResolver,
128  void *ExternalResolverCtx)
129  : Stack(Stack), ExternalResolver(std::move(ExternalResolver)),
130  ExternalResolverCtx(std::move(ExternalResolverCtx)) {}
131 
133  getResponsibilitySet(const orc::SymbolNameSet &Symbols) override {
135 
136  for (auto &S : Symbols) {
137  if (auto Sym = findSymbol(*S)) {
138  if (!Sym.getFlags().isStrong())
139  Result.insert(S);
140  } else if (auto Err = Sym.takeError()) {
141  Stack.reportError(std::move(Err));
142  return orc::SymbolNameSet();
143  }
144  }
145 
146  return Result;
147  }
148 
150  lookup(std::shared_ptr<orc::AsynchronousSymbolQuery> Query,
151  orc::SymbolNameSet Symbols) override {
152  orc::SymbolNameSet UnresolvedSymbols;
153 
154  for (auto &S : Symbols) {
155  if (auto Sym = findSymbol(*S)) {
156  if (auto Addr = Sym.getAddress()) {
157  Query->resolve(S, JITEvaluatedSymbol(*Addr, Sym.getFlags()));
158  Query->notifySymbolReady();
159  } else {
160  Stack.ES.legacyFailQuery(*Query, Addr.takeError());
161  return orc::SymbolNameSet();
162  }
163  } else if (auto Err = Sym.takeError()) {
164  Stack.ES.legacyFailQuery(*Query, std::move(Err));
165  return orc::SymbolNameSet();
166  } else
167  UnresolvedSymbols.insert(S);
168  }
169 
170  if (Query->isFullyResolved())
171  Query->handleFullyResolved();
172 
173  if (Query->isFullyReady())
174  Query->handleFullyReady();
175 
176  return UnresolvedSymbols;
177  }
178 
179  private:
180  JITSymbol findSymbol(const std::string &Name) {
181  // Search order:
182  // 1. JIT'd symbols.
183  // 2. Runtime overrides.
184  // 3. External resolver (if present).
185 
186  if (auto Sym = Stack.CODLayer.findSymbol(Name, true))
187  return Sym;
188  else if (auto Err = Sym.takeError())
189  return Sym.takeError();
190 
191  if (auto Sym = Stack.CXXRuntimeOverrides.searchOverrides(Name))
192  return Sym;
193 
194  if (ExternalResolver)
195  return JITSymbol(ExternalResolver(Name.c_str(), ExternalResolverCtx),
197 
198  return JITSymbol(nullptr);
199  }
200 
201  OrcCBindingsStack &Stack;
202  LLVMOrcSymbolResolverFn ExternalResolver;
203  void *ExternalResolverCtx = nullptr;
204  };
205 
206 public:
208  IndirectStubsManagerBuilder IndirectStubsMgrBuilder)
209  : CCMgr(createLocalCompileCallbackManager(TM.getTargetTriple(), ES, 0)),
210  DL(TM.createDataLayout()), IndirectStubsMgr(IndirectStubsMgrBuilder()),
211  ObjectLayer(ES,
212  [this](orc::VModuleKey K) {
213  auto ResolverI = Resolvers.find(K);
214  assert(ResolverI != Resolvers.end() &&
215  "No resolver for module K");
216  auto Resolver = std::move(ResolverI->second);
217  Resolvers.erase(ResolverI);
218  return ObjLayerT::Resources{
219  std::make_shared<SectionMemoryManager>(), Resolver};
220  },
221  nullptr,
222  [this](orc::VModuleKey K, const object::ObjectFile &Obj,
223  const RuntimeDyld::LoadedObjectInfo &LoadedObjInfo) {
224  this->notifyFinalized(K, Obj, LoadedObjInfo);
225  },
226  [this](orc::VModuleKey K, const object::ObjectFile &Obj) {
227  this->notifyFreed(K, Obj);
228  }),
229  CompileLayer(ObjectLayer, orc::SimpleCompiler(TM)),
230  CODLayer(ES, CompileLayer,
231  [this](orc::VModuleKey K) {
232  auto ResolverI = Resolvers.find(K);
233  assert(ResolverI != Resolvers.end() &&
234  "No resolver for module K");
235  return ResolverI->second;
236  },
237  [this](orc::VModuleKey K,
238  std::shared_ptr<orc::SymbolResolver> Resolver) {
239  assert(!Resolvers.count(K) && "Resolver already present");
240  Resolvers[K] = std::move(Resolver);
241  },
242  [](Function &F) { return std::set<Function *>({&F}); },
243  *this->CCMgr, std::move(IndirectStubsMgrBuilder), false),
244  CXXRuntimeOverrides(
245  [this](const std::string &S) { return mangle(S); }) {}
246 
248  // Run any destructors registered with __cxa_atexit.
249  CXXRuntimeOverrides.runDestructors();
250  // Run any IR destructors.
251  for (auto &DtorRunner : IRStaticDestructorRunners)
252  if (auto Err = DtorRunner.runViaLayer(*this))
253  return mapError(std::move(Err));
254  return LLVMOrcErrSuccess;
255  }
256 
257  std::string mangle(StringRef Name) {
258  std::string MangledName;
259  {
260  raw_string_ostream MangledNameStream(MangledName);
261  Mangler::getNameWithPrefix(MangledNameStream, Name, DL);
262  }
263  return MangledName;
264  }
265 
266  template <typename PtrTy>
267  static PtrTy fromTargetAddress(JITTargetAddress Addr) {
268  return reinterpret_cast<PtrTy>(static_cast<uintptr_t>(Addr));
269  }
270 
271 
275  void *CallbackCtx) {
276  auto WrappedCallback = [=]() -> JITTargetAddress {
277  return Callback(wrap(this), CallbackCtx);
278  };
279 
280  if (auto CCAddr = CCMgr->getCompileCallback(std::move(WrappedCallback))) {
281  RetAddr = *CCAddr;
282  return LLVMOrcErrSuccess;
283  } else
284  return mapError(CCAddr.takeError());
285  }
286 
288  JITTargetAddress Addr) {
289  return mapError(
290  IndirectStubsMgr->createStub(StubName, Addr, JITSymbolFlags::Exported));
291  }
292 
294  JITTargetAddress Addr) {
295  return mapError(IndirectStubsMgr->updatePointer(Name, Addr));
296  }
297  template <typename LayerT>
299  addIRModule(orc::VModuleKey &RetKey, LayerT &Layer, std::unique_ptr<Module> M,
300  std::unique_ptr<RuntimeDyld::MemoryManager> MemMgr,
301  LLVMOrcSymbolResolverFn ExternalResolver,
302  void *ExternalResolverCtx) {
303 
304  // Attach a data-layout if one isn't already present.
305  if (M->getDataLayout().isDefault())
306  M->setDataLayout(DL);
307 
308  // Record the static constructors and destructors. We have to do this before
309  // we hand over ownership of the module to the JIT.
310  std::vector<std::string> CtorNames, DtorNames;
311  for (auto Ctor : orc::getConstructors(*M))
312  CtorNames.push_back(mangle(Ctor.Func->getName()));
313  for (auto Dtor : orc::getDestructors(*M))
314  DtorNames.push_back(mangle(Dtor.Func->getName()));
315 
316  // Add the module to the JIT.
317  RetKey = ES.allocateVModule();
318  Resolvers[RetKey] = std::make_shared<CBindingsResolver>(
319  *this, ExternalResolver, ExternalResolverCtx);
320  if (auto Err = Layer.addModule(RetKey, std::move(M)))
321  return mapError(std::move(Err));
322 
323  KeyLayers[RetKey] = detail::createGenericLayer(Layer);
324 
325  // Run the static constructors, and save the static destructor runner for
326  // execution when the JIT is torn down.
327  orc::CtorDtorRunner<OrcCBindingsStack> CtorRunner(std::move(CtorNames),
328  RetKey);
329  if (auto Err = CtorRunner.runViaLayer(*this))
330  return mapError(std::move(Err));
331 
332  IRStaticDestructorRunners.emplace_back(std::move(DtorNames), RetKey);
333 
334  return LLVMOrcErrSuccess;
335  }
336 
338  std::unique_ptr<Module> M,
339  LLVMOrcSymbolResolverFn ExternalResolver,
340  void *ExternalResolverCtx) {
341  return addIRModule(RetKey, CompileLayer, std::move(M),
342  llvm::make_unique<SectionMemoryManager>(),
343  std::move(ExternalResolver), ExternalResolverCtx);
344  }
345 
347  std::unique_ptr<Module> M,
348  LLVMOrcSymbolResolverFn ExternalResolver,
349  void *ExternalResolverCtx) {
350  return addIRModule(RetKey, CODLayer, std::move(M),
351  llvm::make_unique<SectionMemoryManager>(),
352  std::move(ExternalResolver), ExternalResolverCtx);
353  }
354 
356  // FIXME: Should error release the module key?
357  if (auto Err = KeyLayers[K]->removeModule(K))
358  return mapError(std::move(Err));
359  ES.releaseVModule(K);
360  KeyLayers.erase(K);
361  return LLVMOrcErrSuccess;
362  }
363 
365  std::unique_ptr<MemoryBuffer> ObjBuffer,
366  LLVMOrcSymbolResolverFn ExternalResolver,
367  void *ExternalResolverCtx) {
369  ObjBuffer->getMemBufferRef())) {
370 
371  RetKey = ES.allocateVModule();
372  Resolvers[RetKey] = std::make_shared<CBindingsResolver>(
373  *this, ExternalResolver, ExternalResolverCtx);
374 
375  if (auto Err = ObjectLayer.addObject(RetKey, std::move(ObjBuffer)))
376  return mapError(std::move(Err));
377 
378  KeyLayers[RetKey] = detail::createGenericLayer(ObjectLayer);
379 
380  return LLVMOrcErrSuccess;
381  } else
382  return mapError(Obj.takeError());
383  }
384 
385  JITSymbol findSymbol(const std::string &Name,
386  bool ExportedSymbolsOnly) {
387  if (auto Sym = IndirectStubsMgr->findStub(Name, ExportedSymbolsOnly))
388  return Sym;
389  return CODLayer.findSymbol(mangle(Name), ExportedSymbolsOnly);
390  }
391 
393  bool ExportedSymbolsOnly) {
394  assert(KeyLayers.count(K) && "looking up symbol in unknown module");
395  return KeyLayers[K]->findSymbolIn(K, mangle(Name), ExportedSymbolsOnly);
396  }
397 
399  const std::string &Name,
400  bool ExportedSymbolsOnly) {
401  RetAddr = 0;
402  if (auto Sym = findSymbol(Name, ExportedSymbolsOnly)) {
403  // Successful lookup, non-null symbol:
404  if (auto AddrOrErr = Sym.getAddress()) {
405  RetAddr = *AddrOrErr;
406  return LLVMOrcErrSuccess;
407  } else
408  return mapError(AddrOrErr.takeError());
409  } else if (auto Err = Sym.takeError()) {
410  // Lookup failure - report error.
411  return mapError(std::move(Err));
412  }
413  // Otherwise we had a successful lookup but got a null result. We already
414  // set RetAddr to '0' above, so just return success.
415  return LLVMOrcErrSuccess;
416  }
417 
419  orc::VModuleKey K,
420  const std::string &Name,
421  bool ExportedSymbolsOnly) {
422  RetAddr = 0;
423  if (auto Sym = findSymbolIn(K, Name, ExportedSymbolsOnly)) {
424  // Successful lookup, non-null symbol:
425  if (auto AddrOrErr = Sym.getAddress()) {
426  RetAddr = *AddrOrErr;
427  return LLVMOrcErrSuccess;
428  } else
429  return mapError(AddrOrErr.takeError());
430  } else if (auto Err = Sym.takeError()) {
431  // Lookup failure - report error.
432  return mapError(std::move(Err));
433  }
434  // Otherwise we had a successful lookup but got a null result. We already
435  // set RetAddr to '0' above, so just return success.
436  return LLVMOrcErrSuccess;
437  }
438 
439  const std::string &getErrorMessage() const { return ErrMsg; }
440 
442  if (!L)
443  return;
444  EventListeners.push_back(L);
445  }
446 
448  if (!L)
449  return;
450 
451  auto I = find(reverse(EventListeners), L);
452  if (I != EventListeners.rend()) {
453  std::swap(*I, EventListeners.back());
454  EventListeners.pop_back();
455  }
456  }
457 
458 private:
459 
460  LLVMOrcErrorCode mapError(Error Err) {
462  handleAllErrors(std::move(Err), [&](ErrorInfoBase &EIB) {
463  // Handler of last resort.
464  Result = LLVMOrcErrGeneric;
465  ErrMsg = "";
466  raw_string_ostream ErrStream(ErrMsg);
467  EIB.log(ErrStream);
468  });
469  return Result;
470  }
471 
472  void reportError(Error Err) {
473  // FIXME: Report errors on the execution session.
474  logAllUnhandledErrors(std::move(Err), errs(), "ORC error: ");
475  };
476 
477  void notifyFinalized(orc::VModuleKey K,
478  const object::ObjectFile &Obj,
479  const RuntimeDyld::LoadedObjectInfo &LoadedObjInfo) {
480  for (auto &Listener : EventListeners)
481  Listener->NotifyObjectEmitted(Obj, LoadedObjInfo);
482  }
483 
484  void notifyFreed(orc::VModuleKey K, const object::ObjectFile &Obj) {
485  for (auto &Listener : EventListeners)
486  Listener->NotifyFreeingObject(Obj);
487  }
488 
490  std::unique_ptr<CompileCallbackMgr> CCMgr;
491 
492  std::vector<JITEventListener *> EventListeners;
493 
494  DataLayout DL;
495  SectionMemoryManager CCMgrMemMgr;
496 
497  std::unique_ptr<orc::IndirectStubsManager> IndirectStubsMgr;
498 
499  ObjLayerT ObjectLayer;
500  CompileLayerT CompileLayer;
501  CODLayerT CODLayer;
502 
503  std::map<orc::VModuleKey, std::unique_ptr<detail::GenericLayer>> KeyLayers;
504 
505  orc::LocalCXXRuntimeOverrides CXXRuntimeOverrides;
506  std::vector<orc::CtorDtorRunner<OrcCBindingsStack>> IRStaticDestructorRunners;
507  std::string ErrMsg;
508 
509  std::map<orc::VModuleKey, std::shared_ptr<orc::SymbolResolver>> Resolvers;
510 };
511 
512 } // end namespace llvm
513 
514 #endif // LLVM_LIB_EXECUTIONENGINE_ORC_ORCCBINDINGSSTACK_H
static Expected< OwningBinary< ObjectFile > > createObjectFile(StringRef ObjectPath)
Definition: ObjectFile.cpp:153
Information about the loaded object.
Definition: RuntimeDyld.h:69
A parsed version of the target data layout string in and methods for querying it. ...
Definition: DataLayout.h:111
void RegisterJITEventListener(JITEventListener *L)
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
CODLayerT::IndirectStubsManagerBuilderT IndirectStubsManagerBuilder
Represents a symbol in the JIT.
Definition: JITSymbol.h:226
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner)
Log all errors (if any) in E to OS.
Definition: Error.cpp:61
std::function< std::unique_ptr< CompileCallbackMgr >()> CallbackManagerBuilder
LLVMOrcErrorCode setIndirectStubPointer(StringRef Name, JITTargetAddress Addr)
JITEventListener - Abstract interface for use by the JIT to notify clients about significant events d...
Bare bones object linking layer.
This class is the base class for all object file types.
Definition: ObjectFile.h:190
F(f)
Base class for error info classes.
Definition: Error.h:49
uint64_t VModuleKey
VModuleKey provides a unique identifier (allocated and managed by ExecutionSessions) for a module add...
Definition: Core.h:40
LLVMOrcErrorCode addIRModuleEager(orc::VModuleKey &RetKey, std::unique_ptr< Module > M, LLVMOrcSymbolResolverFn ExternalResolver, void *ExternalResolverCtx)
Target-independent base class for compile callback management.
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
struct LLVMOpaqueTargetMachine * LLVMTargetMachineRef
Definition: TargetMachine.h:28
JITSymbol findSymbolIn(orc::VModuleKey K, const std::string &Name, bool ExportedSymbolsOnly) override
std::function< std::unique_ptr< IndirectStubsManager >()> IndirectStubsManagerBuilderT
Builder for IndirectStubsManagers.
virtual void log(raw_ostream &OS) const =0
Print an error message to an output stream.
LLVMOrcErrorCode shutdown()
Simple compile functor: Takes a single IR module and returns an ObjectFile.
Definition: CompileUtils.h:42
static const uint16_t * lookup(unsigned opcode, unsigned domain, ArrayRef< uint16_t[3]> Table)
JITEvaluatedSymbol searchOverrides(const std::string &Name)
Search overrided symbols.
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
Definition: STLExtras.h:251
iterator_range< CtorDtorIterator > getDestructors(const Module &M)
Create an iterator range over the entries of the llvm.global_ctors array.
LLVMOrcErrorCode addObject(orc::VModuleKey &RetKey, std::unique_ptr< MemoryBuffer > ObjBuffer, LLVMOrcSymbolResolverFn ExternalResolver, void *ExternalResolverCtx)
JITSymbol findSymbolIn(orc::VModuleKey K, const std::string &Name, bool ExportedSymbolsOnly) override
LLVMOrcErrorCode removeModule(orc::VModuleKey K)
void legacyFailQuery(AsynchronousSymbolQuery &Q, Error Err)
Definition: Core.cpp:1368
LLVMOrcErrorCode
Definition: OrcBindings.h:39
uint64_t JITTargetAddress
Represents an address in the target process&#39;s address space.
Definition: JITSymbol.h:41
Error runViaLayer(JITLayerT &JITLayer) const
Run the recorded constructors/destructors through the given JIT layer.
Convenience class for recording constructor/destructor names for later execution. ...
virtual ~GenericLayer()=default
void UnregisterJITEventListener(JITEventListener *L)
LLVMOrcErrorCode createIndirectStub(StringRef StubName, JITTargetAddress Addr)
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
Definition: Record.h:1774
virtual Error removeModule(orc::VModuleKey K)=0
auto find(R &&Range, const T &Val) -> decltype(adl_begin(Range))
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly...
Definition: STLExtras.h:1063
std::string mangle(StringRef Name)
JITSymbol findSymbolIn(orc::VModuleKey K, const std::string &Name, bool ExportedSymbolsOnly)
void handleAllErrors(Error E, HandlerTs &&... Handlers)
Behaves the same as handleErrors, except that by contract all errors must be handled by the given han...
Definition: Error.h:905
LLVMOrcErrorCode addIRModuleLazy(orc::VModuleKey &RetKey, std::unique_ptr< Module > M, LLVMOrcSymbolResolverFn ExternalResolver, void *ExternalResolverCtx)
std::unique_ptr< GenericLayerImpl< LayerT > > createGenericLayer(LayerT &Layer)
Module.h This file contains the declarations for the Module class.
virtual JITSymbol findSymbolIn(orc::VModuleKey K, const std::string &Name, bool ExportedSymbolsOnly)=0
LLVMOrcErrorCode createLazyCompileCallback(JITTargetAddress &RetAddr, LLVMOrcLazyCompileCallbackFn Callback, void *CallbackCtx)
uint64_t(* LLVMOrcLazyCompileCallbackFn)(LLVMOrcJITStackRef JITStack, void *CallbackCtx)
Definition: OrcBindings.h:36
An ExecutionSession represents a running JIT program.
Definition: Core.h:619
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition: BitVector.h:941
SymbolResolver is a composable interface for looking up symbol flags and addresses using the Asynchro...
Definition: Legacy.h:30
LLVMOrcErrorCode addIRModule(orc::VModuleKey &RetKey, LayerT &Layer, std::unique_ptr< Module > M, std::unique_ptr< RuntimeDyld::MemoryManager > MemMgr, LLVMOrcSymbolResolverFn ExternalResolver, void *ExternalResolverCtx)
Represents a symbol that has been evaluated to an address already.
Definition: JITSymbol.h:197
const std::string & getErrorMessage() const
static PtrTy fromTargetAddress(JITTargetAddress Addr)
static int reportError(const char *ProgName, Twine Msg)
Definition: Main.cpp:49
uint64_t(* LLVMOrcSymbolResolverFn)(const char *Name, void *LookupCtx)
Definition: OrcBindings.h:35
LLVMAttributeRef wrap(Attribute Attr)
Definition: Attributes.h:190
OrcCBindingsStack(TargetMachine &TM, IndirectStubsManagerBuilder IndirectStubsMgrBuilder)
iterator_range< CtorDtorIterator > getConstructors(const Module &M)
Create an iterator range over the entries of the llvm.global_ctors array.
#define I(x, y, z)
Definition: MD5.cpp:58
LLVMOrcErrorCode findSymbolAddressIn(JITTargetAddress &RetAddr, orc::VModuleKey K, const std::string &Name, bool ExportedSymbolsOnly)
std::unique_ptr< JITCompileCallbackManager > createLocalCompileCallbackManager(const Triple &T, ExecutionSession &ES, JITTargetAddress ErrorHandlerAddress)
Create a local compile callback manager.
static void Query(const MachineInstr &MI, AliasAnalysis &AA, bool &Read, bool &Write, bool &Effects, bool &StackPointer)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This is a simple memory manager which implements the methods called by the RuntimeDyld class to alloc...
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:483
JITSymbol findSymbol(const std::string &Name, bool ExportedSymbolsOnly)
Lightweight error class with error context and mandatory checking.
Definition: Error.h:158
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:59
Error removeModule(orc::VModuleKey K) override
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, bool CannotUsePrivateLabel) const
Print the appropriate prefix and the specified global variable&#39;s name.
Definition: Mangler.cpp:112
Error takeError()
Move the error field value out of this JITSymbol.
Definition: JITSymbol.h:294
JITSymbol findSymbol(StringRef Name, bool ExportedSymbolsOnly)
Search for the given named symbol.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
struct LLVMOrcOpaqueJITStack * LLVMOrcJITStackRef
Definition: OrcBindings.h:32
std::set< SymbolStringPtr > SymbolNameSet
A set of symbol names (represented by SymbolStringPtrs for.
Definition: Core.h:44
LLVMOrcErrorCode findSymbolAddress(JITTargetAddress &RetAddr, const std::string &Name, bool ExportedSymbolsOnly)