LLVM  4.0.0
NVPTXSubtarget.h
Go to the documentation of this file.
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"
23 #include "llvm/IR/DataLayout.h"
25 #include <string>
26 
27 #define GET_SUBTARGETINFO_HEADER
28 #include "NVPTXGenSubtargetInfo.inc"
29 
30 namespace llvm {
31 
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;
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.
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  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  }
72  const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
73  return &TSInfo;
74  }
75 
76  bool hasBrkPt() const { return SmVersion >= 11; }
77  bool hasAtomRedG32() const { return SmVersion >= 11; }
78  bool hasAtomRedS32() const { return SmVersion >= 12; }
79  bool hasAtomRedG64() const { return SmVersion >= 12; }
80  bool hasAtomRedS64() const { return SmVersion >= 20; }
81  bool hasAtomRedGen32() const { return SmVersion >= 20; }
82  bool hasAtomRedGen64() const { return SmVersion >= 20; }
83  bool hasAtomAddF32() const { return SmVersion >= 20; }
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; }
88  bool hasVote() const { return SmVersion >= 12; }
89  bool hasDouble() const { return SmVersion >= 13; }
90  bool reqPTX20() const { return SmVersion >= 20; }
91  bool hasF32FTZ() const { return SmVersion >= 20; }
92  bool hasFMAF32() const { return SmVersion >= 20; }
93  bool hasFMAF64() const { return SmVersion >= 13; }
94  bool hasLDG() const { return SmVersion >= 32; }
95  bool hasLDU() const { return ((SmVersion >= 20) && (SmVersion < 30)); }
96  bool hasGenericLdSt() const { return SmVersion >= 20; }
97  inline bool hasHWROT32() const { return SmVersion >= 32; }
98  inline bool hasSWROT32() const {
99  return ((SmVersion >= 20) && (SmVersion < 32));
100  }
101  inline bool hasROT32() const { return hasHWROT32() || hasSWROT32(); }
102  inline bool hasROT64() const { return SmVersion >= 20; }
103  bool hasImageHandles() const;
104 
105  unsigned int getSmVersion() const { return SmVersion; }
106  std::string getTargetName() const { return TargetName; }
107 
108  unsigned getPTXVersion() const { return PTXVersion; }
109 
112 };
113 
114 } // End llvm namespace
115 
116 #endif
bool hasAtomAddF32() const
bool hasLDG() const
bool hasBrkPt() const
bool hasAtomMinMax64() const
bool hasROT32() const
void ParseSubtargetFeatures(StringRef CPU, StringRef FS)
NVPTXSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const NVPTXTargetMachine &TM)
This constructor initializes the data members to match that of the specified module.
bool hasROT64() const
bool hasAtomRedS64() const
bool hasAtomRedG64() const
unsigned int getSmVersion() const
bool hasGenericLdSt() const
bool hasF32FTZ() const
bool hasDouble() const
const NVPTXTargetLowering * getTargetLowering() const override
bool hasAtomScope() const
bool hasFMAF32() const
bool hasAtomBitwise64() const
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
bool hasHWROT32() const
bool hasAtomRedGen64() const
bool hasAtomRedGen32() const
Information about stack frame layout on the target.
std::string getTargetName() const
bool hasLDU() const
const NVPTXInstrInfo * getInstrInfo() const override
NVPTXTargetMachine.
const NVPTXRegisterInfo & getRegisterInfo() const
bool hasFMAF64() const
bool hasAtomRedG32() const
const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
bool hasImageHandles() const
const TargetFrameLowering * getFrameLowering() const override
bool reqPTX20() const
NVPTXSubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
bool hasAtomRedS32() const
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47
bool hasAtomAddF64() const
bool hasSWROT32() const
unsigned getPTXVersion() const
const NVPTXRegisterInfo * getRegisterInfo() const override
bool hasVote() const