LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MCJIT.cpp
Go to the documentation of this file.
1 //===-- MCJIT.cpp - MC-based Just-in-Time Compiler ------------------------===//
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 #include "MCJIT.h"
17 #include "llvm/PassManager.h"
19 #include "llvm/IR/DataLayout.h"
20 #include "llvm/IR/DerivedTypes.h"
21 #include "llvm/IR/Function.h"
22 #include "llvm/IR/Module.h"
23 #include "llvm/MC/MCAsmInfo.h"
28 
29 using namespace llvm;
30 
31 namespace {
32 
33 static struct RegisterJIT {
34  RegisterJIT() { MCJIT::Register(); }
35 } JITRegistrator;
36 
37 }
38 
39 extern "C" void LLVMLinkInMCJIT() {
40 }
41 
43  std::string *ErrorStr,
44  RTDyldMemoryManager *MemMgr,
45  bool GVsWithCode,
46  TargetMachine *TM) {
47  // Try to register the program as a source of symbols to resolve against.
48  //
49  // FIXME: Don't do this here.
51 
52  return new MCJIT(M, TM, MemMgr ? MemMgr : new SectionMemoryManager(),
53  GVsWithCode);
54 }
55 
56 MCJIT::MCJIT(Module *m, TargetMachine *tm, RTDyldMemoryManager *MM,
57  bool AllocateGVsWithCode)
58  : ExecutionEngine(m), TM(tm), Ctx(0), MemMgr(this, MM), Dyld(&MemMgr),
59  ObjCache(0) {
60 
61  OwnedModules.addModule(m);
63 }
64 
66  MutexGuard locked(lock);
67  // FIXME: We are managing our modules, so we do not want the base class
68  // ExecutionEngine to manage them as well. To avoid double destruction
69  // of the first (and only) module added in ExecutionEngine constructor
70  // we remove it from EE and will destruct it ourselves.
71  //
72  // It may make sense to move our module manager (based on SmallStPtr) back
73  // into EE if the JIT and Interpreter can live with it.
74  // If so, additional functions: addModule, removeModule, FindFunctionNamed,
75  // runStaticConstructorsDestructors could be moved back to EE as well.
76  //
77  Modules.clear();
78  Dyld.deregisterEHFrames();
79 
80  LoadedObjectMap::iterator it, end = LoadedObjects.end();
81  for (it = LoadedObjects.begin(); it != end; ++it) {
82  ObjectImage *Obj = it->second;
83  if (Obj) {
84  NotifyFreeingObject(*Obj);
85  delete Obj;
86  }
87  }
88  LoadedObjects.clear();
89  delete TM;
90 }
91 
93  MutexGuard locked(lock);
94  OwnedModules.addModule(M);
95 }
96 
98  MutexGuard locked(lock);
99  return OwnedModules.removeModule(M);
100 }
101 
102 
103 
105  MutexGuard locked(lock);
106  ObjCache = NewCache;
107 }
108 
110  MutexGuard locked(lock);
111 
112  // This must be a module which has already been added but not loaded to this
113  // MCJIT instance, since these conditions are tested by our caller,
114  // generateCodeForModule.
115 
116  PassManager PM;
117 
118  PM.add(new DataLayout(*TM->getDataLayout()));
119 
120  // The RuntimeDyld will take ownership of this shortly
122 
123  // Turn the machine code intermediate representation into bytes in memory
124  // that may be executed.
125  if (TM->addPassesToEmitMC(PM, Ctx, CompiledObject->getOStream(), false)) {
126  report_fatal_error("Target does not support MC emission!");
127  }
128 
129  // Initialize passes.
130  PM.run(*M);
131  // Flush the output buffer to get the generated code into memory
132  CompiledObject->flush();
133 
134  // If we have an object cache, tell it about the new object.
135  // Note that we're using the compiled image, not the loaded image (as below).
136  if (ObjCache) {
137  // MemoryBuffer is a thin wrapper around the actual memory, so it's OK
138  // to create a temporary object here and delete it after the call.
139  OwningPtr<MemoryBuffer> MB(CompiledObject->getMemBuffer());
140  ObjCache->notifyObjectCompiled(M, MB.get());
141  }
142 
143  return CompiledObject.take();
144 }
145 
147  // Get a thread lock to make sure we aren't trying to load multiple times
148  MutexGuard locked(lock);
149 
150  // This must be a module which has already been added to this MCJIT instance.
151  assert(OwnedModules.ownsModule(M) &&
152  "MCJIT::generateCodeForModule: Unknown module.");
153 
154  // Re-compilation is not supported
155  if (OwnedModules.hasModuleBeenLoaded(M))
156  return;
157 
158  OwningPtr<ObjectBuffer> ObjectToLoad;
159  // Try to load the pre-compiled object from cache if possible
160  if (0 != ObjCache) {
161  OwningPtr<MemoryBuffer> PreCompiledObject(ObjCache->getObject(M));
162  if (0 != PreCompiledObject.get())
163  ObjectToLoad.reset(new ObjectBuffer(PreCompiledObject.take()));
164  }
165 
166  // If the cache did not contain a suitable object, compile the object
167  if (!ObjectToLoad) {
168  ObjectToLoad.reset(emitObject(M));
169  assert(ObjectToLoad.get() && "Compilation did not produce an object.");
170  }
171 
172  // Load the object into the dynamic linker.
173  // MCJIT now owns the ObjectImage pointer (via its LoadedObjects map).
174  ObjectImage *LoadedObject = Dyld.loadObject(ObjectToLoad.take());
175  LoadedObjects[M] = LoadedObject;
176  if (!LoadedObject)
178 
179  // FIXME: Make this optional, maybe even move it to a JIT event listener
180  LoadedObject->registerWithDebugger();
181 
182  NotifyObjectEmitted(*LoadedObject);
183 
184  OwnedModules.markModuleAsLoaded(M);
185 }
186 
188  MutexGuard locked(lock);
189 
190  // Resolve any outstanding relocations.
191  Dyld.resolveRelocations();
192 
193  OwnedModules.markAllLoadedModulesAsFinalized();
194 
195  // Register EH frame data for any module we own which has been loaded
196  Dyld.registerEHFrames();
197 
198  // Set page permissions.
199  MemMgr.finalizeMemory();
200 }
201 
202 // FIXME: Rename this.
204  MutexGuard locked(lock);
205 
206  for (ModulePtrSet::iterator I = OwnedModules.begin_added(),
207  E = OwnedModules.end_added();
208  I != E; ++I) {
209  Module *M = *I;
211  }
212 
214 }
215 
217  MutexGuard locked(lock);
218 
219  // This must be a module which has already been added to this MCJIT instance.
220  assert(OwnedModules.ownsModule(M) && "MCJIT::finalizeModule: Unknown module.");
221 
222  // If the module hasn't been compiled, just do that.
223  if (!OwnedModules.hasModuleBeenLoaded(M))
225 
227 }
228 
230  report_fatal_error("not yet implemented");
231 }
232 
233 uint64_t MCJIT::getExistingSymbolAddress(const std::string &Name) {
234  // Check with the RuntimeDyld to see if we already have this symbol.
235  if (Name[0] == '\1')
236  return Dyld.getSymbolLoadAddress(Name.substr(1));
238  + Name));
239 }
240 
242  bool CheckFunctionsOnly) {
243  MutexGuard locked(lock);
244 
245  // If it hasn't already been generated, see if it's in one of our modules.
246  for (ModulePtrSet::iterator I = OwnedModules.begin_added(),
247  E = OwnedModules.end_added();
248  I != E; ++I) {
249  Module *M = *I;
250  Function *F = M->getFunction(Name);
251  if (F && !F->isDeclaration())
252  return M;
253  if (!CheckFunctionsOnly) {
254  GlobalVariable *G = M->getGlobalVariable(Name);
255  if (G && !G->isDeclaration())
256  return M;
257  // FIXME: Do we need to worry about global aliases?
258  }
259  }
260  // We didn't find the symbol in any of our modules.
261  return NULL;
262 }
263 
264 uint64_t MCJIT::getSymbolAddress(const std::string &Name,
265  bool CheckFunctionsOnly)
266 {
267  MutexGuard locked(lock);
268 
269  // First, check to see if we already have this symbol.
270  uint64_t Addr = getExistingSymbolAddress(Name);
271  if (Addr)
272  return Addr;
273 
274  // If it hasn't already been generated, see if it's in one of our modules.
275  Module *M = findModuleForSymbol(Name, CheckFunctionsOnly);
276  if (!M)
277  return 0;
278 
280 
281  // Check the RuntimeDyld table again, it should be there now.
282  return getExistingSymbolAddress(Name);
283 }
284 
285 uint64_t MCJIT::getGlobalValueAddress(const std::string &Name) {
286  MutexGuard locked(lock);
287  uint64_t Result = getSymbolAddress(Name, false);
288  if (Result != 0)
290  return Result;
291 }
292 
293 uint64_t MCJIT::getFunctionAddress(const std::string &Name) {
294  MutexGuard locked(lock);
295  uint64_t Result = getSymbolAddress(Name, true);
296  if (Result != 0)
298  return Result;
299 }
300 
301 // Deprecated. Use getFunctionAddress instead.
303  MutexGuard locked(lock);
304 
305  if (F->isDeclaration() || F->hasAvailableExternallyLinkage()) {
306  bool AbortOnFailure = !F->hasExternalWeakLinkage();
307  void *Addr = getPointerToNamedFunction(F->getName(), AbortOnFailure);
308  addGlobalMapping(F, Addr);
309  return Addr;
310  }
311 
312  Module *M = F->getParent();
313  bool HasBeenAddedButNotLoaded = OwnedModules.hasModuleBeenAddedButNotLoaded(M);
314 
315  // Make sure the relevant module has been compiled and loaded.
316  if (HasBeenAddedButNotLoaded)
318  else if (!OwnedModules.hasModuleBeenLoaded(M))
319  // If this function doesn't belong to one of our modules, we're done.
320  return NULL;
321 
322  // FIXME: Should the Dyld be retaining module information? Probably not.
323  // FIXME: Should we be using the mangler for this? Probably.
324  //
325  // This is the accessor for the target address, so make sure to check the
326  // load address of the symbol, not the local address.
327  StringRef BaseName = F->getName();
328  if (BaseName[0] == '\1')
329  return (void*)Dyld.getSymbolLoadAddress(BaseName.substr(1));
330  return (void*)Dyld.getSymbolLoadAddress((TM->getMCAsmInfo()->getGlobalPrefix()
331  + BaseName).str());
332 }
333 
335  report_fatal_error("not yet implemented");
336 }
337 
339  report_fatal_error("not yet implemented");
340 }
341 
342 void MCJIT::runStaticConstructorsDestructorsInModulePtrSet(
343  bool isDtors, ModulePtrSet::iterator I, ModulePtrSet::iterator E) {
344  for (; I != E; ++I) {
346  }
347 }
348 
350  // Execute global ctors/dtors for each module in the program.
351  runStaticConstructorsDestructorsInModulePtrSet(
352  isDtors, OwnedModules.begin_added(), OwnedModules.end_added());
353  runStaticConstructorsDestructorsInModulePtrSet(
354  isDtors, OwnedModules.begin_loaded(), OwnedModules.end_loaded());
355  runStaticConstructorsDestructorsInModulePtrSet(
356  isDtors, OwnedModules.begin_finalized(), OwnedModules.end_finalized());
357 }
358 
359 Function *MCJIT::FindFunctionNamedInModulePtrSet(const char *FnName,
360  ModulePtrSet::iterator I,
361  ModulePtrSet::iterator E) {
362  for (; I != E; ++I) {
363  if (Function *F = (*I)->getFunction(FnName))
364  return F;
365  }
366  return 0;
367 }
368 
369 Function *MCJIT::FindFunctionNamed(const char *FnName) {
370  Function *F = FindFunctionNamedInModulePtrSet(
371  FnName, OwnedModules.begin_added(), OwnedModules.end_added());
372  if (!F)
373  F = FindFunctionNamedInModulePtrSet(FnName, OwnedModules.begin_loaded(),
374  OwnedModules.end_loaded());
375  if (!F)
376  F = FindFunctionNamedInModulePtrSet(FnName, OwnedModules.begin_finalized(),
377  OwnedModules.end_finalized());
378  return F;
379 }
380 
382  const std::vector<GenericValue> &ArgValues) {
383  assert(F && "Function *F was null at entry to run()");
384 
385  void *FPtr = getPointerToFunction(F);
386  assert(FPtr && "Pointer to fn's code was null after getPointerToFunction");
387  FunctionType *FTy = F->getFunctionType();
388  Type *RetTy = FTy->getReturnType();
389 
390  assert((FTy->getNumParams() == ArgValues.size() ||
391  (FTy->isVarArg() && FTy->getNumParams() <= ArgValues.size())) &&
392  "Wrong number of arguments passed into function!");
393  assert(FTy->getNumParams() == ArgValues.size() &&
394  "This doesn't support passing arguments through varargs (yet)!");
395 
396  // Handle some common cases first. These cases correspond to common `main'
397  // prototypes.
398  if (RetTy->isIntegerTy(32) || RetTy->isVoidTy()) {
399  switch (ArgValues.size()) {
400  case 3:
401  if (FTy->getParamType(0)->isIntegerTy(32) &&
402  FTy->getParamType(1)->isPointerTy() &&
403  FTy->getParamType(2)->isPointerTy()) {
404  int (*PF)(int, char **, const char **) =
405  (int(*)(int, char **, const char **))(intptr_t)FPtr;
406 
407  // Call the function.
408  GenericValue rv;
409  rv.IntVal = APInt(32, PF(ArgValues[0].IntVal.getZExtValue(),
410  (char **)GVTOP(ArgValues[1]),
411  (const char **)GVTOP(ArgValues[2])));
412  return rv;
413  }
414  break;
415  case 2:
416  if (FTy->getParamType(0)->isIntegerTy(32) &&
417  FTy->getParamType(1)->isPointerTy()) {
418  int (*PF)(int, char **) = (int(*)(int, char **))(intptr_t)FPtr;
419 
420  // Call the function.
421  GenericValue rv;
422  rv.IntVal = APInt(32, PF(ArgValues[0].IntVal.getZExtValue(),
423  (char **)GVTOP(ArgValues[1])));
424  return rv;
425  }
426  break;
427  case 1:
428  if (FTy->getNumParams() == 1 &&
429  FTy->getParamType(0)->isIntegerTy(32)) {
430  GenericValue rv;
431  int (*PF)(int) = (int(*)(int))(intptr_t)FPtr;
432  rv.IntVal = APInt(32, PF(ArgValues[0].IntVal.getZExtValue()));
433  return rv;
434  }
435  break;
436  }
437  }
438 
439  // Handle cases where no arguments are passed first.
440  if (ArgValues.empty()) {
441  GenericValue rv;
442  switch (RetTy->getTypeID()) {
443  default: llvm_unreachable("Unknown return type for function call!");
444  case Type::IntegerTyID: {
445  unsigned BitWidth = cast<IntegerType>(RetTy)->getBitWidth();
446  if (BitWidth == 1)
447  rv.IntVal = APInt(BitWidth, ((bool(*)())(intptr_t)FPtr)());
448  else if (BitWidth <= 8)
449  rv.IntVal = APInt(BitWidth, ((char(*)())(intptr_t)FPtr)());
450  else if (BitWidth <= 16)
451  rv.IntVal = APInt(BitWidth, ((short(*)())(intptr_t)FPtr)());
452  else if (BitWidth <= 32)
453  rv.IntVal = APInt(BitWidth, ((int(*)())(intptr_t)FPtr)());
454  else if (BitWidth <= 64)
455  rv.IntVal = APInt(BitWidth, ((int64_t(*)())(intptr_t)FPtr)());
456  else
457  llvm_unreachable("Integer types > 64 bits not supported");
458  return rv;
459  }
460  case Type::VoidTyID:
461  rv.IntVal = APInt(32, ((int(*)())(intptr_t)FPtr)());
462  return rv;
463  case Type::FloatTyID:
464  rv.FloatVal = ((float(*)())(intptr_t)FPtr)();
465  return rv;
466  case Type::DoubleTyID:
467  rv.DoubleVal = ((double(*)())(intptr_t)FPtr)();
468  return rv;
469  case Type::X86_FP80TyID:
470  case Type::FP128TyID:
471  case Type::PPC_FP128TyID:
472  llvm_unreachable("long double not supported yet");
473  case Type::PointerTyID:
474  return PTOGV(((void*(*)())(intptr_t)FPtr)());
475  }
476  }
477 
478  llvm_unreachable("Full-featured argument passing not supported yet!");
479 }
480 
481 void *MCJIT::getPointerToNamedFunction(const std::string &Name,
482  bool AbortOnFailure) {
483  if (!isSymbolSearchingDisabled()) {
484  void *ptr = MemMgr.getPointerToNamedFunction(Name, false);
485  if (ptr)
486  return ptr;
487  }
488 
489  /// If a LazyFunctionCreator is installed, use it to get/create the function.
491  if (void *RP = LazyFunctionCreator(Name))
492  return RP;
493 
494  if (AbortOnFailure) {
495  report_fatal_error("Program used external function '"+Name+
496  "' which could not be resolved!");
497  }
498  return 0;
499 }
500 
502  if (L == NULL)
503  return;
504  MutexGuard locked(lock);
505  EventListeners.push_back(L);
506 }
508  if (L == NULL)
509  return;
510  MutexGuard locked(lock);
512  std::find(EventListeners.rbegin(), EventListeners.rend(), L);
513  if (I != EventListeners.rend()) {
514  std::swap(*I, EventListeners.back());
515  EventListeners.pop_back();
516  }
517 }
519  MutexGuard locked(lock);
520  MemMgr.notifyObjectLoaded(this, &Obj);
521  for (unsigned I = 0, S = EventListeners.size(); I < S; ++I) {
522  EventListeners[I]->NotifyObjectEmitted(Obj);
523  }
524 }
526  MutexGuard locked(lock);
527  for (unsigned I = 0, S = EventListeners.size(); I < S; ++I) {
528  EventListeners[I]->NotifyFreeingObject(Obj);
529  }
530 }
531 
532 uint64_t LinkingMemoryManager::getSymbolAddress(const std::string &Name) {
533  uint64_t Result = ParentEngine->getSymbolAddress(Name, false);
534  // If the symbols wasn't found and it begins with an underscore, try again
535  // without the underscore.
536  if (!Result && Name[0] == '_')
537  Result = ParentEngine->getSymbolAddress(Name.substr(1), false);
538  if (Result)
539  return Result;
540  return ClientMM->getSymbolAddress(Name);
541 }
std::reverse_iterator< iterator > reverse_iterator
Definition: SmallVector.h:104
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:181
virtual bool finalizeMemory(std::string *ErrMsg=0)
virtual void * getPointerToBasicBlock(BasicBlock *BB)
Definition: MCJIT.cpp:229
The main container class for the LLVM Intermediate Representation.
Definition: Module.h:112
unsigned getNumParams() const
Definition: DerivedTypes.h:133
2: 32-bit floating point type
Definition: Type.h:57
virtual Function * FindFunctionNamed(const char *FnName)
Definition: MCJIT.cpp:369
StringRef getErrorString()
StringRef substr(size_t Start, size_t N=npos) const
Definition: StringRef.h:392
bool hasAvailableExternallyLinkage() const
Definition: GlobalValue.h:195
virtual void notifyObjectLoaded(ExecutionEngine *EE, const ObjectImage *Obj)
ObjectImage * loadObject(ObjectBuffer *InputBuffer)
F(f)
4: 80-bit floating point type (X87)
Definition: Type.h:59
virtual void setObjectCache(ObjectCache *manager)
Sets the object manager that MCJIT should use to avoid compilation.
Definition: MCJIT.cpp:104
virtual void * recompileAndRelinkFunction(Function *F)
Definition: MCJIT.cpp:334
14: Pointers
Definition: Type.h:72
const GlobalVariable * getGlobalVariable(StringRef Name, bool AllowInternal=false) const
Definition: Module.h:355
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
StringRef getName() const
Definition: Value.cpp:167
void runStaticConstructorsDestructors(bool isDtors)
Definition: MCJIT.cpp:349
static unsigned getBitWidth(Type *Ty, const DataLayout *TD)
static ExecutionEngine * createJIT(Module *M, std::string *ErrorStr, RTDyldMemoryManager *MemMgr, bool GVsWithCode, TargetMachine *TM)
Definition: MCJIT.cpp:42
virtual void runStaticConstructorsDestructors(bool isDtors)
void setDataLayout(const DataLayout *td)
const MCAsmInfo * getMCAsmInfo() const
#define llvm_unreachable(msg)
void *(* LazyFunctionCreator)(const std::string &)
virtual bool removeModule(Module *M)
Definition: MCJIT.cpp:97
#define G(x, y, z)
Definition: MD5.cpp:52
virtual void finalizeModule(Module *)
Definition: MCJIT.cpp:216
virtual uint64_t getGlobalValueAddress(const std::string &Name)
Definition: MCJIT.cpp:285
TypeID getTypeID() const
Definition: Type.h:137
MemoryBuffer * getMemBuffer() const
Definition: ObjectBuffer.h:42
uint64_t getExistingSymbolAddress(const std::string &Name)
Definition: MCJIT.cpp:233
virtual void UnregisterJITEventListener(JITEventListener *L)
Definition: MCJIT.cpp:507
Function * getFunction(StringRef Name) const
Definition: Module.cpp:221
10: Arbitrary bit width integers
Definition: Type.h:68
virtual void * getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure=true)
Definition: MCJIT.cpp:481
Guard a section of code with a Mutex.
Definition: MutexGuard.h:27
0: type with no size
Definition: Type.h:55
ObjectBufferStream * emitObject(Module *M)
Definition: MCJIT.cpp:109
Type * getParamType(unsigned i) const
Parameter type accessors.
Definition: DerivedTypes.h:128
LLVM Basic Block Representation.
Definition: BasicBlock.h:72
void reset(T *P=0)
Definition: OwningPtr.h:51
virtual MemoryBuffer * getObject(const Module *M)=0
void LLVMLinkInMCJIT()
Definition: MCJIT.cpp:39
static bool LoadLibraryPermanently(const char *Filename, std::string *ErrMsg=0)
raw_ostream & getOStream()
Definition: ObjectBuffer.h:65
6: 128-bit floating point type (two 64-bits, PowerPC)
Definition: Type.h:61
iterator end()
Definition: DenseMap.h:57
void NotifyObjectEmitted(const ObjectImage &Obj)
Definition: MCJIT.cpp:518
bool isPointerTy() const
Definition: Type.h:220
T * get() const
Definition: OwningPtr.h:72
Abstract interface for implementation execution of LLVM modules, designed to support both interpreter...
void * GVTOP(const GenericValue &GV)
Definition: GenericValue.h:50
SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet.
Definition: SmallPtrSet.h:174
bool hasExternalWeakLinkage() const
Definition: GlobalValue.h:214
uint64_t getSymbolLoadAddress(StringRef Name)
const char * getGlobalPrefix() const
Definition: MCAsmInfo.h:431
uint64_t getSymbolAddress(const std::string &Name, bool CheckFunctionsOnly)
Definition: MCJIT.cpp:264
virtual bool addPassesToEmitMC(PassManagerBase &, MCContext *&, raw_ostream &, bool=true)
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition: BitVector.h:591
virtual void * getPointerToFunction(Function *F)
Definition: MCJIT.cpp:302
GenericValue PTOGV(void *P)
Definition: GenericValue.h:49
Class for arbitrary precision integers.
Definition: APInt.h:75
bool isIntegerTy() const
Definition: Type.h:196
Module * findModuleForSymbol(const std::string &Name, bool CheckFunctionsOnly)
Definition: MCJIT.cpp:241
iterator begin()
Definition: DenseMap.h:53
virtual uint64_t getSymbolAddress(const std::string &Name)
Definition: MCJIT.cpp:532
void addGlobalMapping(const GlobalValue *GV, void *Addr)
void NotifyFreeingObject(const ObjectImage &Obj)
Definition: MCJIT.cpp:525
bool isDeclaration() const
Definition: Globals.cpp:66
virtual void freeMachineCodeForFunction(Function *F)
Definition: MCJIT.cpp:338
virtual const DataLayout * getDataLayout() const
#define I(x, y, z)
Definition: MD5.cpp:54
FunctionType * getFunctionType() const
Definition: Function.cpp:171
SmallVector< Module *, 1 > Modules
virtual void registerWithDebugger()=0
void resolveRelocations()
Resolve the relocations for all symbols we currently know about.
bool isVarArg() const
Definition: DerivedTypes.h:120
3: 64-bit floating point type
Definition: Type.h:58
Type * getReturnType() const
Definition: DerivedTypes.h:121
Module * getParent()
Definition: GlobalValue.h:286
virtual void * getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure=true)
virtual void addModule(Module *M)
Definition: MCJIT.cpp:92
virtual void RegisterJITEventListener(JITEventListener *L)
Definition: MCJIT.cpp:501
virtual GenericValue runFunction(Function *F, const std::vector< GenericValue > &ArgValues)
Definition: MCJIT.cpp:381
void finalizeLoadedModules()
Definition: MCJIT.cpp:187
virtual void notifyObjectCompiled(const Module *M, const MemoryBuffer *Obj)=0
notifyObjectCompiled - Provides a pointer to compiled code for Module M.
virtual uint64_t getFunctionAddress(const std::string &Name)
Definition: MCJIT.cpp:293
virtual void generateCodeForModule(Module *M)
Definition: MCJIT.cpp:146
bool isVoidTy() const
isVoidTy - Return true if this is 'void'.
Definition: Type.h:140
5: 128-bit floating point type (112-bit mantissa)
Definition: Type.h:60
virtual void finalizeObject()
Definition: MCJIT.cpp:203