LLVM  14.0.0git
NVPTXSubtarget.h
Go to the documentation of this file.
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"
23 #include "llvm/IR/DataLayout.h"
24 #include <string>
25 
26 #define GET_SUBTARGETINFO_HEADER
27 #include "NVPTXGenSubtargetInfo.inc"
28 
29 namespace llvm {
30 
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;
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  const TargetFrameLowering *getFrameLowering() const override {
58  return &FrameLowering;
59  }
60  const NVPTXInstrInfo *getInstrInfo() const override { return &InstrInfo; }
61  const NVPTXRegisterInfo *getRegisterInfo() const override {
62  return &InstrInfo.getRegisterInfo();
63  }
64  const NVPTXTargetLowering *getTargetLowering() const override {
65  return &TLInfo;
66  }
67  const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
68  return &TSInfo;
69  }
70 
71  bool hasAtomAddF64() const { return SmVersion >= 60; }
72  bool hasAtomScope() const { return SmVersion >= 60; }
73  bool hasAtomBitwise64() const { return SmVersion >= 32; }
74  bool hasAtomMinMax64() const { return SmVersion >= 32; }
75  bool hasLDG() const { return SmVersion >= 32; }
76  inline bool hasHWROT32() const { return SmVersion >= 32; }
77  bool hasImageHandles() const;
78  bool hasFP16Math() const { return SmVersion >= 53; }
79  bool allowFP16Math() const;
80  unsigned int getSmVersion() const { return SmVersion; }
81  std::string getTargetName() const { return TargetName; }
82 
83  unsigned getPTXVersion() const { return PTXVersion; }
84 
87 };
88 
89 } // End llvm namespace
90 
91 #endif
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::TargetFrameLowering
Information about stack frame layout on the target.
Definition: TargetFrameLowering.h:43
llvm::NVPTXSubtarget::hasLDG
bool hasLDG() const
Definition: NVPTXSubtarget.h:75
llvm::NVPTXSubtarget::getTargetLowering
const NVPTXTargetLowering * getTargetLowering() const override
Definition: NVPTXSubtarget.h:64
llvm::NVPTXInstrInfo
Definition: NVPTXInstrInfo.h:25
llvm::NVPTXSubtarget::hasAtomAddF64
bool hasAtomAddF64() const
Definition: NVPTXSubtarget.h:71
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::NVPTXSubtarget::getSmVersion
unsigned int getSmVersion() const
Definition: NVPTXSubtarget.h:80
llvm::NVPTXSubtarget::hasAtomMinMax64
bool hasAtomMinMax64() const
Definition: NVPTXSubtarget.h:74
llvm::NVPTXInstrInfo::getRegisterInfo
const NVPTXRegisterInfo & getRegisterInfo() const
Definition: NVPTXInstrInfo.h:31
llvm::NVPTXSubtarget::getFrameLowering
const TargetFrameLowering * getFrameLowering() const override
Definition: NVPTXSubtarget.h:57
NVPTXRegisterInfo.h
llvm::NVPTXTargetMachine
NVPTXTargetMachine.
Definition: NVPTXTargetMachine.h:24
NVPTX.h
llvm::NVPTXSubtarget::initializeSubtargetDependencies
NVPTXSubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
Definition: NVPTXSubtarget.cpp:33
llvm::NVPTXFrameLowering
Definition: NVPTXFrameLowering.h:21
llvm::NVPTXSubtarget::getPTXVersion
unsigned getPTXVersion() const
Definition: NVPTXSubtarget.h:83
llvm::SelectionDAGTargetInfo
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
Definition: SelectionDAGTargetInfo.h:31
llvm::NVPTXSubtarget::getRegisterInfo
const NVPTXRegisterInfo * getRegisterInfo() const override
Definition: NVPTXSubtarget.h:61
llvm::X86AS::FS
@ FS
Definition: X86.h:188
llvm::NVPTXSubtarget::getSelectionDAGInfo
const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
Definition: NVPTXSubtarget.h:67
NVPTXGenSubtargetInfo
llvm::NVPTXSubtarget
Definition: NVPTXSubtarget.h:31
llvm::NVPTXSubtarget::hasAtomScope
bool hasAtomScope() const
Definition: NVPTXSubtarget.h:72
llvm::NVPTXSubtarget::hasImageHandles
bool hasImageHandles() const
Definition: NVPTXSubtarget.cpp:55
llvm::NVPTXSubtarget::NVPTXSubtarget
NVPTXSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const NVPTXTargetMachine &TM)
This constructor initializes the data members to match that of the specified module.
Definition: NVPTXSubtarget.cpp:48
llvm::NVPTXSubtarget::allowFP16Math
bool allowFP16Math() const
Definition: NVPTXSubtarget.cpp:65
DataLayout.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
TargetSubtargetInfo.h
SmVersion
unsigned SmVersion
Definition: NVVMReflect.cpp:77
llvm::NVPTXSubtarget::hasFP16Math
bool hasFP16Math() const
Definition: NVPTXSubtarget.h:78
llvm::NVPTXSubtarget::hasAtomBitwise64
bool hasAtomBitwise64() const
Definition: NVPTXSubtarget.h:73
NVPTXISelLowering.h
llvm::NVPTXTargetLowering
Definition: NVPTXISelLowering.h:440
llvm::NVPTXSubtarget::ParseSubtargetFeatures
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
llvm::NVPTXRegisterInfo
Definition: NVPTXRegisterInfo.h:24
SelectionDAGTargetInfo.h
llvm::NVPTXSubtarget::getTargetName
std::string getTargetName() const
Definition: NVPTXSubtarget.h:81
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
NVPTXFrameLowering.h
llvm::NVPTXSubtarget::hasHWROT32
bool hasHWROT32() const
Definition: NVPTXSubtarget.h:76
llvm::NVPTXSubtarget::getInstrInfo
const NVPTXInstrInfo * getInstrInfo() const override
Definition: NVPTXSubtarget.h:60
NVPTXInstrInfo.h