1 //=====-- R600Subtarget.h - Define Subtarget for AMDGPU R600 ----*- C++ -*-===//
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
7 //==-----------------------------------------------------------------------===//
10 /// AMDGPU R600 specific subclass of TargetSubtarget.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_AMDGPU_R600SUBTARGET_H
15 #define LLVM_LIB_TARGET_AMDGPU_R600SUBTARGET_H
17 #include "AMDGPUSubtarget.h"
18 #include "R600FrameLowering.h"
19 #include "R600ISelLowering.h"
20 #include "R600InstrInfo.h"
21 #include "Utils/AMDGPUBaseInfo.h"
22 #include "llvm/CodeGen/SelectionDAGTargetInfo.h"
31 #define GET_SUBTARGETINFO_HEADER
32 #include "R600GenSubtargetInfo.inc"
36 class R600Subtarget final
: public R600GenSubtargetInfo
,
37 public AMDGPUSubtarget
{
39 R600InstrInfo InstrInfo
;
40 R600FrameLowering FrameLowering
;
47 short TexVTXClauseSize
;
49 R600TargetLowering TLInfo
;
50 InstrItineraryData InstrItins
;
51 SelectionDAGTargetInfo TSInfo
;
54 R600Subtarget(const Triple
&TT
, StringRef CPU
, StringRef FS
,
55 const TargetMachine
&TM
);
57 const R600InstrInfo
*getInstrInfo() const override
{ return &InstrInfo
; }
59 const R600FrameLowering
*getFrameLowering() const override
{
60 return &FrameLowering
;
63 const R600TargetLowering
*getTargetLowering() const override
{
67 const R600RegisterInfo
*getRegisterInfo() const override
{
68 return &InstrInfo
.getRegisterInfo();
71 const InstrItineraryData
*getInstrItineraryData() const override
{
75 // Nothing implemented, just prevent crashes on use.
76 const SelectionDAGTargetInfo
*getSelectionDAGInfo() const override
{
80 void ParseSubtargetFeatures(StringRef CPU
, StringRef TuneCPU
, StringRef FS
);
82 Generation
getGeneration() const {
86 Align
getStackAlignment() const { return Align(4); }
88 R600Subtarget
&initializeSubtargetDependencies(const Triple
&TT
,
89 StringRef GPU
, StringRef FS
);
92 return (getGeneration() >= EVERGREEN
);
96 return (getGeneration() >= EVERGREEN
);
99 bool hasBCNT(unsigned Size
) const {
101 return (getGeneration() >= EVERGREEN
);
106 bool hasBORROW() const {
107 return (getGeneration() >= EVERGREEN
);
110 bool hasCARRY() const {
111 return (getGeneration() >= EVERGREEN
);
114 bool hasCaymanISA() const {
118 bool hasFFBL() const {
119 return (getGeneration() >= EVERGREEN
);
122 bool hasFFBH() const {
123 return (getGeneration() >= EVERGREEN
);
126 bool hasFMA() const { return FMA
; }
128 bool hasCFAluBug() const { return CFALUBug
; }
130 bool hasVertexCache() const { return HasVertexCache
; }
132 short getTexVTXClauseSize() const { return TexVTXClauseSize
; }
134 bool enableMachineScheduler() const override
{
138 bool enableSubRegLiveness() const override
{
142 /// \returns Maximum number of work groups per compute unit supported by the
143 /// subtarget and limited by given \p FlatWorkGroupSize.
144 unsigned getMaxWorkGroupsPerCU(unsigned FlatWorkGroupSize
) const override
{
145 return AMDGPU::IsaInfo::getMaxWorkGroupsPerCU(this, FlatWorkGroupSize
);
148 /// \returns Minimum flat work group size supported by the subtarget.
149 unsigned getMinFlatWorkGroupSize() const override
{
150 return AMDGPU::IsaInfo::getMinFlatWorkGroupSize(this);
153 /// \returns Maximum flat work group size supported by the subtarget.
154 unsigned getMaxFlatWorkGroupSize() const override
{
155 return AMDGPU::IsaInfo::getMaxFlatWorkGroupSize(this);
158 /// \returns Number of waves per execution unit required to support the given
159 /// \p FlatWorkGroupSize.
161 getWavesPerEUForWorkGroup(unsigned FlatWorkGroupSize
) const override
{
162 return AMDGPU::IsaInfo::getWavesPerEUForWorkGroup(this, FlatWorkGroupSize
);
165 /// \returns Minimum number of waves per execution unit supported by the
167 unsigned getMinWavesPerEU() const override
{
168 return AMDGPU::IsaInfo::getMinWavesPerEU(this);
172 } // end namespace llvm
174 #endif // LLVM_LIB_TARGET_AMDGPU_R600SUBTARGET_H