LLVM  7.0.0svn
OrcMCJITReplacement.h
Go to the documentation of this file.
1 //===- OrcMCJITReplacement.h - Orc based MCJIT replacement ------*- 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 // Orc based MCJIT replacement.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_EXECUTIONENGINE_ORC_ORCMCJITREPLACEMENT_H
15 #define LLVM_LIB_EXECUTIONENGINE_ORC_ORCMCJITREPLACEMENT_H
16 
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/ADT/STLExtras.h"
19 #include "llvm/ADT/StringRef.h"
30 #include "llvm/IR/DataLayout.h"
31 #include "llvm/IR/Function.h"
32 #include "llvm/IR/Mangler.h"
33 #include "llvm/IR/Module.h"
34 #include "llvm/Object/Archive.h"
35 #include "llvm/Object/Binary.h"
36 #include "llvm/Object/ObjectFile.h"
37 #include "llvm/Support/Error.h"
41 #include <algorithm>
42 #include <cassert>
43 #include <cstddef>
44 #include <cstdint>
45 #include <map>
46 #include <memory>
47 #include <set>
48 #include <string>
49 #include <vector>
50 
51 namespace llvm {
52 
53 class ObjectCache;
54 
55 namespace orc {
56 
58 
59  // OrcMCJITReplacement needs to do a little extra book-keeping to ensure that
60  // Orc's automatic finalization doesn't kick in earlier than MCJIT clients are
61  // expecting - see finalizeMemory.
62  class MCJITReplacementMemMgr : public MCJITMemoryManager {
63  public:
64  MCJITReplacementMemMgr(OrcMCJITReplacement &M,
65  std::shared_ptr<MCJITMemoryManager> ClientMM)
66  : M(M), ClientMM(std::move(ClientMM)) {}
67 
68  uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
69  unsigned SectionID,
70  StringRef SectionName) override {
71  uint8_t *Addr =
72  ClientMM->allocateCodeSection(Size, Alignment, SectionID,
73  SectionName);
74  M.SectionsAllocatedSinceLastLoad.insert(Addr);
75  return Addr;
76  }
77 
78  uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
79  unsigned SectionID, StringRef SectionName,
80  bool IsReadOnly) override {
81  uint8_t *Addr = ClientMM->allocateDataSection(Size, Alignment, SectionID,
82  SectionName, IsReadOnly);
83  M.SectionsAllocatedSinceLastLoad.insert(Addr);
84  return Addr;
85  }
86 
87  void reserveAllocationSpace(uintptr_t CodeSize, uint32_t CodeAlign,
88  uintptr_t RODataSize, uint32_t RODataAlign,
89  uintptr_t RWDataSize,
90  uint32_t RWDataAlign) override {
91  return ClientMM->reserveAllocationSpace(CodeSize, CodeAlign,
92  RODataSize, RODataAlign,
93  RWDataSize, RWDataAlign);
94  }
95 
96  bool needsToReserveAllocationSpace() override {
97  return ClientMM->needsToReserveAllocationSpace();
98  }
99 
100  void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr,
101  size_t Size) override {
102  return ClientMM->registerEHFrames(Addr, LoadAddr, Size);
103  }
104 
105  void deregisterEHFrames() override {
106  return ClientMM->deregisterEHFrames();
107  }
108 
109  void notifyObjectLoaded(RuntimeDyld &RTDyld,
110  const object::ObjectFile &O) override {
111  return ClientMM->notifyObjectLoaded(RTDyld, O);
112  }
113 
114  void notifyObjectLoaded(ExecutionEngine *EE,
115  const object::ObjectFile &O) override {
116  return ClientMM->notifyObjectLoaded(EE, O);
117  }
118 
119  bool finalizeMemory(std::string *ErrMsg = nullptr) override {
120  // Each set of objects loaded will be finalized exactly once, but since
121  // symbol lookup during relocation may recursively trigger the
122  // loading/relocation of other modules, and since we're forwarding all
123  // finalizeMemory calls to a single underlying memory manager, we need to
124  // defer forwarding the call on until all necessary objects have been
125  // loaded. Otherwise, during the relocation of a leaf object, we will end
126  // up finalizing memory, causing a crash further up the stack when we
127  // attempt to apply relocations to finalized memory.
128  // To avoid finalizing too early, look at how many objects have been
129  // loaded but not yet finalized. This is a bit of a hack that relies on
130  // the fact that we're lazily emitting object files: The only way you can
131  // get more than one set of objects loaded but not yet finalized is if
132  // they were loaded during relocation of another set.
133  if (M.UnfinalizedSections.size() == 1)
134  return ClientMM->finalizeMemory(ErrMsg);
135  return false;
136  }
137 
138  private:
140  std::shared_ptr<MCJITMemoryManager> ClientMM;
141  };
142 
143  class LinkingORCResolver : public orc::SymbolResolver {
144  public:
145  LinkingORCResolver(OrcMCJITReplacement &M) : M(M) {}
146 
147  SymbolNameSet lookupFlags(SymbolFlagsMap &SymbolFlags,
148  const SymbolNameSet &Symbols) override {
149  SymbolNameSet UnresolvedSymbols;
150 
151  for (auto &S : Symbols) {
152  if (auto Sym = M.findMangledSymbol(*S)) {
153  SymbolFlags[S] = Sym.getFlags();
154  } else if (auto Err = Sym.takeError()) {
155  M.reportError(std::move(Err));
156  return SymbolNameSet();
157  } else {
158  if (auto Sym2 = M.ClientResolver->findSymbolInLogicalDylib(*S)) {
159  SymbolFlags[S] = Sym2.getFlags();
160  } else if (auto Err = Sym2.takeError()) {
161  M.reportError(std::move(Err));
162  return SymbolNameSet();
163  } else
164  UnresolvedSymbols.insert(S);
165  }
166  }
167 
168  return UnresolvedSymbols;
169  }
170 
171  SymbolNameSet lookup(std::shared_ptr<AsynchronousSymbolQuery> Query,
172  SymbolNameSet Symbols) override {
173  SymbolNameSet UnresolvedSymbols;
174 
175  for (auto &S : Symbols) {
176  if (auto Sym = M.findMangledSymbol(*S)) {
177  if (auto Addr = Sym.getAddress())
178  Query->resolve(S, JITEvaluatedSymbol(*Addr, Sym.getFlags()));
179  else {
180  Query->notifyMaterializationFailed(Addr.takeError());
181  return SymbolNameSet();
182  }
183  } else if (auto Err = Sym.takeError()) {
184  Query->notifyMaterializationFailed(std::move(Err));
185  return SymbolNameSet();
186  } else {
187  if (auto Sym2 = M.ClientResolver->findSymbol(*S)) {
188  if (auto Addr = Sym2.getAddress())
189  Query->resolve(S, JITEvaluatedSymbol(*Addr, Sym2.getFlags()));
190  else {
191  Query->notifyMaterializationFailed(Addr.takeError());
192  return SymbolNameSet();
193  }
194  } else if (auto Err = Sym2.takeError()) {
195  Query->notifyMaterializationFailed(std::move(Err));
196  return SymbolNameSet();
197  } else
198  UnresolvedSymbols.insert(S);
199  }
200  }
201 
202  return UnresolvedSymbols;
203  }
204 
205  private:
207  };
208 
209 private:
210  static ExecutionEngine *
211  createOrcMCJITReplacement(std::string *ErrorMsg,
212  std::shared_ptr<MCJITMemoryManager> MemMgr,
213  std::shared_ptr<LegacyJITSymbolResolver> Resolver,
214  std::unique_ptr<TargetMachine> TM) {
215  return new OrcMCJITReplacement(std::move(MemMgr), std::move(Resolver),
216  std::move(TM));
217  }
218 
219  void reportError(Error Err) {
220  logAllUnhandledErrors(std::move(Err), errs(), "MCJIT error: ");
221  }
222 
223 public:
224  OrcMCJITReplacement(std::shared_ptr<MCJITMemoryManager> MemMgr,
225  std::shared_ptr<LegacyJITSymbolResolver> ClientResolver,
226  std::unique_ptr<TargetMachine> TM)
227  : ExecutionEngine(TM->createDataLayout()),
228  TM(std::move(TM)),
229  MemMgr(
230  std::make_shared<MCJITReplacementMemMgr>(*this, std::move(MemMgr))),
231  Resolver(std::make_shared<LinkingORCResolver>(*this)),
232  ClientResolver(std::move(ClientResolver)), NotifyObjectLoaded(*this),
233  NotifyFinalized(*this),
234  ObjectLayer(
235  ES,
236  [this](VModuleKey K) {
237  return ObjectLayerT::Resources{this->MemMgr, this->Resolver};
238  },
239  NotifyObjectLoaded, NotifyFinalized),
240  CompileLayer(ObjectLayer, SimpleCompiler(*this->TM),
241  [this](VModuleKey K, std::unique_ptr<Module> M) {
242  Modules.push_back(std::move(M));
243  }),
244  LazyEmitLayer(CompileLayer) {}
245 
246  static void Register() {
247  OrcMCJITReplacementCtor = createOrcMCJITReplacement;
248  }
249 
250  void addModule(std::unique_ptr<Module> M) override {
251  // If this module doesn't have a DataLayout attached then attach the
252  // default.
253  if (M->getDataLayout().isDefault()) {
254  M->setDataLayout(getDataLayout());
255  } else {
256  assert(M->getDataLayout() == getDataLayout() && "DataLayout Mismatch");
257  }
258 
259  // Rename, bump linkage and record static constructors and destructors.
260  // We have to do this before we hand over ownership of the module to the
261  // JIT.
262  std::vector<std::string> CtorNames, DtorNames;
263  {
264  unsigned CtorId = 0, DtorId = 0;
265  for (auto Ctor : orc::getConstructors(*M)) {
266  std::string NewCtorName = ("$static_ctor." + Twine(CtorId++)).str();
267  Ctor.Func->setName(NewCtorName);
268  Ctor.Func->setLinkage(GlobalValue::ExternalLinkage);
269  Ctor.Func->setVisibility(GlobalValue::HiddenVisibility);
270  CtorNames.push_back(mangle(NewCtorName));
271  }
272  for (auto Dtor : orc::getDestructors(*M)) {
273  std::string NewDtorName = ("$static_dtor." + Twine(DtorId++)).str();
274  dbgs() << "Found dtor: " << NewDtorName << "\n";
275  Dtor.Func->setName(NewDtorName);
276  Dtor.Func->setLinkage(GlobalValue::ExternalLinkage);
277  Dtor.Func->setVisibility(GlobalValue::HiddenVisibility);
278  DtorNames.push_back(mangle(NewDtorName));
279  }
280  }
281 
282  auto K = ES.allocateVModule();
283 
284  UnexecutedConstructors[K] = std::move(CtorNames);
285  UnexecutedDestructors[K] = std::move(DtorNames);
286 
287  cantFail(LazyEmitLayer.addModule(K, std::move(M)));
288  }
289 
290  void addObjectFile(std::unique_ptr<object::ObjectFile> O) override {
291  cantFail(ObjectLayer.addObject(
292  ES.allocateVModule(), MemoryBuffer::getMemBufferCopy(O->getData())));
293  }
294 
296  std::unique_ptr<object::ObjectFile> Obj;
297  std::unique_ptr<MemoryBuffer> ObjBuffer;
298  std::tie(Obj, ObjBuffer) = O.takeBinary();
299  cantFail(ObjectLayer.addObject(ES.allocateVModule(), std::move(ObjBuffer)));
300  }
301 
303  Archives.push_back(std::move(A));
304  }
305 
306  bool removeModule(Module *M) override {
307  auto I = Modules.begin();
308  for (auto E = Modules.end(); I != E; ++I)
309  if (I->get() == M)
310  break;
311  if (I == Modules.end())
312  return false;
313  Modules.erase(I);
314  return true;
315  }
316 
318  return cantFail(findSymbol(Name).getAddress());
319  }
320 
322  return findMangledSymbol(mangle(Name));
323  }
324 
325  void finalizeObject() override {
326  // This is deprecated - Aim to remove in ExecutionEngine.
327  // REMOVE IF POSSIBLE - Doesn't make sense for New JIT.
328  }
329 
330  void mapSectionAddress(const void *LocalAddress,
331  uint64_t TargetAddress) override {
332  for (auto &P : UnfinalizedSections)
333  if (P.second.count(LocalAddress))
334  ObjectLayer.mapSectionAddress(P.first, LocalAddress, TargetAddress);
335  }
336 
337  uint64_t getGlobalValueAddress(const std::string &Name) override {
338  return getSymbolAddress(Name);
339  }
340 
341  uint64_t getFunctionAddress(const std::string &Name) override {
342  return getSymbolAddress(Name);
343  }
344 
345  void *getPointerToFunction(Function *F) override {
346  uint64_t FAddr = getSymbolAddress(F->getName());
347  return reinterpret_cast<void *>(static_cast<uintptr_t>(FAddr));
348  }
349 
351  bool AbortOnFailure = true) override {
352  uint64_t Addr = getSymbolAddress(Name);
353  if (!Addr && AbortOnFailure)
354  llvm_unreachable("Missing symbol!");
355  return reinterpret_cast<void *>(static_cast<uintptr_t>(Addr));
356  }
357 
359  ArrayRef<GenericValue> ArgValues) override;
360 
361  void setObjectCache(ObjectCache *NewCache) override {
362  CompileLayer.getCompiler().setObjectCache(NewCache);
363  }
364 
365  void setProcessAllSections(bool ProcessAllSections) override {
366  ObjectLayer.setProcessAllSections(ProcessAllSections);
367  }
368 
369  void runStaticConstructorsDestructors(bool isDtors) override;
370 
371 private:
372  JITSymbol findMangledSymbol(StringRef Name) {
373  if (auto Sym = LazyEmitLayer.findSymbol(Name, false))
374  return Sym;
375  if (auto Sym = ClientResolver->findSymbol(Name))
376  return Sym;
377  if (auto Sym = scanArchives(Name))
378  return Sym;
379 
380  return nullptr;
381  }
382 
383  JITSymbol scanArchives(StringRef Name) {
384  for (object::OwningBinary<object::Archive> &OB : Archives) {
385  object::Archive *A = OB.getBinary();
386  // Look for our symbols in each Archive
387  auto OptionalChildOrErr = A->findSym(Name);
388  if (!OptionalChildOrErr)
389  report_fatal_error(OptionalChildOrErr.takeError());
390  auto &OptionalChild = *OptionalChildOrErr;
391  if (OptionalChild) {
392  // FIXME: Support nested archives?
394  OptionalChild->getAsBinary();
395  if (!ChildBinOrErr) {
396  // TODO: Actually report errors helpfully.
397  consumeError(ChildBinOrErr.takeError());
398  continue;
399  }
400  std::unique_ptr<object::Binary> &ChildBin = ChildBinOrErr.get();
401  if (ChildBin->isObject()) {
402  cantFail(ObjectLayer.addObject(
403  ES.allocateVModule(),
404  MemoryBuffer::getMemBufferCopy(ChildBin->getData())));
405  if (auto Sym = ObjectLayer.findSymbol(Name, true))
406  return Sym;
407  }
408  }
409  }
410  return nullptr;
411  }
412 
413  class NotifyObjectLoadedT {
414  public:
415  using LoadedObjInfoListT =
416  std::vector<std::unique_ptr<RuntimeDyld::LoadedObjectInfo>>;
417 
418  NotifyObjectLoadedT(OrcMCJITReplacement &M) : M(M) {}
419 
420  void operator()(VModuleKey K, const object::ObjectFile &Obj,
421  const RuntimeDyld::LoadedObjectInfo &Info) const {
422  M.UnfinalizedSections[K] = std::move(M.SectionsAllocatedSinceLastLoad);
423  M.SectionsAllocatedSinceLastLoad = SectionAddrSet();
424  M.MemMgr->notifyObjectLoaded(&M, Obj);
425  }
426  private:
428  };
429 
430  class NotifyFinalizedT {
431  public:
432  NotifyFinalizedT(OrcMCJITReplacement &M) : M(M) {}
433 
434  void operator()(VModuleKey K) { M.UnfinalizedSections.erase(K); }
435 
436  private:
438  };
439 
440  std::string mangle(StringRef Name) {
441  std::string MangledName;
442  {
443  raw_string_ostream MangledNameStream(MangledName);
444  Mang.getNameWithPrefix(MangledNameStream, Name, getDataLayout());
445  }
446  return MangledName;
447  }
448 
452 
453  ExecutionSession ES;
454 
455  std::unique_ptr<TargetMachine> TM;
456  std::shared_ptr<MCJITReplacementMemMgr> MemMgr;
457  std::shared_ptr<LinkingORCResolver> Resolver;
458  std::shared_ptr<LegacyJITSymbolResolver> ClientResolver;
459  Mangler Mang;
460 
461  // IMPORTANT: ShouldDelete *must* come before LocalModules: The shared_ptr
462  // delete blocks in LocalModules refer to the ShouldDelete map, so
463  // LocalModules needs to be destructed before ShouldDelete.
464  std::map<Module*, bool> ShouldDelete;
465 
466  NotifyObjectLoadedT NotifyObjectLoaded;
467  NotifyFinalizedT NotifyFinalized;
468 
469  ObjectLayerT ObjectLayer;
470  CompileLayerT CompileLayer;
471  LazyEmitLayerT LazyEmitLayer;
472 
473  std::map<VModuleKey, std::vector<std::string>> UnexecutedConstructors;
474  std::map<VModuleKey, std::vector<std::string>> UnexecutedDestructors;
475 
476  // We need to store ObjLayerT::ObjSetHandles for each of the object sets
477  // that have been emitted but not yet finalized so that we can forward the
478  // mapSectionAddress calls appropriately.
479  using SectionAddrSet = std::set<const void *>;
480  SectionAddrSet SectionsAllocatedSinceLastLoad;
481  std::map<VModuleKey, SectionAddrSet> UnfinalizedSections;
482 
483  std::vector<object::OwningBinary<object::Archive>> Archives;
484 };
485 
486 } // end namespace orc
487 
488 } // end namespace llvm
489 
490 #endif // LLVM_LIB_EXECUTIONENGINE_ORC_MCJITREPLACEMENT_H
void addObjectFile(std::unique_ptr< object::ObjectFile > O) override
addObjectFile - Add an ObjectFile to the execution engine.
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
Definition: Error.h:688
Information about the loaded object.
Definition: RuntimeDyld.h:69
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Represents a symbol in the JIT.
Definition: JITSymbol.h:183
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:115
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:63
void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner)
Log all errors (if any) in E to OS.
Definition: Error.cpp:57
void finalizeObject() override
finalizeObject - ensure the module is fully processed and is usable.
Expected< Optional< Child > > findSym(StringRef name) const
Definition: Archive.cpp:974
Bare bones object linking layer.
This class is the base class for all object file types.
Definition: ObjectFile.h:190
Externally visible function.
Definition: GlobalValue.h:49
F(f)
const DataLayout & getDataLayout() const
Error takeError()
Take ownership of the stored error.
Definition: Error.h:537
Expected< SymbolMap > lookup(const std::vector< VSO *> &VSOs, SymbolNameSet Names, MaterializationDispatcher DispatchMaterialization)
Look up a set of symbols by searching a list of VSOs.
Definition: Core.cpp:607
uint64_t VModuleKey
VModuleKey provides a unique identifier (allocated and managed by ExecutionSessions) for a module add...
Definition: Core.h:34
Definition: BitVector.h:921
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
uint64_t getFunctionAddress(const std::string &Name) override
getFunctionAddress - Return the address of the specified function.
std::map< SymbolStringPtr, JITSymbolFlags > SymbolFlagsMap
A map from symbol names (as SymbolStringPtrs) to JITSymbolFlags.
Definition: Core.h:51
Tagged union holding either a T or a Error.
Definition: CachePruning.h:23
Simple compile functor: Takes a single IR module and returns an ObjectFile.
Definition: CompileUtils.h:40
OrcMCJITReplacement(std::shared_ptr< MCJITMemoryManager > MemMgr, std::shared_ptr< LegacyJITSymbolResolver > ClientResolver, std::unique_ptr< TargetMachine > TM)
iterator_range< CtorDtorIterator > getDestructors(const Module &M)
Create an iterator range over the entries of the llvm.global_ctors array.
bool removeModule(Module *M) override
removeModule - Removes a Module from the list of modules, but does not free the module&#39;s memory...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
GenericValue runFunction(Function *F, ArrayRef< GenericValue > ArgValues) override
runFunction - Execute the specified function with the specified arguments, and return the result...
uint64_t getGlobalValueAddress(const std::string &Name) override
getGlobalValueAddress - Return the address of the specified global value.
#define P(N)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void addObjectFile(object::OwningBinary< object::ObjectFile > O) override
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
Definition: Record.h:1794
void setObjectCache(ObjectCache *NewCache) override
Sets the pre-compiled object cache.
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:962
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void * getPointerToFunction(Function *F) override
getPointerToFunction - The different EE&#39;s represent function bodies in different ways.
Abstract interface for implementation execution of LLVM modules, designed to support both interpreter...
std::pair< std::unique_ptr< T >, std::unique_ptr< MemoryBuffer > > takeBinary()
Definition: Binary.h:201
void runStaticConstructorsDestructors(bool isDtors) override
runStaticConstructorsDestructors - This method is used to execute all of the static constructors or d...
Module.h This file contains the declarations for the Module class.
JITSymbol findSymbol(StringRef Name)
uint64_t getSymbolAddress(StringRef Name)
reference get()
Returns a reference to the stored T value.
Definition: Error.h:517
An ExecutionSession represents a running JIT program.
Definition: Core.h:455
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:132
SymbolResolver is a composable interface for looking up symbol flags and addresses using the Asynchro...
Definition: Core.h:148
static std::unique_ptr< MemoryBuffer > getMemBufferCopy(StringRef InputData, const Twine &BufferName="")
Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it...
static ExecutionEngine *(* OrcMCJITReplacementCtor)(std::string *ErrorStr, std::shared_ptr< MCJITMemoryManager > MM, std::shared_ptr< LegacyJITSymbolResolver > SR, std::unique_ptr< TargetMachine > TM)
Represents a symbol that has been evaluated to an address already.
Definition: JITSymbol.h:157
SmallVector< std::unique_ptr< Module >, 1 > Modules
The list of Modules that we are JIT&#39;ing from.
StringRef getName() const
Return a constant reference to the value&#39;s name.
Definition: Value.cpp:224
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
static void Query(const MachineInstr &MI, AliasAnalysis &AA, bool &Read, bool &Write, bool &Effects, bool &StackPointer)
void setProcessAllSections(bool ProcessAllSections) override
setProcessAllSections (MCJIT Only): By default, only sections that are "required for execution" are p...
This is the base ObjectCache type which can be provided to an ExecutionEngine for the purpose of avoi...
Definition: ObjectCache.h:23
void addModule(std::unique_ptr< Module > M) override
Add a Module to the list of modules that we can JIT from.
void * getPointerToNamedFunction(StringRef Name, bool AbortOnFailure=true) override
getPointerToNamedFunction - This method returns the address of the specified function by using the dl...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:467
void addArchive(object::OwningBinary< object::Archive > A) override
addArchive - Add an Archive to the execution engine.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
Lightweight error class with error context and mandatory checking.
Definition: Error.h:156
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
std::set< SymbolStringPtr > SymbolNameSet
A set of symbol names (represented by SymbolStringPtrs for.
Definition: Core.h:38
void mapSectionAddress(const void *LocalAddress, uint64_t TargetAddress) override
mapSectionAddress - map a section to its target address space value.