0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 //=====-- NVPTXSubtarget.h - Define Subtarget for the NVPTX ---*- C++ -*--====//
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 //
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 // The LLVM Compiler Infrastructure
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 //
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 // This file is distributed under the University of Illinois Open Source
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 // License. See LICENSE.TXT for details.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 //
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 //===----------------------------------------------------------------------===//
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 //
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 // This file declares the NVPTX specific subclass of TargetSubtarget.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 //
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 //===----------------------------------------------------------------------===//
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13
|
77
|
14 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXSUBTARGET_H
|
|
15 #define LLVM_LIB_TARGET_NVPTX_NVPTXSUBTARGET_H
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 #include "NVPTX.h"
|
77
|
18 #include "NVPTXFrameLowering.h"
|
|
19 #include "NVPTXISelLowering.h"
|
|
20 #include "NVPTXInstrInfo.h"
|
|
21 #include "NVPTXRegisterInfo.h"
|
120
|
22 #include "llvm/CodeGen/SelectionDAGTargetInfo.h"
|
77
|
23 #include "llvm/IR/DataLayout.h"
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 #include "llvm/Target/TargetSubtargetInfo.h"
|
77
|
25 #include <string>
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 #define GET_SUBTARGETINFO_HEADER
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 #include "NVPTXGenSubtargetInfo.inc"
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
30 namespace llvm {
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32 class NVPTXSubtarget : public NVPTXGenSubtargetInfo {
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33 virtual void anchor();
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34 std::string TargetName;
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
35
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
36 // PTX version x.y is represented as 10*x+y, e.g. 3.1 == 31
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37 unsigned PTXVersion;
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
38
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39 // SM version x.y is represented as 10*x+y, e.g. 3.1 == 31
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 unsigned int SmVersion;
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
41
|
95
|
42 const NVPTXTargetMachine &TM;
|
77
|
43 NVPTXInstrInfo InstrInfo;
|
|
44 NVPTXTargetLowering TLInfo;
|
120
|
45 SelectionDAGTargetInfo TSInfo;
|
77
|
46
|
|
47 // NVPTX does not have any call stack frame, but need a NVPTX specific
|
|
48 // FrameLowering class because TargetFrameLowering is abstract.
|
|
49 NVPTXFrameLowering FrameLowering;
|
|
50
|
120
|
51 protected:
|
|
52 // Processor supports scoped atomic operations.
|
|
53 bool HasAtomScope;
|
|
54
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
55 public:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
56 /// This constructor initializes the data members to match that
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
57 /// of the specified module.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
58 ///
|
95
|
59 NVPTXSubtarget(const Triple &TT, const std::string &CPU,
|
|
60 const std::string &FS, const NVPTXTargetMachine &TM);
|
77
|
61
|
|
62 const TargetFrameLowering *getFrameLowering() const override {
|
|
63 return &FrameLowering;
|
|
64 }
|
|
65 const NVPTXInstrInfo *getInstrInfo() const override { return &InstrInfo; }
|
|
66 const NVPTXRegisterInfo *getRegisterInfo() const override {
|
|
67 return &InstrInfo.getRegisterInfo();
|
|
68 }
|
|
69 const NVPTXTargetLowering *getTargetLowering() const override {
|
|
70 return &TLInfo;
|
|
71 }
|
120
|
72 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
|
77
|
73 return &TSInfo;
|
|
74 }
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
75
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
76 bool hasBrkPt() const { return SmVersion >= 11; }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
77 bool hasAtomRedG32() const { return SmVersion >= 11; }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
78 bool hasAtomRedS32() const { return SmVersion >= 12; }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
79 bool hasAtomRedG64() const { return SmVersion >= 12; }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
80 bool hasAtomRedS64() const { return SmVersion >= 20; }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
81 bool hasAtomRedGen32() const { return SmVersion >= 20; }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
82 bool hasAtomRedGen64() const { return SmVersion >= 20; }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
83 bool hasAtomAddF32() const { return SmVersion >= 20; }
|
120
|
84 bool hasAtomAddF64() const { return SmVersion >= 60; }
|
|
85 bool hasAtomScope() const { return HasAtomScope; }
|
|
86 bool hasAtomBitwise64() const { return SmVersion >= 32; }
|
|
87 bool hasAtomMinMax64() const { return SmVersion >= 32; }
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
88 bool hasVote() const { return SmVersion >= 12; }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
89 bool hasDouble() const { return SmVersion >= 13; }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
90 bool reqPTX20() const { return SmVersion >= 20; }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
91 bool hasF32FTZ() const { return SmVersion >= 20; }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
92 bool hasFMAF32() const { return SmVersion >= 20; }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
93 bool hasFMAF64() const { return SmVersion >= 13; }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
94 bool hasLDG() const { return SmVersion >= 32; }
|
77
|
95 bool hasLDU() const { return ((SmVersion >= 20) && (SmVersion < 30)); }
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
96 bool hasGenericLdSt() const { return SmVersion >= 20; }
|
77
|
97 inline bool hasHWROT32() const { return SmVersion >= 32; }
|
|
98 inline bool hasSWROT32() const {
|
|
99 return ((SmVersion >= 20) && (SmVersion < 32));
|
|
100 }
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
101 inline bool hasROT32() const { return hasHWROT32() || hasSWROT32(); }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
102 inline bool hasROT64() const { return SmVersion >= 20; }
|
95
|
103 bool hasImageHandles() const;
|
121
|
104 bool hasFP16Math() const { return SmVersion >= 53; }
|
|
105 bool allowFP16Math() const;
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
106
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
107 unsigned int getSmVersion() const { return SmVersion; }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
108 std::string getTargetName() const { return TargetName; }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
109
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
110 unsigned getPTXVersion() const { return PTXVersion; }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
111
|
77
|
112 NVPTXSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
113 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
114 };
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
115
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
116 } // End llvm namespace
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
117
|
77
|
118 #endif
|