Silence -Wunused-variable in release builds.
[llvm/stm8.git] / lib / ExecutionEngine / MCJIT / MCJIT.h
blobb64c21a97360c39d97b4a54c6421b5d98301313a
1 //===-- MCJIT.h - Class definition for the MCJIT ----------------*- 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 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_LIB_EXECUTIONENGINE_MCJIT_H
11 #define LLVM_LIB_EXECUTIONENGINE_MCJIT_H
13 #include "llvm/PassManager.h"
14 #include "llvm/ExecutionEngine/ExecutionEngine.h"
15 #include "llvm/ExecutionEngine/RuntimeDyld.h"
16 #include "llvm/ADT/SmallVector.h"
17 #include "llvm/Support/raw_ostream.h"
19 namespace llvm {
21 // FIXME: This makes all kinds of horrible assumptions for the time being,
22 // like only having one module, not needing to worry about multi-threading,
23 // blah blah. Purely in get-it-up-and-limping mode for now.
25 class MCJIT : public ExecutionEngine {
26 MCJIT(Module *M, TargetMachine *tm, TargetJITInfo &tji,
27 RTDyldMemoryManager *MemMgr, CodeGenOpt::Level OptLevel,
28 bool AllocateGVsWithCode);
30 TargetMachine *TM;
31 MCContext *Ctx;
32 RTDyldMemoryManager *MemMgr;
34 // FIXME: These may need moved to a separate 'jitstate' member like the
35 // non-MC JIT does for multithreading and such. Just keep them here for now.
36 PassManager PM;
37 Module *M;
38 // FIXME: This really doesn't belong here.
39 SmallVector<char, 4096> Buffer; // Working buffer into which we JIT.
40 raw_svector_ostream OS;
42 RuntimeDyld Dyld;
44 public:
45 ~MCJIT();
47 /// @name ExecutionEngine interface implementation
48 /// @{
50 virtual void *getPointerToBasicBlock(BasicBlock *BB);
52 virtual void *getPointerToFunction(Function *F);
54 virtual void *recompileAndRelinkFunction(Function *F);
56 virtual void freeMachineCodeForFunction(Function *F);
58 virtual GenericValue runFunction(Function *F,
59 const std::vector<GenericValue> &ArgValues);
61 /// getPointerToNamedFunction - This method returns the address of the
62 /// specified function by using the dlsym function call. As such it is only
63 /// useful for resolving library symbols, not code generated symbols.
64 ///
65 /// If AbortOnFailure is false and no function with the given name is
66 /// found, this function silently returns a null pointer. Otherwise,
67 /// it prints a message to stderr and aborts.
68 ///
69 void *getPointerToNamedFunction(const std::string &Name,
70 bool AbortOnFailure = true);
71 /// @}
72 /// @name (Private) Registration Interfaces
73 /// @{
75 static void Register() {
76 MCJITCtor = createJIT;
79 static ExecutionEngine *createJIT(Module *M,
80 std::string *ErrorStr,
81 JITMemoryManager *JMM,
82 CodeGenOpt::Level OptLevel,
83 bool GVsWithCode,
84 TargetMachine *TM);
86 // @}
89 } // End llvm namespace
91 #endif