MCJIT.h revision 6aec29848676494867e26307698155bc2c5a4033
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//===----------------------------------------------------------------------===//
9
10#ifndef LLVM_LIB_EXECUTIONENGINE_MCJIT_H
11#define LLVM_LIB_EXECUTIONENGINE_MCJIT_H
12
13#include "llvm/ExecutionEngine/ExecutionEngine.h"
14
15namespace llvm {
16
17class MCJIT : public ExecutionEngine {
18  MCJIT(Module *M, TargetMachine &tm, TargetJITInfo &tji,
19        JITMemoryManager *JMM, CodeGenOpt::Level OptLevel,
20        bool AllocateGVsWithCode);
21public:
22  ~MCJIT();
23
24  /// @name ExecutionEngine interface implementation
25  /// @{
26
27  virtual void *getPointerToBasicBlock(BasicBlock *BB);
28
29  virtual void *getPointerToFunction(Function *F);
30
31  virtual void *recompileAndRelinkFunction(Function *F);
32
33  virtual void freeMachineCodeForFunction(Function *F);
34
35  virtual GenericValue runFunction(Function *F,
36                                   const std::vector<GenericValue> &ArgValues);
37
38  /// @}
39  /// @name (Private) Registration Interfaces
40  /// @{
41
42  static void Register() {
43    MCJITCtor = createJIT;
44  }
45
46  // FIXME: This routine is scheduled for termination. Do not use it.
47  static TargetMachine *selectTarget(Module *M,
48                                     StringRef MArch,
49                                     StringRef MCPU,
50                                     const SmallVectorImpl<std::string>& MAttrs,
51                                     std::string *Err);
52
53  static ExecutionEngine *createJIT(Module *M,
54                                    std::string *ErrorStr,
55                                    JITMemoryManager *JMM,
56                                    CodeGenOpt::Level OptLevel,
57                                    bool GVsWithCode,
58                                    CodeModel::Model CMM,
59                                    StringRef MArch,
60                                    StringRef MCPU,
61                                    const SmallVectorImpl<std::string>& MAttrs);
62
63  // @}
64};
65
66} // End llvm namespace
67
68#endif
69