1 //=====-- NVPTXSubtarget.h - Define Subtarget for the NVPTX ---*- C++ -*--====//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the NVPTX specific subclass of TargetSubtarget.
12 //===----------------------------------------------------------------------===//
14 #ifndef NVPTXSUBTARGET_H
15 #define NVPTXSUBTARGET_H
18 #include "llvm/Target/TargetSubtargetInfo.h"
21 #define GET_SUBTARGETINFO_HEADER
22 #include "NVPTXGenSubtargetInfo.inc"
26 class NVPTXSubtarget : public NVPTXGenSubtargetInfo {
27 virtual void anchor();
28 std::string TargetName;
29 NVPTX::DrvInterface drvInterface;
32 // PTX version x.y is represented as 10*x+y, e.g. 3.1 == 31
35 // SM version x.y is represented as 10*x+y, e.g. 3.1 == 31
36 unsigned int SmVersion;
39 /// This constructor initializes the data members to match that
40 /// of the specified module.
42 NVPTXSubtarget(const std::string &TT, const std::string &CPU,
43 const std::string &FS, bool is64Bit);
45 bool hasBrkPt() const { return SmVersion >= 11; }
46 bool hasAtomRedG32() const { return SmVersion >= 11; }
47 bool hasAtomRedS32() const { return SmVersion >= 12; }
48 bool hasAtomRedG64() const { return SmVersion >= 12; }
49 bool hasAtomRedS64() const { return SmVersion >= 20; }
50 bool hasAtomRedGen32() const { return SmVersion >= 20; }
51 bool hasAtomRedGen64() const { return SmVersion >= 20; }
52 bool hasAtomAddF32() const { return SmVersion >= 20; }
53 bool hasVote() const { return SmVersion >= 12; }
54 bool hasDouble() const { return SmVersion >= 13; }
55 bool reqPTX20() const { return SmVersion >= 20; }
56 bool hasF32FTZ() const { return SmVersion >= 20; }
57 bool hasFMAF32() const { return SmVersion >= 20; }
58 bool hasFMAF64() const { return SmVersion >= 13; }
59 bool hasLDG() const { return SmVersion >= 32; }
60 bool hasLDU() const { return SmVersion >= 20; }
61 bool hasGenericLdSt() const { return SmVersion >= 20; }
62 inline bool hasHWROT32() const { return false; }
63 inline bool hasSWROT32() const { return true; }
64 inline bool hasROT32() const { return hasHWROT32() || hasSWROT32(); }
65 inline bool hasROT64() const { return SmVersion >= 20; }
67 bool hasImageHandles() const {
71 bool is64Bit() const { return Is64Bit; }
73 unsigned int getSmVersion() const { return SmVersion; }
74 NVPTX::DrvInterface getDrvInterface() const { return drvInterface; }
75 std::string getTargetName() const { return TargetName; }
77 unsigned getPTXVersion() const { return PTXVersion; }
79 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
82 } // End llvm namespace
84 #endif // NVPTXSUBTARGET_H