]> git.proxmox.com Git - rustc.git/blob - src/llvm/lib/Target/NVPTX/NVPTXTargetMachine.h
Imported Upstream version 1.0.0+dfsg1
[rustc.git] / src / llvm / 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 LLVM_LIB_TARGET_NVPTX_NVPTXTARGETMACHINE_H
15 #define LLVM_LIB_TARGET_NVPTX_NVPTXTARGETMACHINE_H
16
17 #include "ManagedStringPool.h"
18 #include "NVPTXSubtarget.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 std::unique_ptr<TargetLoweringObjectFile> TLOF;
29 NVPTXSubtarget Subtarget;
30
31 // Hold Strings that can be free'd all together with NVPTXTargetMachine
32 ManagedStringPool ManagedStrPool;
33
34 public:
35 NVPTXTargetMachine(const Target &T, StringRef TT, StringRef CPU, StringRef FS,
36 const TargetOptions &Options, Reloc::Model RM,
37 CodeModel::Model CM, CodeGenOpt::Level OP, bool is64bit);
38
39 ~NVPTXTargetMachine() override;
40
41 const NVPTXSubtarget *getSubtargetImpl() const override { return &Subtarget; }
42
43 ManagedStringPool *getManagedStrPool() const {
44 return const_cast<ManagedStringPool *>(&ManagedStrPool);
45 }
46
47 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
48
49 // Emission of machine code through MCJIT is not supported.
50 bool addPassesToEmitMC(PassManagerBase &, MCContext *&, raw_ostream &,
51 bool = true) override {
52 return true;
53 }
54 TargetLoweringObjectFile *getObjFileLowering() const override {
55 return TLOF.get();
56 }
57
58 /// \brief Register NVPTX analysis passes with a pass manager.
59 void addAnalysisPasses(PassManagerBase &PM) override;
60
61 }; // NVPTXTargetMachine.
62
63 class NVPTXTargetMachine32 : public NVPTXTargetMachine {
64 virtual void anchor();
65 public:
66 NVPTXTargetMachine32(const Target &T, StringRef TT, StringRef CPU,
67 StringRef FS, const TargetOptions &Options,
68 Reloc::Model RM, CodeModel::Model CM,
69 CodeGenOpt::Level OL);
70 };
71
72 class NVPTXTargetMachine64 : public NVPTXTargetMachine {
73 virtual void anchor();
74 public:
75 NVPTXTargetMachine64(const Target &T, StringRef TT, StringRef CPU,
76 StringRef FS, const TargetOptions &Options,
77 Reloc::Model RM, CodeModel::Model CM,
78 CodeGenOpt::Level OL);
79 };
80
81 } // end namespace llvm
82
83 #endif