Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/NVPTX/NVPTXSubtarget.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- NVPTXSubtarget.cpp - NVPTX Subtarget Information -------------------===//
2
//
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
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This file implements the NVPTX specific subclass of TargetSubtarget.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#include "NVPTXSubtarget.h"
14
#include "NVPTXTargetMachine.h"
15
16
using namespace llvm;
17
18
#define DEBUG_TYPE "nvptx-subtarget"
19
20
#define GET_SUBTARGETINFO_ENUM
21
#define GET_SUBTARGETINFO_TARGET_DESC
22
#define GET_SUBTARGETINFO_CTOR
23
#include "NVPTXGenSubtargetInfo.inc"
24
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
30
// Pin the vtable to this file.
31
0
void NVPTXSubtarget::anchor() {}
32
33
NVPTXSubtarget &NVPTXSubtarget::initializeSubtargetDependencies(StringRef CPU,
34
455
                                                                StringRef FS) {
35
455
    // Provide the default CPU if we don't have one.
36
455
  TargetName = CPU.empty() ? 
"sm_20"203
:
CPU252
;
37
455
38
455
  ParseSubtargetFeatures(TargetName, FS);
39
455
40
455
  // Set default to PTX 3.2 (CUDA 5.5)
41
455
  if (PTXVersion == 0) {
42
268
    PTXVersion = 32;
43
268
  }
44
455
45
455
  return *this;
46
455
}
47
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
455
      FrameLowering() {}
54
55
47.6k
bool NVPTXSubtarget::hasImageHandles() const {
56
47.6k
  // Enable handles for Kepler+, where CUDA supports indirect surfaces and
57
47.6k
  // textures
58
47.6k
  if (TM.getDrvInterface() == NVPTX::CUDA)
59
47.6k
    return (SmVersion >= 30);
60
80
61
80
  // Disabled, otherwise
62
80
  return false;
63
80
}
64
65
5.07k
bool NVPTXSubtarget::allowFP16Math() const {
66
5.07k
  return hasFP16Math() && 
NoF16Math == false440
;
67
5.07k
}