blob: d4b6a5fe8020b34a4a009fb962550ca878e97bed [file] [log] [blame]
Matt Arsenault0c90e952015-11-06 18:17:45 +00001//=====-- AMDGPUSubtarget.h - Define Subtarget for AMDGPU ------*- C++ -*-====//
Tom Stellard75aadc22012-12-11 21:25:42 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//==-----------------------------------------------------------------------===//
9//
10/// \file
11/// \brief AMDGPU specific subclass of TargetSubtarget.
12//
13//===----------------------------------------------------------------------===//
14
Matt Arsenault0c90e952015-11-06 18:17:45 +000015#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUSUBTARGET_H
16#define LLVM_LIB_TARGET_AMDGPU_AMDGPUSUBTARGET_H
Matt Arsenaultf59e5382015-11-06 18:23:00 +000017
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000018#include "AMDGPU.h"
Matt Arsenault43e92fe2016-06-24 06:30:11 +000019#include "R600FrameLowering.h"
Chandler Carruth6bda14b2017-06-06 11:49:48 +000020#include "R600ISelLowering.h"
21#include "R600InstrInfo.h"
Matt Arsenault43e92fe2016-06-24 06:30:11 +000022#include "SIFrameLowering.h"
Chandler Carruth6bda14b2017-06-06 11:49:48 +000023#include "SIISelLowering.h"
24#include "SIInstrInfo.h"
Valery Pykhtinfd4c4102017-03-21 13:15:46 +000025#include "SIMachineFunctionInfo.h"
Tom Stellard347ac792015-06-26 21:15:07 +000026#include "Utils/AMDGPUBaseInfo.h"
Eugene Zelenko2bc2f332016-12-09 22:06:55 +000027#include "llvm/ADT/Triple.h"
Tom Stellard000c5af2016-04-14 19:09:28 +000028#include "llvm/CodeGen/GlobalISel/GISelAccessor.h"
Eugene Zelenko2bc2f332016-12-09 22:06:55 +000029#include "llvm/CodeGen/MachineFunction.h"
Matt Arsenault56684d42016-08-11 17:31:42 +000030#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
Eugene Zelenko2bc2f332016-12-09 22:06:55 +000031#include "llvm/MC/MCInstrItineraries.h"
32#include "llvm/Support/MathExtras.h"
33#include <cassert>
34#include <cstdint>
35#include <memory>
36#include <utility>
Tom Stellard75aadc22012-12-11 21:25:42 +000037
38#define GET_SUBTARGETINFO_HEADER
39#include "AMDGPUGenSubtargetInfo.inc"
40
Tom Stellard75aadc22012-12-11 21:25:42 +000041namespace llvm {
42
Matt Arsenault43e92fe2016-06-24 06:30:11 +000043class StringRef;
Tom Stellarde99fb652015-01-20 19:33:04 +000044
Tom Stellard75aadc22012-12-11 21:25:42 +000045class AMDGPUSubtarget : public AMDGPUGenSubtargetInfo {
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000046public:
47 enum Generation {
48 R600 = 0,
49 R700,
50 EVERGREEN,
51 NORTHERN_ISLANDS,
Tom Stellard6e1ee472013-10-29 16:37:28 +000052 SOUTHERN_ISLANDS,
Marek Olsak5df00d62014-12-07 12:18:57 +000053 SEA_ISLANDS,
54 VOLCANIC_ISLANDS,
Matt Arsenaulte823d922017-02-18 18:29:53 +000055 GFX9,
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000056 };
57
Marek Olsak4d00dd22015-03-09 15:48:09 +000058 enum {
Tom Stellard347ac792015-06-26 21:15:07 +000059 ISAVersion0_0_0,
Wei Ding7c3e5112017-06-10 03:53:19 +000060 ISAVersion6_0_0,
61 ISAVersion6_0_1,
Tom Stellard347ac792015-06-26 21:15:07 +000062 ISAVersion7_0_0,
63 ISAVersion7_0_1,
Yaxun Liu94add852016-10-26 16:37:56 +000064 ISAVersion7_0_2,
Wei Ding7c3e5112017-06-10 03:53:19 +000065 ISAVersion7_0_3,
Tom Stellard347ac792015-06-26 21:15:07 +000066 ISAVersion8_0_0,
Changpeng Fangc16be002016-01-13 20:39:25 +000067 ISAVersion8_0_1,
Changpeng Fang98317d22016-10-11 16:00:47 +000068 ISAVersion8_0_2,
Yaxun Liu94add852016-10-26 16:37:56 +000069 ISAVersion8_0_3,
70 ISAVersion8_0_4,
71 ISAVersion8_1_0,
Matt Arsenaulte823d922017-02-18 18:29:53 +000072 ISAVersion9_0_0,
Wei Ding7c3e5112017-06-10 03:53:19 +000073 ISAVersion9_0_1,
74 ISAVersion9_0_2,
75 ISAVersion9_0_3
Tom Stellard347ac792015-06-26 21:15:07 +000076 };
77
Wei Ding205bfdb2017-02-10 02:15:29 +000078 enum TrapHandlerAbi {
79 TrapHandlerAbiNone = 0,
80 TrapHandlerAbiHsa = 1
81 };
82
Wei Dingf2cce022017-02-22 23:22:19 +000083 enum TrapID {
84 TrapIDHardwareReserved = 0,
85 TrapIDHSADebugTrap = 1,
86 TrapIDLLVMTrap = 2,
87 TrapIDLLVMDebugTrap = 3,
88 TrapIDDebugBreakpoint = 7,
89 TrapIDDebugReserved8 = 8,
90 TrapIDDebugReservedFE = 0xfe,
91 TrapIDDebugReservedFF = 0xff
Wei Ding205bfdb2017-02-10 02:15:29 +000092 };
93
94 enum TrapRegValues {
Wei Dingf2cce022017-02-22 23:22:19 +000095 LLVMTrapHandlerRegValue = 1
Wei Ding205bfdb2017-02-10 02:15:29 +000096 };
97
Matt Arsenault43e92fe2016-06-24 06:30:11 +000098protected:
99 // Basic subtarget description.
100 Triple TargetTriple;
Matt Arsenaultd782d052014-06-27 17:57:00 +0000101 Generation Gen;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000102 unsigned IsaVersion;
103 unsigned WavefrontSize;
104 int LocalMemorySize;
105 int LDSBankCount;
106 unsigned MaxPrivateElementSize;
107
108 // Possibly statically set by tablegen, but may want to be overridden.
Matt Arsenaultb035a572015-01-29 19:34:25 +0000109 bool FastFMAF32;
Matt Arsenaulte83690c2016-01-18 21:13:50 +0000110 bool HalfRate64Ops;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000111
112 // Dynamially set bits that enable features.
113 bool FP32Denormals;
Matt Arsenaulta6867fd2017-01-23 22:31:03 +0000114 bool FP64FP16Denormals;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000115 bool FPExceptions;
Matt Arsenault2fdf2a12017-02-21 23:35:48 +0000116 bool DX10Clamp;
Changpeng Fangb41574a2015-12-22 20:55:23 +0000117 bool FlatForGlobal;
Konstantin Zhuravlyovbe6c0ca2017-06-02 17:40:26 +0000118 bool AutoWaitcntBeforeBarrier;
Tom Stellard64a9d082016-10-14 18:10:39 +0000119 bool UnalignedScratchAccess;
Matt Arsenault7f681ac2016-07-01 23:03:44 +0000120 bool UnalignedBufferAccess;
Matt Arsenaulte823d922017-02-18 18:29:53 +0000121 bool HasApertureRegs;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000122 bool EnableXNACK;
Wei Ding205bfdb2017-02-10 02:15:29 +0000123 bool TrapHandler;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000124 bool DebuggerInsertNops;
125 bool DebuggerReserveRegs;
Konstantin Zhuravlyovf2f3d142016-06-25 03:11:28 +0000126 bool DebuggerEmitPrologue;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000127
128 // Used as options.
129 bool EnableVGPRSpilling;
Matt Arsenaultd9a23ab2014-07-13 02:08:26 +0000130 bool EnablePromoteAlloca;
Matt Arsenault41033282014-10-10 22:01:59 +0000131 bool EnableLoadStoreOpt;
Matt Arsenault706f9302015-07-06 16:01:58 +0000132 bool EnableUnsafeDSOffsetFolding;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000133 bool EnableSIScheduler;
134 bool DumpCode;
135
136 // Subtarget statically properties set by tablegen
137 bool FP64;
Tom Stellardd7e6f132015-04-08 01:09:26 +0000138 bool IsGCN;
139 bool GCN1Encoding;
140 bool GCN3Encoding;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000141 bool CIInsts;
Matt Arsenault2021f082017-02-18 19:12:26 +0000142 bool GFX9Insts;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000143 bool SGPRInitBug;
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000144 bool HasSMemRealTime;
145 bool Has16BitInsts;
Matt Arsenault9be7b0d2017-02-27 18:49:11 +0000146 bool HasVOP3PInsts;
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000147 bool HasMovrel;
148 bool HasVGPRIndexMode;
Matt Arsenault7b647552016-10-28 21:55:15 +0000149 bool HasScalarStores;
Matt Arsenaultc88ba362016-10-29 04:05:06 +0000150 bool HasInv2PiInlineImm;
Sam Kolton07dbde22017-01-20 10:01:25 +0000151 bool HasSDWA;
Sam Kolton3c4933f2017-06-22 06:26:41 +0000152 bool HasSDWAOmod;
153 bool HasSDWAScalar;
154 bool HasSDWASdst;
155 bool HasSDWAMac;
Sam Koltona179d252017-06-27 15:02:23 +0000156 bool HasSDWAOutModsVOPC;
Sam Kolton07dbde22017-01-20 10:01:25 +0000157 bool HasDPP;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000158 bool FlatAddressSpace;
Matt Arsenaultacdc7652017-05-10 21:19:05 +0000159 bool FlatInstOffsets;
160 bool FlatGlobalInsts;
161 bool FlatScratchInsts;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000162 bool R600ALUInst;
163 bool CaymanISA;
164 bool CFALUBug;
165 bool HasVertexCache;
166 short TexVTXClauseSize;
Alexander Timofeev18009562016-12-08 17:28:47 +0000167 bool ScalarizeGlobal;
Tom Stellard75aadc22012-12-11 21:25:42 +0000168
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000169 // Dummy feature to use for assembler in tablegen.
170 bool FeatureDisable;
171
Tom Stellard75aadc22012-12-11 21:25:42 +0000172 InstrItineraryData InstrItins;
Matt Arsenault56684d42016-08-11 17:31:42 +0000173 SelectionDAGTargetInfo TSInfo;
Yaxun Liu1a14bfa2017-03-27 14:04:01 +0000174 AMDGPUAS AS;
Tom Stellard75aadc22012-12-11 21:25:42 +0000175
176public:
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000177 AMDGPUSubtarget(const Triple &TT, StringRef GPU, StringRef FS,
178 const TargetMachine &TM);
Eugene Zelenko2bc2f332016-12-09 22:06:55 +0000179 ~AMDGPUSubtarget() override;
180
Daniel Sandersa73f1fd2015-06-10 12:11:26 +0000181 AMDGPUSubtarget &initializeSubtargetDependencies(const Triple &TT,
182 StringRef GPU, StringRef FS);
Tom Stellard75aadc22012-12-11 21:25:42 +0000183
Matt Arsenaultf9245b72016-07-22 17:01:25 +0000184 const AMDGPUInstrInfo *getInstrInfo() const override = 0;
185 const AMDGPUFrameLowering *getFrameLowering() const override = 0;
186 const AMDGPUTargetLowering *getTargetLowering() const override = 0;
187 const AMDGPURegisterInfo *getRegisterInfo() const override = 0;
Tom Stellard000c5af2016-04-14 19:09:28 +0000188
Eric Christopherd9134482014-08-04 21:25:23 +0000189 const InstrItineraryData *getInstrItineraryData() const override {
190 return &InstrItins;
191 }
Matt Arsenaultd782d052014-06-27 17:57:00 +0000192
Matt Arsenault56684d42016-08-11 17:31:42 +0000193 // Nothing implemented, just prevent crashes on use.
194 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
195 return &TSInfo;
196 }
197
Craig Topperee7b0f32014-04-30 05:53:27 +0000198 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
Tom Stellard75aadc22012-12-11 21:25:42 +0000199
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000200 bool isAmdHsaOS() const {
201 return TargetTriple.getOS() == Triple::AMDHSA;
Matt Arsenaultd782d052014-06-27 17:57:00 +0000202 }
203
Tom Stellard0b76fc4c2016-09-16 21:34:26 +0000204 bool isMesa3DOS() const {
205 return TargetTriple.getOS() == Triple::Mesa3D;
206 }
207
Tom Stellarde88bbc32016-09-23 01:33:26 +0000208 bool isOpenCLEnv() const {
Yaxun Liua618acf2017-06-01 21:31:53 +0000209 return TargetTriple.getEnvironment() == Triple::OpenCL ||
210 TargetTriple.getEnvironmentName() == "amdgizcl";
Tom Stellarde88bbc32016-09-23 01:33:26 +0000211 }
212
Matt Arsenaultd782d052014-06-27 17:57:00 +0000213 Generation getGeneration() const {
214 return Gen;
215 }
216
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000217 unsigned getWavefrontSize() const {
218 return WavefrontSize;
219 }
220
221 int getLocalMemorySize() const {
222 return LocalMemorySize;
223 }
224
225 int getLDSBankCount() const {
226 return LDSBankCount;
227 }
228
229 unsigned getMaxPrivateElementSize() const {
230 return MaxPrivateElementSize;
231 }
232
Yaxun Liu1a14bfa2017-03-27 14:04:01 +0000233 AMDGPUAS getAMDGPUAS() const {
234 return AS;
235 }
236
Konstantin Zhuravlyovd971a112016-11-01 17:49:33 +0000237 bool has16BitInsts() const {
238 return Has16BitInsts;
239 }
240
Matt Arsenault9be7b0d2017-02-27 18:49:11 +0000241 bool hasVOP3PInsts() const {
242 return HasVOP3PInsts;
243 }
244
Matt Arsenaultd782d052014-06-27 17:57:00 +0000245 bool hasHWFP64() const {
246 return FP64;
247 }
248
Matt Arsenaultb035a572015-01-29 19:34:25 +0000249 bool hasFastFMAF32() const {
250 return FastFMAF32;
251 }
252
Matt Arsenaulte83690c2016-01-18 21:13:50 +0000253 bool hasHalfRate64Ops() const {
254 return HalfRate64Ops;
255 }
256
Matt Arsenault88701812016-06-09 23:42:48 +0000257 bool hasAddr64() const {
258 return (getGeneration() < VOLCANIC_ISLANDS);
259 }
260
Matt Arsenaultfae02982014-03-17 18:58:11 +0000261 bool hasBFE() const {
262 return (getGeneration() >= EVERGREEN);
263 }
264
Matt Arsenault6e439652014-06-10 19:00:20 +0000265 bool hasBFI() const {
266 return (getGeneration() >= EVERGREEN);
267 }
268
Matt Arsenaultfae02982014-03-17 18:58:11 +0000269 bool hasBFM() const {
270 return hasBFE();
271 }
272
Matt Arsenault60425062014-06-10 19:18:28 +0000273 bool hasBCNT(unsigned Size) const {
274 if (Size == 32)
275 return (getGeneration() >= EVERGREEN);
276
Matt Arsenault3dd43fc2014-07-18 06:07:13 +0000277 if (Size == 64)
278 return (getGeneration() >= SOUTHERN_ISLANDS);
279
280 return false;
Matt Arsenault60425062014-06-10 19:18:28 +0000281 }
282
Tom Stellard50122a52014-04-07 19:45:41 +0000283 bool hasMulU24() const {
284 return (getGeneration() >= EVERGREEN);
285 }
286
287 bool hasMulI24() const {
288 return (getGeneration() >= SOUTHERN_ISLANDS ||
289 hasCaymanISA());
290 }
291
Jan Vesely6ddb8dd2014-07-15 15:51:09 +0000292 bool hasFFBL() const {
293 return (getGeneration() >= EVERGREEN);
294 }
295
296 bool hasFFBH() const {
297 return (getGeneration() >= EVERGREEN);
298 }
299
Matt Arsenault10268f92017-02-27 22:40:39 +0000300 bool hasMed3_16() const {
301 return getGeneration() >= GFX9;
302 }
303
Matt Arsenaultee324ff2017-05-17 19:25:06 +0000304 bool hasMin3Max3_16() const {
305 return getGeneration() >= GFX9;
306 }
307
Jan Vesely808fff52015-04-30 17:15:56 +0000308 bool hasCARRY() const {
309 return (getGeneration() >= EVERGREEN);
310 }
311
312 bool hasBORROW() const {
313 return (getGeneration() >= EVERGREEN);
314 }
315
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000316 bool hasCaymanISA() const {
317 return CaymanISA;
318 }
319
Wei Ding205bfdb2017-02-10 02:15:29 +0000320 TrapHandlerAbi getTrapHandlerAbi() const {
321 return isAmdHsaOS() ? TrapHandlerAbiHsa : TrapHandlerAbiNone;
322 }
323
Matt Arsenaultd9a23ab2014-07-13 02:08:26 +0000324 bool isPromoteAllocaEnabled() const {
325 return EnablePromoteAlloca;
326 }
327
Matt Arsenault706f9302015-07-06 16:01:58 +0000328 bool unsafeDSOffsetFoldingEnabled() const {
329 return EnableUnsafeDSOffsetFolding;
330 }
331
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000332 bool dumpCode() const {
333 return DumpCode;
Matt Arsenaultd782d052014-06-27 17:57:00 +0000334 }
335
Matt Arsenault8a028bf2016-05-16 21:19:59 +0000336 /// Return the amount of LDS that can be used that will not restrict the
337 /// occupancy lower than WaveCount.
Stanislav Mekhanoshin2b913b12017-02-01 22:59:50 +0000338 unsigned getMaxLocalMemSizeWithWaveCount(unsigned WaveCount,
339 const Function &) const;
Matt Arsenault8a028bf2016-05-16 21:19:59 +0000340
341 /// Inverse of getMaxLocalMemWithWaveCount. Return the maximum wavecount if
342 /// the given LDS memory size is the only constraint.
Stanislav Mekhanoshin2b913b12017-02-01 22:59:50 +0000343 unsigned getOccupancyWithLocalMemSize(uint32_t Bytes, const Function &) const;
Matt Arsenault8a028bf2016-05-16 21:19:59 +0000344
Valery Pykhtinfd4c4102017-03-21 13:15:46 +0000345 unsigned getOccupancyWithLocalMemSize(const MachineFunction &MF) const {
346 const auto *MFI = MF.getInfo<SIMachineFunctionInfo>();
347 return getOccupancyWithLocalMemSize(MFI->getLDSSize(), *MF.getFunction());
348 }
349
Konstantin Zhuravlyovf86e4b72016-11-13 07:01:11 +0000350 bool hasFP16Denormals() const {
Matt Arsenaulta6867fd2017-01-23 22:31:03 +0000351 return FP64FP16Denormals;
Konstantin Zhuravlyovf86e4b72016-11-13 07:01:11 +0000352 }
Matt Arsenault8a028bf2016-05-16 21:19:59 +0000353
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000354 bool hasFP32Denormals() const {
355 return FP32Denormals;
Matt Arsenaultd782d052014-06-27 17:57:00 +0000356 }
Tom Stellard75aadc22012-12-11 21:25:42 +0000357
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000358 bool hasFP64Denormals() const {
Matt Arsenaulta6867fd2017-01-23 22:31:03 +0000359 return FP64FP16Denormals;
Matt Arsenault24ee0782016-02-12 02:40:47 +0000360 }
361
Stanislav Mekhanoshindc2890a2017-07-13 23:59:15 +0000362 bool supportsMinMaxDenormModes() const {
363 return getGeneration() >= AMDGPUSubtarget::GFX9;
364 }
365
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000366 bool hasFPExceptions() const {
367 return FPExceptions;
Marek Olsak4d00dd22015-03-09 15:48:09 +0000368 }
369
Matt Arsenault2fdf2a12017-02-21 23:35:48 +0000370 bool enableDX10Clamp() const {
371 return DX10Clamp;
372 }
373
374 bool enableIEEEBit(const MachineFunction &MF) const {
375 return AMDGPU::isCompute(MF.getFunction()->getCallingConv());
376 }
377
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000378 bool useFlatForGlobal() const {
379 return FlatForGlobal;
Tom Stellardec87f842015-05-25 16:15:54 +0000380 }
381
Konstantin Zhuravlyovbe6c0ca2017-06-02 17:40:26 +0000382 bool hasAutoWaitcntBeforeBarrier() const {
383 return AutoWaitcntBeforeBarrier;
384 }
385
Matt Arsenault7f681ac2016-07-01 23:03:44 +0000386 bool hasUnalignedBufferAccess() const {
387 return UnalignedBufferAccess;
388 }
389
Tom Stellard64a9d082016-10-14 18:10:39 +0000390 bool hasUnalignedScratchAccess() const {
391 return UnalignedScratchAccess;
392 }
393
Matt Arsenaulte823d922017-02-18 18:29:53 +0000394 bool hasApertureRegs() const {
395 return HasApertureRegs;
396 }
397
Wei Ding205bfdb2017-02-10 02:15:29 +0000398 bool isTrapHandlerEnabled() const {
399 return TrapHandler;
400 }
401
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000402 bool isXNACKEnabled() const {
403 return EnableXNACK;
404 }
Tom Stellardb8fd6ef2014-12-02 22:00:07 +0000405
Matt Arsenaultb6491cc2017-01-31 01:20:54 +0000406 bool hasFlatAddressSpace() const {
407 return FlatAddressSpace;
408 }
409
Matt Arsenaultacdc7652017-05-10 21:19:05 +0000410 bool hasFlatInstOffsets() const {
411 return FlatInstOffsets;
412 }
413
414 bool hasFlatGlobalInsts() const {
415 return FlatGlobalInsts;
416 }
417
418 bool hasFlatScratchInsts() const {
419 return FlatScratchInsts;
420 }
421
Tom Stellard2f3f9852017-01-25 01:25:13 +0000422 bool isMesaKernel(const MachineFunction &MF) const {
423 return isMesa3DOS() && !AMDGPU::isShader(MF.getFunction()->getCallingConv());
424 }
425
426 // Covers VS/PS/CS graphics shaders
427 bool isMesaGfxShader(const MachineFunction &MF) const {
428 return isMesa3DOS() && AMDGPU::isShader(MF.getFunction()->getCallingConv());
429 }
430
431 bool isAmdCodeObjectV2(const MachineFunction &MF) const {
432 return isAmdHsaOS() || isMesaKernel(MF);
Tom Stellard0b76fc4c2016-09-16 21:34:26 +0000433 }
434
Matt Arsenaultda7a6562017-02-01 00:42:40 +0000435 bool hasFminFmaxLegacy() const {
436 return getGeneration() < AMDGPUSubtarget::VOLCANIC_ISLANDS;
437 }
438
Stanislav Mekhanoshin53a21292017-05-23 19:54:48 +0000439 bool hasSDWA() const {
440 return HasSDWA;
441 }
442
Sam Kolton3c4933f2017-06-22 06:26:41 +0000443 bool hasSDWAOmod() const {
444 return HasSDWAOmod;
445 }
446
447 bool hasSDWAScalar() const {
448 return HasSDWAScalar;
449 }
450
451 bool hasSDWASdst() const {
452 return HasSDWASdst;
453 }
454
455 bool hasSDWAMac() const {
456 return HasSDWAMac;
457 }
458
Sam Koltona179d252017-06-27 15:02:23 +0000459 bool hasSDWAOutModsVOPC() const {
460 return HasSDWAOutModsVOPC;
Sam Kolton3c4933f2017-06-22 06:26:41 +0000461 }
462
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000463 /// \brief Returns the offset in bytes from the start of the input buffer
464 /// of the first explicit kernel argument.
Tom Stellard2f3f9852017-01-25 01:25:13 +0000465 unsigned getExplicitKernelArgOffset(const MachineFunction &MF) const {
466 return isAmdCodeObjectV2(MF) ? 0 : 36;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000467 }
468
Tom Stellardb2869eb2016-09-09 19:28:00 +0000469 unsigned getAlignmentForImplicitArgPtr() const {
470 return isAmdHsaOS() ? 8 : 4;
471 }
472
Tom Stellard2f3f9852017-01-25 01:25:13 +0000473 unsigned getImplicitArgNumBytes(const MachineFunction &MF) const {
474 if (isMesaKernel(MF))
Tom Stellarde88bbc32016-09-23 01:33:26 +0000475 return 16;
476 if (isAmdHsaOS() && isOpenCLEnv())
477 return 32;
478 return 0;
479 }
480
Matt Arsenault869fec22017-04-17 19:48:24 +0000481 // Scratch is allocated in 256 dword per wave blocks for the entire
482 // wavefront. When viewed from the perspecive of an arbitrary workitem, this
483 // is 4-byte aligned.
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000484 unsigned getStackAlignment() const {
Matt Arsenault869fec22017-04-17 19:48:24 +0000485 return 4;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000486 }
Tom Stellard347ac792015-06-26 21:15:07 +0000487
Craig Topper5656db42014-04-29 07:57:24 +0000488 bool enableMachineScheduler() const override {
Tom Stellard83f0bce2015-01-29 16:55:25 +0000489 return true;
Andrew Trick978674b2013-09-20 05:14:41 +0000490 }
491
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000492 bool enableSubRegLiveness() const override {
493 return true;
494 }
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000495
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000496 void setScalarizeGlobalBehavior(bool b) { ScalarizeGlobal = b;}
497 bool getScalarizeGlobalBehavior() const { return ScalarizeGlobal;}
498
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000499 /// \returns Number of execution units per compute unit supported by the
500 /// subtarget.
501 unsigned getEUsPerCU() const {
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000502 return AMDGPU::IsaInfo::getEUsPerCU(getFeatureBits());
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000503 }
504
505 /// \returns Maximum number of work groups per compute unit supported by the
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000506 /// subtarget and limited by given \p FlatWorkGroupSize.
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000507 unsigned getMaxWorkGroupsPerCU(unsigned FlatWorkGroupSize) const {
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000508 return AMDGPU::IsaInfo::getMaxWorkGroupsPerCU(getFeatureBits(),
509 FlatWorkGroupSize);
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000510 }
511
512 /// \returns Maximum number of waves per compute unit supported by the
513 /// subtarget without any kind of limitation.
514 unsigned getMaxWavesPerCU() const {
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000515 return AMDGPU::IsaInfo::getMaxWavesPerCU(getFeatureBits());
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000516 }
517
518 /// \returns Maximum number of waves per compute unit supported by the
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000519 /// subtarget and limited by given \p FlatWorkGroupSize.
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000520 unsigned getMaxWavesPerCU(unsigned FlatWorkGroupSize) const {
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000521 return AMDGPU::IsaInfo::getMaxWavesPerCU(getFeatureBits(),
522 FlatWorkGroupSize);
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000523 }
524
525 /// \returns Minimum number of waves per execution unit supported by the
526 /// subtarget.
527 unsigned getMinWavesPerEU() const {
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000528 return AMDGPU::IsaInfo::getMinWavesPerEU(getFeatureBits());
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000529 }
530
531 /// \returns Maximum number of waves per execution unit supported by the
532 /// subtarget without any kind of limitation.
533 unsigned getMaxWavesPerEU() const {
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000534 return AMDGPU::IsaInfo::getMaxWavesPerEU(getFeatureBits());
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000535 }
536
537 /// \returns Maximum number of waves per execution unit supported by the
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000538 /// subtarget and limited by given \p FlatWorkGroupSize.
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000539 unsigned getMaxWavesPerEU(unsigned FlatWorkGroupSize) const {
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000540 return AMDGPU::IsaInfo::getMaxWavesPerEU(getFeatureBits(),
541 FlatWorkGroupSize);
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000542 }
543
544 /// \returns Minimum flat work group size supported by the subtarget.
545 unsigned getMinFlatWorkGroupSize() const {
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000546 return AMDGPU::IsaInfo::getMinFlatWorkGroupSize(getFeatureBits());
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000547 }
548
549 /// \returns Maximum flat work group size supported by the subtarget.
550 unsigned getMaxFlatWorkGroupSize() const {
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000551 return AMDGPU::IsaInfo::getMaxFlatWorkGroupSize(getFeatureBits());
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000552 }
553
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000554 /// \returns Number of waves per work group supported by the subtarget and
555 /// limited by given \p FlatWorkGroupSize.
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000556 unsigned getWavesPerWorkGroup(unsigned FlatWorkGroupSize) const {
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000557 return AMDGPU::IsaInfo::getWavesPerWorkGroup(getFeatureBits(),
558 FlatWorkGroupSize);
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000559 }
560
561 /// \returns Subtarget's default pair of minimum/maximum flat work group sizes
562 /// for function \p F, or minimum/maximum flat work group sizes explicitly
563 /// requested using "amdgpu-flat-work-group-size" attribute attached to
564 /// function \p F.
565 ///
566 /// \returns Subtarget's default values if explicitly requested values cannot
567 /// be converted to integer, or violate subtarget's specifications.
568 std::pair<unsigned, unsigned> getFlatWorkGroupSizes(const Function &F) const;
569
570 /// \returns Subtarget's default pair of minimum/maximum number of waves per
571 /// execution unit for function \p F, or minimum/maximum number of waves per
572 /// execution unit explicitly requested using "amdgpu-waves-per-eu" attribute
573 /// attached to function \p F.
574 ///
575 /// \returns Subtarget's default values if explicitly requested values cannot
576 /// be converted to integer, violate subtarget's specifications, or are not
577 /// compatible with minimum/maximum number of waves limited by flat work group
578 /// size, register usage, and/or lds usage.
579 std::pair<unsigned, unsigned> getWavesPerEU(const Function &F) const;
Stanislav Mekhanoshinc90347d2017-04-12 20:48:56 +0000580
581 /// Creates value range metadata on an workitemid.* inrinsic call or load.
582 bool makeLIDRangeMetadata(Instruction *I) const;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000583};
584
585class R600Subtarget final : public AMDGPUSubtarget {
586private:
587 R600InstrInfo InstrInfo;
588 R600FrameLowering FrameLowering;
589 R600TargetLowering TLInfo;
590
591public:
592 R600Subtarget(const Triple &TT, StringRef CPU, StringRef FS,
593 const TargetMachine &TM);
594
595 const R600InstrInfo *getInstrInfo() const override {
596 return &InstrInfo;
597 }
598
599 const R600FrameLowering *getFrameLowering() const override {
600 return &FrameLowering;
601 }
602
603 const R600TargetLowering *getTargetLowering() const override {
604 return &TLInfo;
605 }
606
607 const R600RegisterInfo *getRegisterInfo() const override {
608 return &InstrInfo.getRegisterInfo();
609 }
610
611 bool hasCFAluBug() const {
612 return CFALUBug;
613 }
614
615 bool hasVertexCache() const {
616 return HasVertexCache;
617 }
618
619 short getTexVTXClauseSize() const {
620 return TexVTXClauseSize;
621 }
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000622};
623
624class SISubtarget final : public AMDGPUSubtarget {
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000625private:
626 SIInstrInfo InstrInfo;
627 SIFrameLowering FrameLowering;
628 SITargetLowering TLInfo;
629 std::unique_ptr<GISelAccessor> GISel;
630
631public:
632 SISubtarget(const Triple &TT, StringRef CPU, StringRef FS,
633 const TargetMachine &TM);
634
635 const SIInstrInfo *getInstrInfo() const override {
636 return &InstrInfo;
637 }
638
639 const SIFrameLowering *getFrameLowering() const override {
640 return &FrameLowering;
641 }
642
643 const SITargetLowering *getTargetLowering() const override {
644 return &TLInfo;
645 }
646
647 const CallLowering *getCallLowering() const override {
648 assert(GISel && "Access to GlobalISel APIs not set");
649 return GISel->getCallLowering();
650 }
651
Tom Stellardca166212017-01-30 21:56:46 +0000652 const InstructionSelector *getInstructionSelector() const override {
653 assert(GISel && "Access to GlobalISel APIs not set");
654 return GISel->getInstructionSelector();
655 }
656
657 const LegalizerInfo *getLegalizerInfo() const override {
658 assert(GISel && "Access to GlobalISel APIs not set");
659 return GISel->getLegalizerInfo();
660 }
661
662 const RegisterBankInfo *getRegBankInfo() const override {
663 assert(GISel && "Access to GlobalISel APIs not set");
664 return GISel->getRegBankInfo();
665 }
666
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000667 const SIRegisterInfo *getRegisterInfo() const override {
668 return &InstrInfo.getRegisterInfo();
669 }
670
671 void setGISelAccessor(GISelAccessor &GISel) {
672 this->GISel.reset(&GISel);
673 }
674
Matt Arsenault9f5e0ef2017-01-25 04:25:02 +0000675 // XXX - Why is this here if it isn't in the default pass set?
676 bool enableEarlyIfConversion() const override {
677 return true;
678 }
679
Tom Stellard83f0bce2015-01-29 16:55:25 +0000680 void overrideSchedPolicy(MachineSchedPolicy &Policy,
Tom Stellard83f0bce2015-01-29 16:55:25 +0000681 unsigned NumRegionInstrs) const override;
682
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000683 bool isVGPRSpillingEnabled(const Function& F) const;
684
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000685 unsigned getMaxNumUserSGPRs() const {
686 return 16;
687 }
688
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000689 bool hasSMemRealTime() const {
690 return HasSMemRealTime;
691 }
692
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000693 bool hasMovrel() const {
694 return HasMovrel;
695 }
696
697 bool hasVGPRIndexMode() const {
698 return HasVGPRIndexMode;
699 }
700
Marek Olsake22fdb92017-03-21 17:00:32 +0000701 bool useVGPRIndexMode(bool UserEnable) const {
702 return !hasMovrel() || (UserEnable && hasVGPRIndexMode());
703 }
704
Matt Arsenault7b1dc2c2016-09-17 02:02:19 +0000705 bool hasScalarCompareEq64() const {
706 return getGeneration() >= VOLCANIC_ISLANDS;
707 }
708
Matt Arsenault7b647552016-10-28 21:55:15 +0000709 bool hasScalarStores() const {
710 return HasScalarStores;
711 }
712
Matt Arsenaultc88ba362016-10-29 04:05:06 +0000713 bool hasInv2PiInlineImm() const {
714 return HasInv2PiInlineImm;
715 }
716
Sam Kolton07dbde22017-01-20 10:01:25 +0000717 bool hasDPP() const {
718 return HasDPP;
719 }
720
Tom Stellardde008d32016-01-21 04:28:34 +0000721 bool enableSIScheduler() const {
722 return EnableSIScheduler;
723 }
724
Konstantin Zhuravlyovf2f3d142016-06-25 03:11:28 +0000725 bool debuggerSupported() const {
726 return debuggerInsertNops() && debuggerReserveRegs() &&
727 debuggerEmitPrologue();
728 }
729
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000730 bool debuggerInsertNops() const {
731 return DebuggerInsertNops;
732 }
733
Konstantin Zhuravlyov29ddd2b2016-05-24 18:37:18 +0000734 bool debuggerReserveRegs() const {
735 return DebuggerReserveRegs;
Konstantin Zhuravlyov1d99c4d2016-04-26 15:43:14 +0000736 }
737
Konstantin Zhuravlyovf2f3d142016-06-25 03:11:28 +0000738 bool debuggerEmitPrologue() const {
739 return DebuggerEmitPrologue;
740 }
741
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000742 bool loadStoreOptEnabled() const {
743 return EnableLoadStoreOpt;
Nicolai Haehnle5b504972016-01-04 23:35:53 +0000744 }
745
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000746 bool hasSGPRInitBug() const {
747 return SGPRInitBug;
Matt Arsenault41003af2015-11-30 21:16:07 +0000748 }
Tom Stellard0d23ebe2016-08-29 19:42:52 +0000749
Tom Stellardb133fbb2016-10-27 23:05:31 +0000750 bool has12DWordStoreHazard() const {
751 return getGeneration() != AMDGPUSubtarget::SOUTHERN_ISLANDS;
752 }
753
Matt Arsenaulte823d922017-02-18 18:29:53 +0000754 bool hasSMovFedHazard() const {
755 return getGeneration() >= AMDGPUSubtarget::GFX9;
756 }
757
758 bool hasReadM0Hazard() const {
759 return getGeneration() >= AMDGPUSubtarget::GFX9;
760 }
761
Tom Stellard2f3f9852017-01-25 01:25:13 +0000762 unsigned getKernArgSegmentSize(const MachineFunction &MF, unsigned ExplictArgBytes) const;
Tom Stellarde88bbc32016-09-23 01:33:26 +0000763
Tom Stellard0d23ebe2016-08-29 19:42:52 +0000764 /// Return the maximum number of waves per SIMD for kernels using \p SGPRs SGPRs
765 unsigned getOccupancyWithNumSGPRs(unsigned SGPRs) const;
766
767 /// Return the maximum number of waves per SIMD for kernels using \p VGPRs VGPRs
768 unsigned getOccupancyWithNumVGPRs(unsigned VGPRs) const;
Konstantin Zhuravlyovd7bdf242016-09-30 16:50:36 +0000769
Matt Arsenaulte823d922017-02-18 18:29:53 +0000770 /// \returns true if the flat_scratch register should be initialized with the
771 /// pointer to the wave's scratch memory rather than a size and offset.
772 bool flatScratchIsPointer() const {
773 return getGeneration() >= GFX9;
Konstantin Zhuravlyovd7bdf242016-09-30 16:50:36 +0000774 }
Matt Arsenault4eae3012016-10-28 20:31:47 +0000775
Konstantin Zhuravlyove03b1d72017-02-08 13:02:33 +0000776 /// \returns SGPR allocation granularity supported by the subtarget.
777 unsigned getSGPRAllocGranule() const {
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000778 return AMDGPU::IsaInfo::getSGPRAllocGranule(getFeatureBits());
Konstantin Zhuravlyove22fbcb2017-02-08 13:18:40 +0000779 }
780
781 /// \returns SGPR encoding granularity supported by the subtarget.
782 unsigned getSGPREncodingGranule() const {
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000783 return AMDGPU::IsaInfo::getSGPREncodingGranule(getFeatureBits());
Konstantin Zhuravlyove03b1d72017-02-08 13:02:33 +0000784 }
785
786 /// \returns Total number of SGPRs supported by the subtarget.
787 unsigned getTotalNumSGPRs() const {
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000788 return AMDGPU::IsaInfo::getTotalNumSGPRs(getFeatureBits());
Konstantin Zhuravlyove03b1d72017-02-08 13:02:33 +0000789 }
790
791 /// \returns Addressable number of SGPRs supported by the subtarget.
792 unsigned getAddressableNumSGPRs() const {
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000793 return AMDGPU::IsaInfo::getAddressableNumSGPRs(getFeatureBits());
Konstantin Zhuravlyove03b1d72017-02-08 13:02:33 +0000794 }
795
796 /// \returns Minimum number of SGPRs that meets the given number of waves per
797 /// execution unit requirement supported by the subtarget.
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000798 unsigned getMinNumSGPRs(unsigned WavesPerEU) const {
799 return AMDGPU::IsaInfo::getMinNumSGPRs(getFeatureBits(), WavesPerEU);
800 }
Konstantin Zhuravlyove03b1d72017-02-08 13:02:33 +0000801
802 /// \returns Maximum number of SGPRs that meets the given number of waves per
803 /// execution unit requirement supported by the subtarget.
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000804 unsigned getMaxNumSGPRs(unsigned WavesPerEU, bool Addressable) const {
805 return AMDGPU::IsaInfo::getMaxNumSGPRs(getFeatureBits(), WavesPerEU,
806 Addressable);
807 }
Konstantin Zhuravlyove03b1d72017-02-08 13:02:33 +0000808
809 /// \returns Reserved number of SGPRs for given function \p MF.
810 unsigned getReservedNumSGPRs(const MachineFunction &MF) const;
811
812 /// \returns Maximum number of SGPRs that meets number of waves per execution
813 /// unit requirement for function \p MF, or number of SGPRs explicitly
814 /// requested using "amdgpu-num-sgpr" attribute attached to function \p MF.
815 ///
816 /// \returns Value that meets number of waves per execution unit requirement
817 /// if explicitly requested value cannot be converted to integer, violates
818 /// subtarget's specifications, or does not meet number of waves per execution
819 /// unit requirement.
820 unsigned getMaxNumSGPRs(const MachineFunction &MF) const;
821
822 /// \returns VGPR allocation granularity supported by the subtarget.
823 unsigned getVGPRAllocGranule() const {
Mandeep Singh Grang5e1697e2017-06-06 05:08:36 +0000824 return AMDGPU::IsaInfo::getVGPRAllocGranule(getFeatureBits());
Konstantin Zhuravlyove03b1d72017-02-08 13:02:33 +0000825 }
826
Konstantin Zhuravlyove22fbcb2017-02-08 13:18:40 +0000827 /// \returns VGPR encoding granularity supported by the subtarget.
828 unsigned getVGPREncodingGranule() const {
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000829 return AMDGPU::IsaInfo::getVGPREncodingGranule(getFeatureBits());
Konstantin Zhuravlyove22fbcb2017-02-08 13:18:40 +0000830 }
831
Konstantin Zhuravlyove03b1d72017-02-08 13:02:33 +0000832 /// \returns Total number of VGPRs supported by the subtarget.
833 unsigned getTotalNumVGPRs() const {
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000834 return AMDGPU::IsaInfo::getTotalNumVGPRs(getFeatureBits());
Konstantin Zhuravlyove03b1d72017-02-08 13:02:33 +0000835 }
836
837 /// \returns Addressable number of VGPRs supported by the subtarget.
838 unsigned getAddressableNumVGPRs() const {
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000839 return AMDGPU::IsaInfo::getAddressableNumVGPRs(getFeatureBits());
Konstantin Zhuravlyove03b1d72017-02-08 13:02:33 +0000840 }
841
842 /// \returns Minimum number of VGPRs that meets given number of waves per
843 /// execution unit requirement supported by the subtarget.
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000844 unsigned getMinNumVGPRs(unsigned WavesPerEU) const {
845 return AMDGPU::IsaInfo::getMinNumVGPRs(getFeatureBits(), WavesPerEU);
846 }
Konstantin Zhuravlyove03b1d72017-02-08 13:02:33 +0000847
848 /// \returns Maximum number of VGPRs that meets given number of waves per
849 /// execution unit requirement supported by the subtarget.
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000850 unsigned getMaxNumVGPRs(unsigned WavesPerEU) const {
851 return AMDGPU::IsaInfo::getMaxNumVGPRs(getFeatureBits(), WavesPerEU);
852 }
Konstantin Zhuravlyove03b1d72017-02-08 13:02:33 +0000853
854 /// \returns Reserved number of VGPRs for given function \p MF.
855 unsigned getReservedNumVGPRs(const MachineFunction &MF) const {
856 return debuggerReserveRegs() ? 4 : 0;
857 }
858
859 /// \returns Maximum number of VGPRs that meets number of waves per execution
860 /// unit requirement for function \p MF, or number of VGPRs explicitly
861 /// requested using "amdgpu-num-vgpr" attribute attached to function \p MF.
862 ///
863 /// \returns Value that meets number of waves per execution unit requirement
864 /// if explicitly requested value cannot be converted to integer, violates
865 /// subtarget's specifications, or does not meet number of waves per execution
866 /// unit requirement.
867 unsigned getMaxNumVGPRs(const MachineFunction &MF) const;
Tom Stellard75aadc22012-12-11 21:25:42 +0000868};
869
Eugene Zelenko2bc2f332016-12-09 22:06:55 +0000870} // end namespace llvm
Tom Stellard75aadc22012-12-11 21:25:42 +0000871
Eugene Zelenko2bc2f332016-12-09 22:06:55 +0000872#endif // LLVM_LIB_TARGET_AMDGPU_AMDGPUSUBTARGET_H