summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/MCJIT/MCJIT.h
blob: cd1f989b10c77cc663a8559bbe8524c7441ba5a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//===-- MCJIT.h - Class definition for the MCJIT ----------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIB_EXECUTIONENGINE_MCJIT_H
#define LLVM_LIB_EXECUTIONENGINE_MCJIT_H

#include "llvm/ExecutionEngine/ExecutionEngine.h"

namespace llvm {

class MCJIT : public ExecutionEngine {
  MCJIT(Module *M, TargetMachine &tm, TargetJITInfo &tji,
        JITMemoryManager *JMM, CodeGenOpt::Level OptLevel,
        bool AllocateGVsWithCode);
public:
  ~MCJIT();

  /// @name ExecutionEngine interface implementation
  /// @{

  virtual void *getPointerToBasicBlock(BasicBlock *BB);

  virtual void *getPointerToFunction(Function *F);

  virtual void *recompileAndRelinkFunction(Function *F);

  virtual void freeMachineCodeForFunction(Function *F);

  virtual GenericValue runFunction(Function *F,
                                   const std::vector<GenericValue> &ArgValues);

  /// @}
  /// @name (Private) Registration Interfaces
  /// @{

  static void Register() {
    MCJITCtor = createJIT;
  }

  // FIXME: This routine is scheduled for termination. Do not use it.
  static TargetMachine *selectTarget(Module *M,
                                     StringRef MArch,
                                     StringRef MCPU,
                                     const SmallVectorImpl<std::string>& MAttrs,
                                     std::string *Err);

  static ExecutionEngine *createJIT(Module *M,
                                    std::string *ErrorStr,
                                    JITMemoryManager *JMM,
                                    CodeGenOpt::Level OptLevel,
                                    bool GVsWithCode,
                                    CodeModel::Model CMM,
                                    StringRef MArch,
                                    StringRef MCPU,
                                    const SmallVectorImpl<std::string>& MAttrs);

  // @}
};

} // End llvm namespace

#endif