Temporarily Revert "Nuke the old JIT." as it's not quite ready to
[oota-llvm.git] / lib / Target / NVPTX / NVPTXTargetMachine.h
1 //===-- NVPTXTargetMachine.h - Define TargetMachine for NVPTX ---*- 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 // This file declares the NVPTX specific subclass of TargetMachine.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef NVPTX_TARGETMACHINE_H
15 #define NVPTX_TARGETMACHINE_H
16
17 #include "NVPTXSubtarget.h"
18 #include "ManagedStringPool.h"
19 #include "llvm/Target/TargetFrameLowering.h"
20 #include "llvm/Target/TargetMachine.h"
21 #include "llvm/Target/TargetSelectionDAGInfo.h"
22
23 namespace llvm {
24
25 /// NVPTXTargetMachine
26 ///
27 class NVPTXTargetMachine : public LLVMTargetMachine {
28   NVPTXSubtarget Subtarget;
29
30   // Hold Strings that can be free'd all together with NVPTXTargetMachine
31   ManagedStringPool ManagedStrPool;
32
33 public:
34   NVPTXTargetMachine(const Target &T, StringRef TT, StringRef CPU, StringRef FS,
35                      const TargetOptions &Options, Reloc::Model RM,
36                      CodeModel::Model CM, CodeGenOpt::Level OP, bool is64bit);
37
38   const NVPTXSubtarget *getSubtargetImpl() const override { return &Subtarget; }
39
40   ManagedStringPool *getManagedStrPool() const {
41     return const_cast<ManagedStringPool *>(&ManagedStrPool);
42   }
43
44   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
45
46   // Emission of machine code through JITCodeEmitter is not supported.
47   bool addPassesToEmitMachineCode(PassManagerBase &, JITCodeEmitter &,
48                                   bool = true) override {
49     return true;
50   }
51
52   // Emission of machine code through MCJIT is not supported.
53   bool addPassesToEmitMC(PassManagerBase &, MCContext *&, raw_ostream &,
54                          bool = true) override {
55     return true;
56   }
57
58 }; // NVPTXTargetMachine.
59
60 class NVPTXTargetMachine32 : public NVPTXTargetMachine {
61   virtual void anchor();
62 public:
63   NVPTXTargetMachine32(const Target &T, StringRef TT, StringRef CPU,
64                        StringRef FS, const TargetOptions &Options,
65                        Reloc::Model RM, CodeModel::Model CM,
66                        CodeGenOpt::Level OL);
67 };
68
69 class NVPTXTargetMachine64 : public NVPTXTargetMachine {
70   virtual void anchor();
71 public:
72   NVPTXTargetMachine64(const Target &T, StringRef TT, StringRef CPU,
73                        StringRef FS, const TargetOptions &Options,
74                        Reloc::Model RM, CodeModel::Model CM,
75                        CodeGenOpt::Level OL);
76 };
77
78 } // end namespace llvm
79
80 #endif