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  bool NewSymbolsResolved = false;
175 
176  for (auto &S : Symbols) {
177  if (auto Sym = M.findMangledSymbol(*S)) {
178  if (auto Addr = Sym.getAddress()) {
179  Query->resolve(S, JITEvaluatedSymbol(*Addr, Sym.getFlags()));
180  Query->notifySymbolReady();
181  NewSymbolsResolved = true;
182  } else {
183  M.ES.failQuery(*Query, Addr.takeError());
184  return SymbolNameSet();
185  }
186  } else if (auto Err = Sym.takeError()) {
187  M.ES.failQuery(*Query, std::move(Err));
188  return SymbolNameSet();
189  } else {
190  if (auto Sym2 = M.ClientResolver->findSymbol(*S)) {
191  if (auto Addr = Sym2.getAddress()) {
192  Query->resolve(S, JITEvaluatedSymbol(*Addr, Sym2.getFlags()));
193  Query->notifySymbolReady();
194  NewSymbolsResolved = true;
195  } else {
196  M.ES.failQuery(*Query, Addr.takeError());
197  return SymbolNameSet();
198  }
199  } else if (auto Err = Sym2.takeError()) {
200  M.ES.failQuery(*Query, std::move(Err));
201  return SymbolNameSet();
202  } else
203  UnresolvedSymbols.insert(S);
204  }
205  }
206 
207  if (NewSymbolsResolved && Query->isFullyResolved())
208  Query->handleFullyResolved();
209 
210  if (NewSymbolsResolved && Query->isFullyReady())
211  Query->handleFullyReady();
212 
213  return UnresolvedSymbols;
214  }
215 
216  private:
218  };
219 
220 private:
221  static ExecutionEngine *
222  createOrcMCJITReplacement(std::string *ErrorMsg,
223  std::shared_ptr<MCJITMemoryManager> MemMgr,
224  std::shared_ptr<LegacyJITSymbolResolver> Resolver,
225  std::unique_ptr<TargetMachine> TM) {
226  return new OrcMCJITReplacement(std::move(MemMgr), std::move(Resolver),
227  std::move(TM));
228  }
229 
230  void reportError(Error Err) {
231  logAllUnhandledErrors(std::move(Err), errs(), "MCJIT error: ");
232  }
233 
234 public:
235  OrcMCJITReplacement(std::shared_ptr<MCJITMemoryManager> MemMgr,
236  std::shared_ptr<LegacyJITSymbolResolver> ClientResolver,
237  std::unique_ptr<TargetMachine> TM)
238  : ExecutionEngine(TM->createDataLayout()),
239  TM(std::move(TM)),
240  MemMgr(
241  std::make_shared<MCJITReplacementMemMgr>(*this, std::move(MemMgr))),
242  Resolver(std::make_shared<LinkingORCResolver>(*this)),
243  ClientResolver(std::move(ClientResolver)), NotifyObjectLoaded(*this),
244  NotifyFinalized(*this),
245  ObjectLayer(
246  ES,
247  [this](VModuleKey K) {
248  return ObjectLayerT::Resources{this->MemMgr, this->Resolver};
249  },
250  NotifyObjectLoaded, NotifyFinalized),
251  CompileLayer(ObjectLayer, SimpleCompiler(*this->TM),
252  [this](VModuleKey K, std::unique_ptr<Module> M) {
253  Modules.push_back(std::move(M));
254  }),
255  LazyEmitLayer(CompileLayer) {}
256 
257  static void Register() {
258  OrcMCJITReplacementCtor = createOrcMCJITReplacement;
259  }
260 
261  void addModule(std::unique_ptr<Module> M) override {
262  // If this module doesn't have a DataLayout attached then attach the
263  // default.
264  if (M->getDataLayout().isDefault()) {
265  M->setDataLayout(getDataLayout());
266  } else {
267  assert(M->getDataLayout() == getDataLayout() && "DataLayout Mismatch");
268  }
269 
270  // Rename, bump linkage and record static constructors and destructors.
271  // We have to do this before we hand over ownership of the module to the
272  // JIT.
273  std::vector<std::string> CtorNames, DtorNames;
274  {
275  unsigned CtorId = 0, DtorId = 0;
276  for (auto Ctor : orc::getConstructors(*M)) {
277  std::string NewCtorName = ("$static_ctor." + Twine(CtorId++)).str();
278  Ctor.Func->setName(NewCtorName);
279  Ctor.Func->setLinkage(GlobalValue::ExternalLinkage);
280  Ctor.Func->setVisibility(GlobalValue::HiddenVisibility);
281  CtorNames.push_back(mangle(NewCtorName));
282  }
283  for (auto Dtor : orc::getDestructors(*M)) {
284  std::string NewDtorName = ("$static_dtor." + Twine(DtorId++)).str();
285  dbgs() << "Found dtor: " << NewDtorName << "\n";
286  Dtor.Func->setName(NewDtorName);
287  Dtor.Func->setLinkage(GlobalValue::ExternalLinkage);
288  Dtor.Func->setVisibility(GlobalValue::HiddenVisibility);
289  DtorNames.push_back(mangle(NewDtorName));
290  }
291  }
292 
293  auto K = ES.allocateVModule();
294 
295  UnexecutedConstructors[K] = std::move(CtorNames);
296  UnexecutedDestructors[K] = std::move(DtorNames);
297 
298  cantFail(LazyEmitLayer.addModule(K, std::move(M)));
299  }
300 
301  void addObjectFile(std::unique_ptr<object::ObjectFile> O) override {
302  cantFail(ObjectLayer.addObject(
303  ES.allocateVModule(), MemoryBuffer::getMemBufferCopy(O->getData())));
304  }
305 
307  std::unique_ptr<object::ObjectFile> Obj;
308  std::unique_ptr<MemoryBuffer> ObjBuffer;
309  std::tie(Obj, ObjBuffer) = O.takeBinary();
310  cantFail(ObjectLayer.addObject(ES.allocateVModule(), std::move(ObjBuffer)));
311  }
312 
314  Archives.push_back(std::move(A));
315  }
316 
317  bool removeModule(Module *M) override {
318  auto I = Modules.begin();
319  for (auto E = Modules.end(); I != E; ++I)
320  if (I->get() == M)
321  break;
322  if (I == Modules.end())
323  return false;
324  Modules.erase(I);
325  return true;
326  }
327 
329  return cantFail(findSymbol(Name).getAddress());
330  }
331 
333  return findMangledSymbol(mangle(Name));
334  }
335 
336  void finalizeObject() override {
337  // This is deprecated - Aim to remove in ExecutionEngine.
338  // REMOVE IF POSSIBLE - Doesn't make sense for New JIT.
339  }
340 
341  void mapSectionAddress(const void *LocalAddress,
342  uint64_t TargetAddress) override {
343  for (auto &P : UnfinalizedSections)
344  if (P.second.count(LocalAddress))
345  ObjectLayer.mapSectionAddress(P.first, LocalAddress, TargetAddress);
346  }
347 
348  uint64_t getGlobalValueAddress(const std::string &Name) override {
349  return getSymbolAddress(Name);
350  }
351 
352  uint64_t getFunctionAddress(const std::string &Name) override {
353  return getSymbolAddress(Name);
354  }
355 
356  void *getPointerToFunction(Function *F) override {
357  uint64_t FAddr = getSymbolAddress(F->getName());
358  return reinterpret_cast<void *>(static_cast<uintptr_t>(FAddr));
359  }
360 
362  bool AbortOnFailure = true) override {
363  uint64_t Addr = getSymbolAddress(Name);
364  if (!Addr && AbortOnFailure)
365  llvm_unreachable("Missing symbol!");
366  return reinterpret_cast<void *>(static_cast<uintptr_t>(Addr));
367  }
368 
370  ArrayRef<GenericValue> ArgValues) override;
371 
372  void setObjectCache(ObjectCache *NewCache) override {
373  CompileLayer.getCompiler().setObjectCache(NewCache);
374  }
375 
376  void setProcessAllSections(bool ProcessAllSections) override {
377  ObjectLayer.setProcessAllSections(ProcessAllSections);
378  }
379 
380  void runStaticConstructorsDestructors(bool isDtors) override;
381 
382 private:
383  JITSymbol findMangledSymbol(StringRef Name) {
384  if (auto Sym = LazyEmitLayer.findSymbol(Name, false))
385  return Sym;
386  if (auto Sym = ClientResolver->findSymbol(Name))
387  return Sym;
388  if (auto Sym = scanArchives(Name))
389  return Sym;
390 
391  return nullptr;
392  }
393 
394  JITSymbol scanArchives(StringRef Name) {
395  for (object::OwningBinary<object::Archive> &OB : Archives) {
396  object::Archive *A = OB.getBinary();
397  // Look for our symbols in each Archive
398  auto OptionalChildOrErr = A->findSym(Name);
399  if (!OptionalChildOrErr)
400  report_fatal_error(OptionalChildOrErr.takeError());
401  auto &OptionalChild = *OptionalChildOrErr;
402  if (OptionalChild) {
403  // FIXME: Support nested archives?
405  OptionalChild->getAsBinary();
406  if (!ChildBinOrErr) {
407  // TODO: Actually report errors helpfully.
408  consumeError(ChildBinOrErr.takeError());
409  continue;
410  }
411  std::unique_ptr<object::Binary> &ChildBin = ChildBinOrErr.get();
412  if (ChildBin->isObject()) {
413  cantFail(ObjectLayer.addObject(
414  ES.allocateVModule(),
415  MemoryBuffer::getMemBufferCopy(ChildBin->getData())));
416  if (auto Sym = ObjectLayer.findSymbol(Name, true))
417  return Sym;
418  }
419  }
420  }
421  return nullptr;
422  }
423 
424  class NotifyObjectLoadedT {
425  public:
426  using LoadedObjInfoListT =
427  std::vector<std::unique_ptr<RuntimeDyld::LoadedObjectInfo>>;
428 
429  NotifyObjectLoadedT(OrcMCJITReplacement &M) : M(M) {}
430 
431  void operator()(VModuleKey K, const object::ObjectFile &Obj,
432  const RuntimeDyld::LoadedObjectInfo &Info) const {
433  M.UnfinalizedSections[K] = std::move(M.SectionsAllocatedSinceLastLoad);
434  M.SectionsAllocatedSinceLastLoad = SectionAddrSet();
435  M.MemMgr->notifyObjectLoaded(&M, Obj);
436  }
437  private:
439  };
440 
441  class NotifyFinalizedT {
442  public:
443  NotifyFinalizedT(OrcMCJITReplacement &M) : M(M) {}
444 
445  void operator()(VModuleKey K, const object::ObjectFile &Obj,
446  const RuntimeDyld::LoadedObjectInfo &Info) {
447  M.UnfinalizedSections.erase(K);
448  }
449 
450  private:
452  };
453 
454  std::string mangle(StringRef Name) {
455  std::string MangledName;
456  {
457  raw_string_ostream MangledNameStream(MangledName);
458  Mang.getNameWithPrefix(MangledNameStream, Name, getDataLayout());
459  }
460  return MangledName;
461  }
462 
466 
467  ExecutionSession ES;
468 
469  std::unique_ptr<TargetMachine> TM;
470  std::shared_ptr<MCJITReplacementMemMgr> MemMgr;
471  std::shared_ptr<LinkingORCResolver> Resolver;
472  std::shared_ptr<LegacyJITSymbolResolver> ClientResolver;
473  Mangler Mang;
474 
475  // IMPORTANT: ShouldDelete *must* come before LocalModules: The shared_ptr
476  // delete blocks in LocalModules refer to the ShouldDelete map, so
477  // LocalModules needs to be destructed before ShouldDelete.
478  std::map<Module*, bool> ShouldDelete;
479 
480  NotifyObjectLoadedT NotifyObjectLoaded;
481  NotifyFinalizedT NotifyFinalized;
482 
484  CompileLayerT CompileLayer;
485  LazyEmitLayerT LazyEmitLayer;
486 
487  std::map<VModuleKey, std::vector<std::string>> UnexecutedConstructors;
488  std::map<VModuleKey, std::vector<std::string>> UnexecutedDestructors;
489 
490  // We need to store ObjLayerT::ObjSetHandles for each of the object sets
491  // that have been emitted but not yet finalized so that we can forward the
492  // mapSectionAddress calls appropriately.
493  using SectionAddrSet = std::set<const void *>;
494  SectionAddrSet SectionsAllocatedSinceLastLoad;
495  std::map<VModuleKey, SectionAddrSet> UnfinalizedSections;
496 
497  std::vector<object::OwningBinary<object::Archive>> Archives;
498 };
499 
500 } // end namespace orc
501 
502 } // end namespace llvm
503 
504 #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:696
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:186
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:978
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:545
uint64_t VModuleKey
VModuleKey provides a unique identifier (allocated and managed by ExecutionSessions) for a module add...
Definition: Core.h:40
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:57
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:42
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:1774
void setObjectCache(ObjectCache *NewCache) override
Sets the pre-compiled object cache.
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:970
void failQuery(AsynchronousSymbolQuery &Q, Error Err)
Cause the given query to fail with the given Error.
Definition: Core.cpp:128
#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)
Expected< SymbolMap > lookup(const VSOList &VSOs, SymbolNameSet Names)
Look up the given names in the given VSOs.
Definition: Core.cpp:1326
uint64_t getSymbolAddress(StringRef Name)
reference get()
Returns a reference to the stored T value.
Definition: Error.h:525
An ExecutionSession represents a running JIT program.
Definition: Core.h:703
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:133
SymbolResolver is a composable interface for looking up symbol flags and addresses using the Asynchro...
Definition: Core.h:481
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:477
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
Interface for Layers that accept object files.
Definition: Layer.h:86
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:44
void mapSectionAddress(const void *LocalAddress, uint64_t TargetAddress) override
mapSectionAddress - map a section to its target address space value.