0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 //===- NVPTXSubtarget.cpp - NVPTX Subtarget Information -------------------===//
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 //
|
147
|
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
4 // See https://llvm.org/LICENSE.txt for license information.
|
|
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 //
|
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 // This file implements the NVPTX specific subclass of TargetSubtarget.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 //
|
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 #include "NVPTXSubtarget.h"
|
95
|
14 #include "NVPTXTargetMachine.h"
|
77
|
15
|
|
16 using namespace llvm;
|
|
17
|
|
18 #define DEBUG_TYPE "nvptx-subtarget"
|
|
19
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 #define GET_SUBTARGETINFO_ENUM
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 #define GET_SUBTARGETINFO_TARGET_DESC
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
22 #define GET_SUBTARGETINFO_CTOR
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 #include "NVPTXGenSubtargetInfo.inc"
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24
|
121
|
25 static cl::opt<bool>
|
|
26 NoF16Math("nvptx-no-f16-math", cl::ZeroOrMore, cl::Hidden,
|
|
27 cl::desc("NVPTX Specific: Disable generation of f16 math ops."),
|
|
28 cl::init(false));
|
|
29
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
30 // Pin the vtable to this file.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31 void NVPTXSubtarget::anchor() {}
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32
|
77
|
33 NVPTXSubtarget &NVPTXSubtarget::initializeSubtargetDependencies(StringRef CPU,
|
|
34 StringRef FS) {
|
|
35 // Provide the default CPU if we don't have one.
|
|
36 TargetName = CPU.empty() ? "sm_20" : CPU;
|
|
37
|
|
38 ParseSubtargetFeatures(TargetName, FS);
|
|
39
|
|
40 // Set default to PTX 3.2 (CUDA 5.5)
|
|
41 if (PTXVersion == 0) {
|
|
42 PTXVersion = 32;
|
|
43 }
|
|
44
|
|
45 return *this;
|
|
46 }
|
|
47
|
95
|
48 NVPTXSubtarget::NVPTXSubtarget(const Triple &TT, const std::string &CPU,
|
|
49 const std::string &FS,
|
|
50 const NVPTXTargetMachine &TM)
|
|
51 : NVPTXGenSubtargetInfo(TT, CPU, FS), PTXVersion(0), SmVersion(20), TM(TM),
|
|
52 InstrInfo(), TLInfo(TM, initializeSubtargetDependencies(CPU, FS)),
|
|
53 FrameLowering() {}
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
54
|
95
|
55 bool NVPTXSubtarget::hasImageHandles() const {
|
|
56 // Enable handles for Kepler+, where CUDA supports indirect surfaces and
|
|
57 // textures
|
|
58 if (TM.getDrvInterface() == NVPTX::CUDA)
|
|
59 return (SmVersion >= 30);
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
60
|
95
|
61 // Disabled, otherwise
|
|
62 return false;
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
63 }
|
121
|
64
|
|
65 bool NVPTXSubtarget::allowFP16Math() const {
|
|
66 return hasFP16Math() && NoF16Math == false;
|
|
67 }
|