1894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===-- JIT.h - Class definition for the JIT --------------------*- C++ -*-===//
2894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
3894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//                     The LLVM Compiler Infrastructure
4894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
5894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// This file is distributed under the University of Illinois Open Source
6894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// License. See LICENSE.TXT for details.
7894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
8894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===----------------------------------------------------------------------===//
9894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
10894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// This file defines the top-level JIT data structure.
11894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
12894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===----------------------------------------------------------------------===//
13894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
14894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#ifndef JIT_H
15894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#define JIT_H
16894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
17894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "llvm/ExecutionEngine/ExecutionEngine.h"
18894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "llvm/PassManager.h"
19894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "llvm/Support/ValueHandle.h"
20894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
21894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumannamespace llvm {
22894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
23894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanclass Function;
24894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanstruct JITEvent_EmittedFunctionDetails;
25894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanclass MachineCodeEmitter;
26894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanclass MachineCodeInfo;
27894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanclass TargetJITInfo;
28894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanclass TargetMachine;
29894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
30894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanclass JITState {
31894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanprivate:
32894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  FunctionPassManager PM;  // Passes to compile a function
33894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  Module *M;               // Module used to create the PM
34894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
35894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// PendingFunctions - Functions which have not been code generated yet, but
36894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// were called from a function being code generated.
37894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  std::vector<AssertingVH<Function> > PendingFunctions;
38894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
39894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanpublic:
40894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  explicit JITState(Module *M) : PM(M), M(M) {}
41894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
42894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  FunctionPassManager &getPM(const MutexGuard &L) {
43894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    return PM;
44894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
4519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
46894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  Module *getModule() const { return M; }
47894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  std::vector<AssertingVH<Function> > &getPendingFunctions(const MutexGuard &L){
48894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    return PendingFunctions;
49894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
50894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman};
51894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
52894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
53894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanclass JIT : public ExecutionEngine {
54894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// types
55894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  typedef ValueMap<const BasicBlock *, void *>
56894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      BasicBlockAddressMapTy;
57894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// data
58894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  TargetMachine &TM;       // The current target we are compiling to
59894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  TargetJITInfo &TJI;      // The JITInfo for the target we are compiling to
60894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  JITCodeEmitter *JCE;     // JCE object
61894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  std::vector<JITEventListener*> EventListeners;
62894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
63894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// AllocateGVsWithCode - Some applications require that global variables and
64894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// code be allocated into the same region of memory, in which case this flag
65894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// should be set to true.  Doing so breaks freeMachineCodeForFunction.
66894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  bool AllocateGVsWithCode;
67894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
68894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// True while the JIT is generating code.  Used to assert against recursive
69894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// entry.
70894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  bool isAlreadyCodeGenerating;
71894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
72894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  JITState *jitstate;
73894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
74894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// BasicBlockAddressMap - A mapping between LLVM basic blocks and their
75894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// actualized version, only filled for basic blocks that have their address
76894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// taken.
77894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  BasicBlockAddressMapTy BasicBlockAddressMap;
78894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
79894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
80894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  JIT(Module *M, TargetMachine &tm, TargetJITInfo &tji,
81894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      JITMemoryManager *JMM, CodeGenOpt::Level OptLevel,
82894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      bool AllocateGVsWithCode);
83894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanpublic:
84894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  ~JIT();
85894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
86894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  static void Register() {
87894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    JITCtor = createJIT;
88894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
8919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
90894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// getJITInfo - Return the target JIT information structure.
91894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  ///
92894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  TargetJITInfo &getJITInfo() const { return TJI; }
93894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
94894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// create - Create an return a new JIT compiler if there is one available
95894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// for the current target.  Otherwise, return null.
96894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  ///
97894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  static ExecutionEngine *create(Module *M,
98894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                 std::string *Err,
99894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                 JITMemoryManager *JMM,
100894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                 CodeGenOpt::Level OptLevel =
101894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                   CodeGenOpt::Default,
102894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                 bool GVsWithCode = true,
10319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                 Reloc::Model RM = Reloc::Default,
10419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                 CodeModel::Model CMM = CodeModel::JITDefault) {
105894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    return ExecutionEngine::createJIT(M, Err, JMM, OptLevel, GVsWithCode,
10619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                      RM, CMM);
107894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
108894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
109894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  virtual void addModule(Module *M);
11019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
111894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// removeModule - Remove a Module from the list of modules.  Returns true if
112894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// M is found.
113894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  virtual bool removeModule(Module *M);
114894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
115894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// runFunction - Start execution with the specified function and arguments.
116894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  ///
117894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  virtual GenericValue runFunction(Function *F,
118894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                   const std::vector<GenericValue> &ArgValues);
119894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
120894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// getPointerToNamedFunction - This method returns the address of the
121894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// specified function by using the dlsym function call.  As such it is only
122894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// useful for resolving library symbols, not code generated symbols.
123894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  ///
124894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// If AbortOnFailure is false and no function with the given name is
125894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// found, this function silently returns a null pointer. Otherwise,
126894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// it prints a message to stderr and aborts.
127894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  ///
128894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  void *getPointerToNamedFunction(const std::string &Name,
129894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                  bool AbortOnFailure = true);
130894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
131894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  // CompilationCallback - Invoked the first time that a call site is found,
132894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  // which causes lazy compilation of the target function.
133894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  //
134894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  static void CompilationCallback();
135894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
136894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// getPointerToFunction - This returns the address of the specified function,
137894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// compiling it if necessary.
138894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  ///
139894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  void *getPointerToFunction(Function *F);
140894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
141894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// addPointerToBasicBlock - Adds address of the specific basic block.
142894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  void addPointerToBasicBlock(const BasicBlock *BB, void *Addr);
143894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
144894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// clearPointerToBasicBlock - Removes address of specific basic block.
145894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  void clearPointerToBasicBlock(const BasicBlock *BB);
146894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
147894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// getPointerToBasicBlock - This returns the address of the specified basic
148894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// block, assuming function is compiled.
149894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  void *getPointerToBasicBlock(BasicBlock *BB);
15019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
151894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// getOrEmitGlobalVariable - Return the address of the specified global
152894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// variable, possibly emitting it to memory if needed.  This is used by the
153894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// Emitter.
154894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  void *getOrEmitGlobalVariable(const GlobalVariable *GV);
155894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
156894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// getPointerToFunctionOrStub - If the specified function has been
157894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// code-gen'd, return a pointer to the function.  If not, compile it, or use
158894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// a stub to implement lazy compilation if available.
159894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  ///
160894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  void *getPointerToFunctionOrStub(Function *F);
161894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
162894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// recompileAndRelinkFunction - This method is used to force a function
163894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// which has already been compiled, to be compiled again, possibly
164894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// after it has been modified. Then the entry to the old copy is overwritten
165894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// with a branch to the new copy. If there was no old copy, this acts
166894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// just like JIT::getPointerToFunction().
167894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  ///
168894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  void *recompileAndRelinkFunction(Function *F);
169894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
170894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// freeMachineCodeForFunction - deallocate memory used to code-generate this
171894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// Function.
172894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  ///
173894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  void freeMachineCodeForFunction(Function *F);
174894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
175894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// addPendingFunction - while jitting non-lazily, a called but non-codegen'd
17619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman  /// function was encountered.  Add it to a pending list to be processed after
177894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// the current function.
178894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  ///
179894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  void addPendingFunction(Function *F);
180894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
181894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// getCodeEmitter - Return the code emitter this JIT is emitting into.
182894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  ///
183894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  JITCodeEmitter *getCodeEmitter() const { return JCE; }
184894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
185894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  static ExecutionEngine *createJIT(Module *M,
186894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                    std::string *ErrorStr,
187894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                    JITMemoryManager *JMM,
188894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                    CodeGenOpt::Level OptLevel,
189894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                    bool GVsWithCode,
19019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                    TargetMachine *TM);
191894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
192894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  // Run the JIT on F and return information about the generated code
193894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  void runJITOnFunction(Function *F, MachineCodeInfo *MCI = 0);
194894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
195894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  virtual void RegisterJITEventListener(JITEventListener *L);
196894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  virtual void UnregisterJITEventListener(JITEventListener *L);
197894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// These functions correspond to the methods on JITEventListener.  They
198894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// iterate over the registered listeners and call the corresponding method on
199894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// each.
200894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  void NotifyFunctionEmitted(
201894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      const Function &F, void *Code, size_t Size,
202894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      const JITEvent_EmittedFunctionDetails &Details);
203894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  void NotifyFreeingMachineCode(void *OldPtr);
204894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
205894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  BasicBlockAddressMapTy &
206894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  getBasicBlockAddressMap(const MutexGuard &) {
207894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    return BasicBlockAddressMap;
208894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
209894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
210894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
211894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanprivate:
212894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  static JITCodeEmitter *createEmitter(JIT &J, JITMemoryManager *JMM,
213894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                       TargetMachine &tm);
214894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  void runJITOnFunctionUnlocked(Function *F, const MutexGuard &locked);
215894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  void updateFunctionStub(Function *F);
216894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  void jitTheFunction(Function *F, const MutexGuard &locked);
217894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
218894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanprotected:
219894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
220894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// getMemoryforGV - Allocate memory for a global variable.
221894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  virtual char* getMemoryForGV(const GlobalVariable* GV);
222894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
223894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman};
224894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
225894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman} // End llvm namespace
226894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
227894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#endif
228