LLVM  8.0.1
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 getResponsibilitySet(const SymbolNameSet &Symbols) override {
148  SymbolNameSet Result;
149 
150  for (auto &S : Symbols) {
151  if (auto Sym = M.findMangledSymbol(*S)) {
152  if (!Sym.getFlags().isStrong())
153  Result.insert(S);
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  if (!Sym2.getFlags().isStrong())
160  Result.insert(S);
161  } else if (auto Err = Sym2.takeError()) {
162  M.reportError(std::move(Err));
163  return SymbolNameSet();
164  } else
165  Result.insert(S);
166  }
167  }
168 
169  return Result;
170  }
171 
172  SymbolNameSet lookup(std::shared_ptr<AsynchronousSymbolQuery> Query,
173  SymbolNameSet Symbols) override {
174  SymbolNameSet UnresolvedSymbols;
175  bool NewSymbolsResolved = false;
176 
177  for (auto &S : Symbols) {
178  if (auto Sym = M.findMangledSymbol(*S)) {
179  if (auto Addr = Sym.getAddress()) {
180  Query->resolve(S, JITEvaluatedSymbol(*Addr, Sym.getFlags()));
181  Query->notifySymbolReady();
182  NewSymbolsResolved = true;
183  } else {
184  M.ES.legacyFailQuery(*Query, Addr.takeError());
185  return SymbolNameSet();
186  }
187  } else if (auto Err = Sym.takeError()) {
188  M.ES.legacyFailQuery(*Query, std::move(Err));
189  return SymbolNameSet();
190  } else {
191  if (auto Sym2 = M.ClientResolver->findSymbol(*S)) {
192  if (auto Addr = Sym2.getAddress()) {
193  Query->resolve(S, JITEvaluatedSymbol(*Addr, Sym2.getFlags()));
194  Query->notifySymbolReady();
195  NewSymbolsResolved = true;
196  } else {
197  M.ES.legacyFailQuery(*Query, Addr.takeError());
198  return SymbolNameSet();
199  }
200  } else if (auto Err = Sym2.takeError()) {
201  M.ES.legacyFailQuery(*Query, std::move(Err));
202  return SymbolNameSet();
203  } else
204  UnresolvedSymbols.insert(S);
205  }
206  }
207 
208  if (NewSymbolsResolved && Query->isFullyResolved())
209  Query->handleFullyResolved();
210 
211  if (NewSymbolsResolved && Query->isFullyReady())
212  Query->handleFullyReady();
213 
214  return UnresolvedSymbols;
215  }
216 
217  private:
219  };
220 
221 private:
222  static ExecutionEngine *
223  createOrcMCJITReplacement(std::string *ErrorMsg,
224  std::shared_ptr<MCJITMemoryManager> MemMgr,
225  std::shared_ptr<LegacyJITSymbolResolver> Resolver,
226  std::unique_ptr<TargetMachine> TM) {
227  return new OrcMCJITReplacement(std::move(MemMgr), std::move(Resolver),
228  std::move(TM));
229  }
230 
231  void reportError(Error Err) {
232  logAllUnhandledErrors(std::move(Err), errs(), "MCJIT error: ");
233  }
234 
235 public:
236  OrcMCJITReplacement(std::shared_ptr<MCJITMemoryManager> MemMgr,
237  std::shared_ptr<LegacyJITSymbolResolver> ClientResolver,
238  std::unique_ptr<TargetMachine> TM)
239  : ExecutionEngine(TM->createDataLayout()),
240  TM(std::move(TM)),
241  MemMgr(
242  std::make_shared<MCJITReplacementMemMgr>(*this, std::move(MemMgr))),
243  Resolver(std::make_shared<LinkingORCResolver>(*this)),
244  ClientResolver(std::move(ClientResolver)), NotifyObjectLoaded(*this),
245  NotifyFinalized(*this),
246  ObjectLayer(
247  ES,
248  [this](VModuleKey K) {
249  return ObjectLayerT::Resources{this->MemMgr, this->Resolver};
250  },
251  NotifyObjectLoaded, NotifyFinalized),
252  CompileLayer(ObjectLayer, SimpleCompiler(*this->TM),
253  [this](VModuleKey K, std::unique_ptr<Module> M) {
254  Modules.push_back(std::move(M));
255  }),
256  LazyEmitLayer(CompileLayer) {}
257 
258  static void Register() {
259  OrcMCJITReplacementCtor = createOrcMCJITReplacement;
260  }
261 
262  void addModule(std::unique_ptr<Module> M) override {
263  // If this module doesn't have a DataLayout attached then attach the
264  // default.
265  if (M->getDataLayout().isDefault()) {
266  M->setDataLayout(getDataLayout());
267  } else {
268  assert(M->getDataLayout() == getDataLayout() && "DataLayout Mismatch");
269  }
270 
271  // Rename, bump linkage and record static constructors and destructors.
272  // We have to do this before we hand over ownership of the module to the
273  // JIT.
274  std::vector<std::string> CtorNames, DtorNames;
275  {
276  unsigned CtorId = 0, DtorId = 0;
277  for (auto Ctor : orc::getConstructors(*M)) {
278  std::string NewCtorName = ("__ORCstatic_ctor." + Twine(CtorId++)).str();
279  Ctor.Func->setName(NewCtorName);
280  Ctor.Func->setLinkage(GlobalValue::ExternalLinkage);
281  Ctor.Func->setVisibility(GlobalValue::HiddenVisibility);
282  CtorNames.push_back(mangle(NewCtorName));
283  }
284  for (auto Dtor : orc::getDestructors(*M)) {
285  std::string NewDtorName = ("__ORCstatic_dtor." + Twine(DtorId++)).str();
286  dbgs() << "Found dtor: " << NewDtorName << "\n";
287  Dtor.Func->setName(NewDtorName);
288  Dtor.Func->setLinkage(GlobalValue::ExternalLinkage);
289  Dtor.Func->setVisibility(GlobalValue::HiddenVisibility);
290  DtorNames.push_back(mangle(NewDtorName));
291  }
292  }
293 
294  auto K = ES.allocateVModule();
295 
296  UnexecutedConstructors[K] = std::move(CtorNames);
297  UnexecutedDestructors[K] = std::move(DtorNames);
298 
299  cantFail(LazyEmitLayer.addModule(K, std::move(M)));
300  }
301 
302  void addObjectFile(std::unique_ptr<object::ObjectFile> O) override {
303  cantFail(ObjectLayer.addObject(
304  ES.allocateVModule(), MemoryBuffer::getMemBufferCopy(O->getData())));
305  }
306 
308  std::unique_ptr<object::ObjectFile> Obj;
309  std::unique_ptr<MemoryBuffer> ObjBuffer;
310  std::tie(Obj, ObjBuffer) = O.takeBinary();
311  cantFail(ObjectLayer.addObject(ES.allocateVModule(), std::move(ObjBuffer)));
312  }
313 
315  Archives.push_back(std::move(A));
316  }
317 
318  bool removeModule(Module *M) override {
319  auto I = Modules.begin();
320  for (auto E = Modules.end(); I != E; ++I)
321  if (I->get() == M)
322  break;
323  if (I == Modules.end())
324  return false;
325  Modules.erase(I);
326  return true;
327  }
328 
330  return cantFail(findSymbol(Name).getAddress());
331  }
332 
334  return findMangledSymbol(mangle(Name));
335  }
336 
337  void finalizeObject() override {
338  // This is deprecated - Aim to remove in ExecutionEngine.
339  // REMOVE IF POSSIBLE - Doesn't make sense for New JIT.
340  }
341 
342  void mapSectionAddress(const void *LocalAddress,
343  uint64_t TargetAddress) override {
344  for (auto &P : UnfinalizedSections)
345  if (P.second.count(LocalAddress))
346  ObjectLayer.mapSectionAddress(P.first, LocalAddress, TargetAddress);
347  }
348 
349  uint64_t getGlobalValueAddress(const std::string &Name) override {
350  return getSymbolAddress(Name);
351  }
352 
353  uint64_t getFunctionAddress(const std::string &Name) override {
354  return getSymbolAddress(Name);
355  }
356 
357  void *getPointerToFunction(Function *F) override {
358  uint64_t FAddr = getSymbolAddress(F->getName());
359  return reinterpret_cast<void *>(static_cast<uintptr_t>(FAddr));
360  }
361 
363  bool AbortOnFailure = true) override {
364  uint64_t Addr = getSymbolAddress(Name);
365  if (!Addr && AbortOnFailure)
366  llvm_unreachable("Missing symbol!");
367  return reinterpret_cast<void *>(static_cast<uintptr_t>(Addr));
368  }
369 
371  ArrayRef<GenericValue> ArgValues) override;
372 
373  void setObjectCache(ObjectCache *NewCache) override {
374  CompileLayer.getCompiler().setObjectCache(NewCache);
375  }
376 
377  void setProcessAllSections(bool ProcessAllSections) override {
378  ObjectLayer.setProcessAllSections(ProcessAllSections);
379  }
380 
381  void runStaticConstructorsDestructors(bool isDtors) override;
382 
383 private:
384  JITSymbol findMangledSymbol(StringRef Name) {
385  if (auto Sym = LazyEmitLayer.findSymbol(Name, false))
386  return Sym;
387  if (auto Sym = ClientResolver->findSymbol(Name))
388  return Sym;
389  if (auto Sym = scanArchives(Name))
390  return Sym;
391 
392  return nullptr;
393  }
394 
395  JITSymbol scanArchives(StringRef Name) {
396  for (object::OwningBinary<object::Archive> &OB : Archives) {
397  object::Archive *A = OB.getBinary();
398  // Look for our symbols in each Archive
399  auto OptionalChildOrErr = A->findSym(Name);
400  if (!OptionalChildOrErr)
401  report_fatal_error(OptionalChildOrErr.takeError());
402  auto &OptionalChild = *OptionalChildOrErr;
403  if (OptionalChild) {
404  // FIXME: Support nested archives?
406  OptionalChild->getAsBinary();
407  if (!ChildBinOrErr) {
408  // TODO: Actually report errors helpfully.
409  consumeError(ChildBinOrErr.takeError());
410  continue;
411  }
412  std::unique_ptr<object::Binary> &ChildBin = ChildBinOrErr.get();
413  if (ChildBin->isObject()) {
414  cantFail(ObjectLayer.addObject(
415  ES.allocateVModule(),
416  MemoryBuffer::getMemBufferCopy(ChildBin->getData())));
417  if (auto Sym = ObjectLayer.findSymbol(Name, true))
418  return Sym;
419  }
420  }
421  }
422  return nullptr;
423  }
424 
425  class NotifyObjectLoadedT {
426  public:
427  using LoadedObjInfoListT =
428  std::vector<std::unique_ptr<RuntimeDyld::LoadedObjectInfo>>;
429 
430  NotifyObjectLoadedT(OrcMCJITReplacement &M) : M(M) {}
431 
432  void operator()(VModuleKey K, const object::ObjectFile &Obj,
433  const RuntimeDyld::LoadedObjectInfo &Info) const {
434  M.UnfinalizedSections[K] = std::move(M.SectionsAllocatedSinceLastLoad);
435  M.SectionsAllocatedSinceLastLoad = SectionAddrSet();
436  M.MemMgr->notifyObjectLoaded(&M, Obj);
437  }
438  private:
440  };
441 
442  class NotifyFinalizedT {
443  public:
444  NotifyFinalizedT(OrcMCJITReplacement &M) : M(M) {}
445 
446  void operator()(VModuleKey K, const object::ObjectFile &Obj,
448  M.UnfinalizedSections.erase(K);
449  }
450 
451  private:
453  };
454 
455  std::string mangle(StringRef Name) {
456  std::string MangledName;
457  {
458  raw_string_ostream MangledNameStream(MangledName);
459  Mang.getNameWithPrefix(MangledNameStream, Name, getDataLayout());
460  }
461  return MangledName;
462  }
463 
467 
468  ExecutionSession ES;
469 
470  std::unique_ptr<TargetMachine> TM;
471  std::shared_ptr<MCJITReplacementMemMgr> MemMgr;
472  std::shared_ptr<LinkingORCResolver> Resolver;
473  std::shared_ptr<LegacyJITSymbolResolver> ClientResolver;
474  Mangler Mang;
475 
476  // IMPORTANT: ShouldDelete *must* come before LocalModules: The shared_ptr
477  // delete blocks in LocalModules refer to the ShouldDelete map, so
478  // LocalModules needs to be destructed before ShouldDelete.
479  std::map<Module*, bool> ShouldDelete;
480 
481  NotifyObjectLoadedT NotifyObjectLoaded;
482  NotifyFinalizedT NotifyFinalized;
483 
485  CompileLayerT CompileLayer;
486  LazyEmitLayerT LazyEmitLayer;
487 
488  std::map<VModuleKey, std::vector<std::string>> UnexecutedConstructors;
489  std::map<VModuleKey, std::vector<std::string>> UnexecutedDestructors;
490 
491  // We need to store ObjLayerT::ObjSetHandles for each of the object sets
492  // that have been emitted but not yet finalized so that we can forward the
493  // mapSectionAddress calls appropriately.
494  using SectionAddrSet = std::set<const void *>;
495  SectionAddrSet SectionsAllocatedSinceLastLoad;
496  std::map<VModuleKey, SectionAddrSet> UnfinalizedSections;
497 
498  std::vector<object::OwningBinary<object::Archive>> Archives;
499 };
500 
501 } // end namespace orc
502 
503 } // end namespace llvm
504 
505 #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:704
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:238
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:140
This class represents lattice values for constants.
Definition: AllocatorList.h:24
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:65
void finalizeObject() override
finalizeObject - ensure the module is fully processed and is usable.
Expected< Optional< Child > > findSym(StringRef name) const
Definition: Archive.cpp:978
This class is the base class for all object file types.
Definition: ObjectFile.h:202
Externally visible function.
Definition: GlobalValue.h:49
F(f)
const DataLayout & getDataLayout() const
Error takeError()
Take ownership of the stored error.
Definition: Error.h:553
uint64_t VModuleKey
VModuleKey provides a unique identifier (allocated and managed by ExecutionSessions) for a module add...
Definition: Core.h:40
amdgpu Simplify well known AMD library false Value Value const Twine & Name
Definition: BitVector.h:938
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.
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
static const uint16_t * lookup(unsigned opcode, unsigned domain, ArrayRef< uint16_t[3]> Table)
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
void legacyFailQuery(AsynchronousSymbolQuery &Q, Error Err)
Definition: Core.cpp:1596
Analysis containing CSE Info
Definition: CSEInfo.cpp:21
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.
DenseSet< SymbolStringPtr > SymbolNameSet
A set of symbol names (represented by SymbolStringPtrs for.
Definition: Core.h:44
#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
std::pair< iterator, bool > insert(const ValueT &V)
Definition: DenseSet.h:188
void setObjectCache(ObjectCache *NewCache) override
Sets the pre-compiled object cache.
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:982
void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner={})
Log all errors (if any) in E to OS.
Definition: Error.cpp:62
#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:533
An ExecutionSession represents a running JIT program.
Definition: Core.h:697
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: Legacy.h:30
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:209
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:214
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...
uint32_t Size
Definition: Profile.cpp:47
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:483
void addArchive(object::OwningBinary< object::Archive > A) override
addArchive - Add an Archive to the execution engine.
Lightweight error class with error context and mandatory checking.
Definition: Error.h:158
Interface for Layers that accept object files.
Definition: Layer.h:114
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
void mapSectionAddress(const void *LocalAddress, uint64_t TargetAddress) override
mapSectionAddress - map a section to its target address space value.