/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/lib/Target/NVPTX/NVPTXSubtarget.h
Line | Count | Source (jump to first uncovered line) |
1 | | //=====-- NVPTXSubtarget.h - Define Subtarget for the 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 TargetSubtarget. |
11 | | // |
12 | | //===----------------------------------------------------------------------===// |
13 | | |
14 | | #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXSUBTARGET_H |
15 | | #define LLVM_LIB_TARGET_NVPTX_NVPTXSUBTARGET_H |
16 | | |
17 | | #include "NVPTX.h" |
18 | | #include "NVPTXFrameLowering.h" |
19 | | #include "NVPTXISelLowering.h" |
20 | | #include "NVPTXInstrInfo.h" |
21 | | #include "NVPTXRegisterInfo.h" |
22 | | #include "llvm/CodeGen/SelectionDAGTargetInfo.h" |
23 | | #include "llvm/IR/DataLayout.h" |
24 | | #include "llvm/Target/TargetSubtargetInfo.h" |
25 | | #include <string> |
26 | | |
27 | | #define GET_SUBTARGETINFO_HEADER |
28 | | #include "NVPTXGenSubtargetInfo.inc" |
29 | | |
30 | | namespace llvm { |
31 | | |
32 | | class NVPTXSubtarget : public NVPTXGenSubtargetInfo { |
33 | | virtual void anchor(); |
34 | | std::string TargetName; |
35 | | |
36 | | // PTX version x.y is represented as 10*x+y, e.g. 3.1 == 31 |
37 | | unsigned PTXVersion; |
38 | | |
39 | | // SM version x.y is represented as 10*x+y, e.g. 3.1 == 31 |
40 | | unsigned int SmVersion; |
41 | | |
42 | | const NVPTXTargetMachine &TM; |
43 | | NVPTXInstrInfo InstrInfo; |
44 | | NVPTXTargetLowering TLInfo; |
45 | | SelectionDAGTargetInfo TSInfo; |
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 | | |
51 | | protected: |
52 | | // Processor supports scoped atomic operations. |
53 | | bool HasAtomScope; |
54 | | |
55 | | public: |
56 | | /// This constructor initializes the data members to match that |
57 | | /// of the specified module. |
58 | | /// |
59 | | NVPTXSubtarget(const Triple &TT, const std::string &CPU, |
60 | | const std::string &FS, const NVPTXTargetMachine &TM); |
61 | | |
62 | 9.99k | const TargetFrameLowering *getFrameLowering() const override { |
63 | 9.99k | return &FrameLowering; |
64 | 9.99k | } |
65 | 35.0k | const NVPTXInstrInfo *getInstrInfo() const override { return &InstrInfo; } |
66 | 51.0k | const NVPTXRegisterInfo *getRegisterInfo() const override { |
67 | 51.0k | return &InstrInfo.getRegisterInfo(); |
68 | 51.0k | } |
69 | 38.7k | const NVPTXTargetLowering *getTargetLowering() const override { |
70 | 38.7k | return &TLInfo; |
71 | 38.7k | } |
72 | 1.57k | const SelectionDAGTargetInfo *getSelectionDAGInfo() const override { |
73 | 1.57k | return &TSInfo; |
74 | 1.57k | } |
75 | | |
76 | 0 | bool hasBrkPt() const { return SmVersion >= 11; } |
77 | 0 | bool hasAtomRedG32() const { return SmVersion >= 11; } |
78 | 0 | bool hasAtomRedS32() const { return SmVersion >= 12; } |
79 | 0 | bool hasAtomRedG64() const { return SmVersion >= 12; } |
80 | 0 | bool hasAtomRedS64() const { return SmVersion >= 20; } |
81 | 10 | bool hasAtomRedGen32() const { return SmVersion >= 20; } |
82 | 10 | bool hasAtomRedGen64() const { return SmVersion >= 20; } |
83 | 11 | bool hasAtomAddF32() const { return SmVersion >= 20; } |
84 | 8 | bool hasAtomAddF64() const { return SmVersion >= 60; } |
85 | 104 | bool hasAtomScope() const { return HasAtomScope; } |
86 | 12 | bool hasAtomBitwise64() const { return SmVersion >= 32; } |
87 | 8 | bool hasAtomMinMax64() const { return SmVersion >= 32; } |
88 | 0 | bool hasVote() const { return SmVersion >= 12; } |
89 | 224 | bool hasDouble() const { return SmVersion >= 13; } |
90 | 16 | bool reqPTX20() const { return SmVersion >= 20; } |
91 | 0 | bool hasF32FTZ() const { return SmVersion >= 20; } |
92 | 0 | bool hasFMAF32() const { return SmVersion >= 20; } |
93 | 0 | bool hasFMAF64() const { return SmVersion >= 13; } |
94 | 2.81k | bool hasLDG() const { return SmVersion >= 32; } |
95 | 0 | bool hasLDU() const { return ((SmVersion >= 20) && (SmVersion < 30)); } |
96 | 9 | bool hasGenericLdSt() const { return SmVersion >= 20; } |
97 | 594 | inline bool hasHWROT32() const { return SmVersion >= 32; } |
98 | 479 | inline bool hasSWROT32() const { |
99 | 479 | return ((SmVersion >= 20) && (SmVersion < 32)); |
100 | 479 | } |
101 | 582 | inline bool hasROT32() const { return hasHWROT32() || 582 hasSWROT32()479 ; } |
102 | 582 | inline bool hasROT64() const { return SmVersion >= 20; } |
103 | | bool hasImageHandles() const; |
104 | 6.44k | bool hasFP16Math() const { return SmVersion >= 53; } |
105 | | bool allowFP16Math() const; |
106 | | |
107 | 6.23k | unsigned int getSmVersion() const { return SmVersion; } |
108 | 228 | std::string getTargetName() const { return TargetName; } |
109 | | |
110 | 253 | unsigned getPTXVersion() const { return PTXVersion; } |
111 | | |
112 | | NVPTXSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS); |
113 | | void ParseSubtargetFeatures(StringRef CPU, StringRef FS); |
114 | | }; |
115 | | |
116 | | } // End llvm namespace |
117 | | |
118 | | #endif |