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
17 #include "llvm/Target/TargetSubtargetInfo.h"
20 #define GET_SUBTARGETINFO_HEADER
21 #include "NVPTXGenSubtargetInfo.inc"
27 class NVPTXSubtarget : public NVPTXGenSubtargetInfo {
29 unsigned int SmVersion;
30 std::string TargetName;
31 NVPTX::DrvInterface drvInterface;
32 bool dummy; // For the 'dummy' feature, see NVPTX.td
36 /// This constructor initializes the data members to match that
37 /// of the specified module.
39 NVPTXSubtarget(const std::string &TT, const std::string &CPU,
40 const std::string &FS, bool is64Bit);
42 bool hasBrkPt() const { return SmVersion >= 11; }
43 bool hasAtomRedG32() const { return SmVersion >= 11; }
44 bool hasAtomRedS32() const { return SmVersion >= 12; }
45 bool hasAtomRedG64() const { return SmVersion >= 12; }
46 bool hasAtomRedS64() const { return SmVersion >= 20; }
47 bool hasAtomRedGen32() const { return SmVersion >= 20; }
48 bool hasAtomRedGen64() const { return SmVersion >= 20; }
49 bool hasAtomAddF32() const { return SmVersion >= 20; }
50 bool hasVote() const { return SmVersion >= 12; }
51 bool hasDouble() const { return SmVersion >= 13; }
52 bool reqPTX20() const { return SmVersion >= 20; }
53 bool hasF32FTZ() const { return SmVersion >= 20; }
54 bool hasFMAF32() const { return SmVersion >= 20; }
55 bool hasFMAF64() const { return SmVersion >= 13; }
56 bool hasLDU() const { return SmVersion >= 20; }
57 bool hasGenericLdSt() const { return SmVersion >= 20; }
58 inline bool hasHWROT32() const { return false; }
59 inline bool hasSWROT32() const {
62 inline bool hasROT32() const { return hasHWROT32() || hasSWROT32() ; }
63 inline bool hasROT64() const { return SmVersion >= 20; }
66 bool is64Bit() const { return Is64Bit; }
68 unsigned int getSmVersion() const { return SmVersion; }
69 NVPTX::DrvInterface getDrvInterface() const { return drvInterface; }
70 std::string getTargetName() const { return TargetName; }
72 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
74 std::string getDataLayout() const {
77 p = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"
78 "f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-"
81 p = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"
82 "f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-"
85 return std::string(p);
90 } // End llvm namespace
92 #endif // NVPTXSUBTARGET_H