Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/NVPTX/NVPTXSubtarget.h
Line
Count
Source
1
//=====-- NVPTXSubtarget.h - Define Subtarget for the NVPTX ---*- C++ -*--====//
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 declares the NVPTX specific subclass of TargetSubtarget.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXSUBTARGET_H
14
#define LLVM_LIB_TARGET_NVPTX_NVPTXSUBTARGET_H
15
16
#include "NVPTX.h"
17
#include "NVPTXFrameLowering.h"
18
#include "NVPTXISelLowering.h"
19
#include "NVPTXInstrInfo.h"
20
#include "NVPTXRegisterInfo.h"
21
#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
22
#include "llvm/CodeGen/TargetSubtargetInfo.h"
23
#include "llvm/IR/DataLayout.h"
24
#include <string>
25
26
#define GET_SUBTARGETINFO_HEADER
27
#include "NVPTXGenSubtargetInfo.inc"
28
29
namespace llvm {
30
31
class NVPTXSubtarget : public NVPTXGenSubtargetInfo {
32
  virtual void anchor();
33
  std::string TargetName;
34
35
  // PTX version x.y is represented as 10*x+y, e.g. 3.1 == 31
36
  unsigned PTXVersion;
37
38
  // SM version x.y is represented as 10*x+y, e.g. 3.1 == 31
39
  unsigned int SmVersion;
40
41
  const NVPTXTargetMachine &TM;
42
  NVPTXInstrInfo InstrInfo;
43
  NVPTXTargetLowering TLInfo;
44
  SelectionDAGTargetInfo TSInfo;
45
46
  // NVPTX does not have any call stack frame, but need a NVPTX specific
47
  // FrameLowering class because TargetFrameLowering is abstract.
48
  NVPTXFrameLowering FrameLowering;
49
50
public:
51
  /// This constructor initializes the data members to match that
52
  /// of the specified module.
53
  ///
54
  NVPTXSubtarget(const Triple &TT, const std::string &CPU,
55
                 const std::string &FS, const NVPTXTargetMachine &TM);
56
57
10.2k
  const TargetFrameLowering *getFrameLowering() const override {
58
10.2k
    return &FrameLowering;
59
10.2k
  }
60
42.0k
  const NVPTXInstrInfo *getInstrInfo() const override { return &InstrInfo; }
61
58.8k
  const NVPTXRegisterInfo *getRegisterInfo() const override {
62
58.8k
    return &InstrInfo.getRegisterInfo();
63
58.8k
  }
64
48.1k
  const NVPTXTargetLowering *getTargetLowering() const override {
65
48.1k
    return &TLInfo;
66
48.1k
  }
67
1.76k
  const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
68
1.76k
    return &TSInfo;
69
1.76k
  }
70
71
20
  bool hasAtomAddF64() const { return SmVersion >= 60; }
72
104
  bool hasAtomScope() const { return SmVersion >= 60; }
73
12
  bool hasAtomBitwise64() const { return SmVersion >= 32; }
74
8
  bool hasAtomMinMax64() const { return SmVersion >= 32; }
75
3.11k
  bool hasLDG() const { return SmVersion >= 32; }
76
12
  inline bool hasHWROT32() const { return SmVersion >= 32; }
77
  bool hasImageHandles() const;
78
5.07k
  bool hasFP16Math() const { return SmVersion >= 53; }
79
  bool allowFP16Math() const;
80
7.54k
  unsigned int getSmVersion() const { return SmVersion; }
81
255
  std::string getTargetName() const { return TargetName; }
82
83
296
  unsigned getPTXVersion() const { return PTXVersion; }
84
85
  NVPTXSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
86
  void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
87
};
88
89
} // End llvm namespace
90
91
#endif