blob: 5682d9993139b0ca48d7e1d07553c05de0e82051 [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 "R600InstrInfo.h"
20#include "R600ISelLowering.h"
21#include "R600FrameLowering.h"
22#include "SIInstrInfo.h"
23#include "SIISelLowering.h"
24#include "SIFrameLowering.h"
Tom Stellard347ac792015-06-26 21:15:07 +000025#include "Utils/AMDGPUBaseInfo.h"
Tom Stellard000c5af2016-04-14 19:09:28 +000026#include "llvm/CodeGen/GlobalISel/GISelAccessor.h"
Matt Arsenault56684d42016-08-11 17:31:42 +000027#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
Tom Stellard75aadc22012-12-11 21:25:42 +000028#include "llvm/Target/TargetSubtargetInfo.h"
29
30#define GET_SUBTARGETINFO_HEADER
31#include "AMDGPUGenSubtargetInfo.inc"
32
Tom Stellard75aadc22012-12-11 21:25:42 +000033namespace llvm {
34
Tom Stellarde99fb652015-01-20 19:33:04 +000035class SIMachineFunctionInfo;
Matt Arsenault43e92fe2016-06-24 06:30:11 +000036class StringRef;
Tom Stellarde99fb652015-01-20 19:33:04 +000037
Tom Stellard75aadc22012-12-11 21:25:42 +000038class AMDGPUSubtarget : public AMDGPUGenSubtargetInfo {
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000039public:
40 enum Generation {
41 R600 = 0,
42 R700,
43 EVERGREEN,
44 NORTHERN_ISLANDS,
Tom Stellard6e1ee472013-10-29 16:37:28 +000045 SOUTHERN_ISLANDS,
Marek Olsak5df00d62014-12-07 12:18:57 +000046 SEA_ISLANDS,
47 VOLCANIC_ISLANDS,
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000048 };
49
Marek Olsak4d00dd22015-03-09 15:48:09 +000050 enum {
Tom Stellard347ac792015-06-26 21:15:07 +000051 ISAVersion0_0_0,
52 ISAVersion7_0_0,
53 ISAVersion7_0_1,
54 ISAVersion8_0_0,
Changpeng Fangc16be002016-01-13 20:39:25 +000055 ISAVersion8_0_1,
Changpeng Fang98317d22016-10-11 16:00:47 +000056 ISAVersion8_0_2,
Changpeng Fangc16be002016-01-13 20:39:25 +000057 ISAVersion8_0_3
Tom Stellard347ac792015-06-26 21:15:07 +000058 };
59
Matt Arsenault43e92fe2016-06-24 06:30:11 +000060protected:
61 // Basic subtarget description.
62 Triple TargetTriple;
Matt Arsenaultd782d052014-06-27 17:57:00 +000063 Generation Gen;
Matt Arsenault43e92fe2016-06-24 06:30:11 +000064 unsigned IsaVersion;
65 unsigned WavefrontSize;
66 int LocalMemorySize;
67 int LDSBankCount;
68 unsigned MaxPrivateElementSize;
69
70 // Possibly statically set by tablegen, but may want to be overridden.
Matt Arsenaultb035a572015-01-29 19:34:25 +000071 bool FastFMAF32;
Matt Arsenaulte83690c2016-01-18 21:13:50 +000072 bool HalfRate64Ops;
Matt Arsenault43e92fe2016-06-24 06:30:11 +000073
74 // Dynamially set bits that enable features.
75 bool FP32Denormals;
76 bool FP64Denormals;
77 bool FPExceptions;
Changpeng Fangb41574a2015-12-22 20:55:23 +000078 bool FlatForGlobal;
Tom Stellard64a9d082016-10-14 18:10:39 +000079 bool UnalignedScratchAccess;
Matt Arsenault7f681ac2016-07-01 23:03:44 +000080 bool UnalignedBufferAccess;
Matt Arsenault43e92fe2016-06-24 06:30:11 +000081 bool EnableXNACK;
82 bool DebuggerInsertNops;
83 bool DebuggerReserveRegs;
Konstantin Zhuravlyovf2f3d142016-06-25 03:11:28 +000084 bool DebuggerEmitPrologue;
Matt Arsenault43e92fe2016-06-24 06:30:11 +000085
86 // Used as options.
87 bool EnableVGPRSpilling;
Matt Arsenaultd9a23ab2014-07-13 02:08:26 +000088 bool EnablePromoteAlloca;
Matt Arsenault41033282014-10-10 22:01:59 +000089 bool EnableLoadStoreOpt;
Matt Arsenault706f9302015-07-06 16:01:58 +000090 bool EnableUnsafeDSOffsetFolding;
Matt Arsenault43e92fe2016-06-24 06:30:11 +000091 bool EnableSIScheduler;
92 bool DumpCode;
93
94 // Subtarget statically properties set by tablegen
95 bool FP64;
Tom Stellardd7e6f132015-04-08 01:09:26 +000096 bool IsGCN;
97 bool GCN1Encoding;
98 bool GCN3Encoding;
Tom Stellardd1f0f022015-04-23 19:33:54 +000099 bool CIInsts;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000100 bool SGPRInitBug;
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000101 bool HasSMemRealTime;
102 bool Has16BitInsts;
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000103 bool HasMovrel;
104 bool HasVGPRIndexMode;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000105 bool FlatAddressSpace;
106 bool R600ALUInst;
107 bool CaymanISA;
108 bool CFALUBug;
109 bool HasVertexCache;
110 short TexVTXClauseSize;
Tom Stellard75aadc22012-12-11 21:25:42 +0000111
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000112 // Dummy feature to use for assembler in tablegen.
113 bool FeatureDisable;
114
Tom Stellard75aadc22012-12-11 21:25:42 +0000115 InstrItineraryData InstrItins;
Matt Arsenault56684d42016-08-11 17:31:42 +0000116 SelectionDAGTargetInfo TSInfo;
Tom Stellard75aadc22012-12-11 21:25:42 +0000117
118public:
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000119 AMDGPUSubtarget(const Triple &TT, StringRef GPU, StringRef FS,
120 const TargetMachine &TM);
121 virtual ~AMDGPUSubtarget();
Daniel Sandersa73f1fd2015-06-10 12:11:26 +0000122 AMDGPUSubtarget &initializeSubtargetDependencies(const Triple &TT,
123 StringRef GPU, StringRef FS);
Tom Stellard75aadc22012-12-11 21:25:42 +0000124
Matt Arsenaultf9245b72016-07-22 17:01:25 +0000125 const AMDGPUInstrInfo *getInstrInfo() const override = 0;
126 const AMDGPUFrameLowering *getFrameLowering() const override = 0;
127 const AMDGPUTargetLowering *getTargetLowering() const override = 0;
128 const AMDGPURegisterInfo *getRegisterInfo() const override = 0;
Tom Stellard000c5af2016-04-14 19:09:28 +0000129
Eric Christopherd9134482014-08-04 21:25:23 +0000130 const InstrItineraryData *getInstrItineraryData() const override {
131 return &InstrItins;
132 }
Matt Arsenaultd782d052014-06-27 17:57:00 +0000133
Matt Arsenault56684d42016-08-11 17:31:42 +0000134 // Nothing implemented, just prevent crashes on use.
135 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
136 return &TSInfo;
137 }
138
Craig Topperee7b0f32014-04-30 05:53:27 +0000139 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
Tom Stellard75aadc22012-12-11 21:25:42 +0000140
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000141 bool isAmdHsaOS() const {
142 return TargetTriple.getOS() == Triple::AMDHSA;
Matt Arsenaultd782d052014-06-27 17:57:00 +0000143 }
144
Tom Stellard0b76fc4c2016-09-16 21:34:26 +0000145 bool isMesa3DOS() const {
146 return TargetTriple.getOS() == Triple::Mesa3D;
147 }
148
Tom Stellarde88bbc32016-09-23 01:33:26 +0000149 bool isOpenCLEnv() const {
150 return TargetTriple.getEnvironment() == Triple::OpenCL;
151 }
152
Matt Arsenaultd782d052014-06-27 17:57:00 +0000153 Generation getGeneration() const {
154 return Gen;
155 }
156
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000157 unsigned getWavefrontSize() const {
158 return WavefrontSize;
159 }
160
161 int getLocalMemorySize() const {
162 return LocalMemorySize;
163 }
164
165 int getLDSBankCount() const {
166 return LDSBankCount;
167 }
168
169 unsigned getMaxPrivateElementSize() const {
170 return MaxPrivateElementSize;
171 }
172
Matt Arsenaultd782d052014-06-27 17:57:00 +0000173 bool hasHWFP64() const {
174 return FP64;
175 }
176
Matt Arsenaultb035a572015-01-29 19:34:25 +0000177 bool hasFastFMAF32() const {
178 return FastFMAF32;
179 }
180
Matt Arsenaulte83690c2016-01-18 21:13:50 +0000181 bool hasHalfRate64Ops() const {
182 return HalfRate64Ops;
183 }
184
Matt Arsenault88701812016-06-09 23:42:48 +0000185 bool hasAddr64() const {
186 return (getGeneration() < VOLCANIC_ISLANDS);
187 }
188
Matt Arsenaultfae02982014-03-17 18:58:11 +0000189 bool hasBFE() const {
190 return (getGeneration() >= EVERGREEN);
191 }
192
Matt Arsenault6e439652014-06-10 19:00:20 +0000193 bool hasBFI() const {
194 return (getGeneration() >= EVERGREEN);
195 }
196
Matt Arsenaultfae02982014-03-17 18:58:11 +0000197 bool hasBFM() const {
198 return hasBFE();
199 }
200
Matt Arsenault60425062014-06-10 19:18:28 +0000201 bool hasBCNT(unsigned Size) const {
202 if (Size == 32)
203 return (getGeneration() >= EVERGREEN);
204
Matt Arsenault3dd43fc2014-07-18 06:07:13 +0000205 if (Size == 64)
206 return (getGeneration() >= SOUTHERN_ISLANDS);
207
208 return false;
Matt Arsenault60425062014-06-10 19:18:28 +0000209 }
210
Tom Stellard50122a52014-04-07 19:45:41 +0000211 bool hasMulU24() const {
212 return (getGeneration() >= EVERGREEN);
213 }
214
215 bool hasMulI24() const {
216 return (getGeneration() >= SOUTHERN_ISLANDS ||
217 hasCaymanISA());
218 }
219
Jan Vesely6ddb8dd2014-07-15 15:51:09 +0000220 bool hasFFBL() const {
221 return (getGeneration() >= EVERGREEN);
222 }
223
224 bool hasFFBH() const {
225 return (getGeneration() >= EVERGREEN);
226 }
227
Jan Vesely808fff52015-04-30 17:15:56 +0000228 bool hasCARRY() const {
229 return (getGeneration() >= EVERGREEN);
230 }
231
232 bool hasBORROW() const {
233 return (getGeneration() >= EVERGREEN);
234 }
235
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000236 bool hasCaymanISA() const {
237 return CaymanISA;
238 }
239
Matt Arsenaultd9a23ab2014-07-13 02:08:26 +0000240 bool isPromoteAllocaEnabled() const {
241 return EnablePromoteAlloca;
242 }
243
Matt Arsenault706f9302015-07-06 16:01:58 +0000244 bool unsafeDSOffsetFoldingEnabled() const {
245 return EnableUnsafeDSOffsetFolding;
246 }
247
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000248 bool dumpCode() const {
249 return DumpCode;
Matt Arsenaultd782d052014-06-27 17:57:00 +0000250 }
251
Matt Arsenault8a028bf2016-05-16 21:19:59 +0000252 /// Return the amount of LDS that can be used that will not restrict the
253 /// occupancy lower than WaveCount.
254 unsigned getMaxLocalMemSizeWithWaveCount(unsigned WaveCount) const;
255
256 /// Inverse of getMaxLocalMemWithWaveCount. Return the maximum wavecount if
257 /// the given LDS memory size is the only constraint.
258 unsigned getOccupancyWithLocalMemSize(uint32_t Bytes) const;
259
260
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000261 bool hasFP32Denormals() const {
262 return FP32Denormals;
Matt Arsenaultd782d052014-06-27 17:57:00 +0000263 }
Tom Stellard75aadc22012-12-11 21:25:42 +0000264
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000265 bool hasFP64Denormals() const {
266 return FP64Denormals;
Matt Arsenault24ee0782016-02-12 02:40:47 +0000267 }
268
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000269 bool hasFPExceptions() const {
270 return FPExceptions;
Marek Olsak4d00dd22015-03-09 15:48:09 +0000271 }
272
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000273 bool useFlatForGlobal() const {
274 return FlatForGlobal;
Tom Stellardec87f842015-05-25 16:15:54 +0000275 }
276
Matt Arsenault7f681ac2016-07-01 23:03:44 +0000277 bool hasUnalignedBufferAccess() const {
278 return UnalignedBufferAccess;
279 }
280
Tom Stellard64a9d082016-10-14 18:10:39 +0000281 bool hasUnalignedScratchAccess() const {
282 return UnalignedScratchAccess;
283 }
284
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000285 bool isXNACKEnabled() const {
286 return EnableXNACK;
287 }
Tom Stellardb8fd6ef2014-12-02 22:00:07 +0000288
Tom Stellard0b76fc4c2016-09-16 21:34:26 +0000289 bool isAmdCodeObjectV2() const {
290 return isAmdHsaOS() || isMesa3DOS();
291 }
292
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000293 /// \brief Returns the offset in bytes from the start of the input buffer
294 /// of the first explicit kernel argument.
295 unsigned getExplicitKernelArgOffset() const {
Tom Stellard0b76fc4c2016-09-16 21:34:26 +0000296 return isAmdCodeObjectV2() ? 0 : 36;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000297 }
298
Tom Stellardb2869eb2016-09-09 19:28:00 +0000299 unsigned getAlignmentForImplicitArgPtr() const {
300 return isAmdHsaOS() ? 8 : 4;
301 }
302
Tom Stellarde88bbc32016-09-23 01:33:26 +0000303 unsigned getImplicitArgNumBytes() const {
304 if (isMesa3DOS())
305 return 16;
306 if (isAmdHsaOS() && isOpenCLEnv())
307 return 32;
308 return 0;
309 }
310
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000311 unsigned getStackAlignment() const {
312 // Scratch is allocated in 256 dword per wave blocks.
313 return 4 * 256 / getWavefrontSize();
314 }
Tom Stellard347ac792015-06-26 21:15:07 +0000315
Craig Topper5656db42014-04-29 07:57:24 +0000316 bool enableMachineScheduler() const override {
Tom Stellard83f0bce2015-01-29 16:55:25 +0000317 return true;
Andrew Trick978674b2013-09-20 05:14:41 +0000318 }
319
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000320 bool enableSubRegLiveness() const override {
321 return true;
322 }
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000323
324 /// \returns Number of execution units per compute unit supported by the
325 /// subtarget.
326 unsigned getEUsPerCU() const {
327 return 4;
328 }
329
330 /// \returns Maximum number of work groups per compute unit supported by the
331 /// subtarget and limited by given flat work group size.
332 unsigned getMaxWorkGroupsPerCU(unsigned FlatWorkGroupSize) const {
333 if (getGeneration() < AMDGPUSubtarget::SOUTHERN_ISLANDS)
334 return 8;
335 return getWavesPerWorkGroup(FlatWorkGroupSize) == 1 ? 40 : 16;
336 }
337
338 /// \returns Maximum number of waves per compute unit supported by the
339 /// subtarget without any kind of limitation.
340 unsigned getMaxWavesPerCU() const {
341 return getMaxWavesPerEU() * getEUsPerCU();
342 }
343
344 /// \returns Maximum number of waves per compute unit supported by the
345 /// subtarget and limited by given flat work group size.
346 unsigned getMaxWavesPerCU(unsigned FlatWorkGroupSize) const {
347 return getWavesPerWorkGroup(FlatWorkGroupSize);
348 }
349
350 /// \returns Minimum number of waves per execution unit supported by the
351 /// subtarget.
352 unsigned getMinWavesPerEU() const {
353 return 1;
354 }
355
356 /// \returns Maximum number of waves per execution unit supported by the
357 /// subtarget without any kind of limitation.
358 unsigned getMaxWavesPerEU() const {
359 if (getGeneration() < AMDGPUSubtarget::SOUTHERN_ISLANDS)
360 return 8;
361 // FIXME: Need to take scratch memory into account.
362 return 10;
363 }
364
365 /// \returns Maximum number of waves per execution unit supported by the
366 /// subtarget and limited by given flat work group size.
367 unsigned getMaxWavesPerEU(unsigned FlatWorkGroupSize) const {
368 return alignTo(getMaxWavesPerCU(FlatWorkGroupSize), getEUsPerCU()) /
369 getEUsPerCU();
370 }
371
372 /// \returns Minimum flat work group size supported by the subtarget.
373 unsigned getMinFlatWorkGroupSize() const {
374 return 1;
375 }
376
377 /// \returns Maximum flat work group size supported by the subtarget.
378 unsigned getMaxFlatWorkGroupSize() const {
379 return 2048;
380 }
381
382 /// \returns Number of waves per work group given the flat work group size.
383 unsigned getWavesPerWorkGroup(unsigned FlatWorkGroupSize) const {
384 return alignTo(FlatWorkGroupSize, getWavefrontSize()) / getWavefrontSize();
385 }
386
387 /// \returns Subtarget's default pair of minimum/maximum flat work group sizes
388 /// for function \p F, or minimum/maximum flat work group sizes explicitly
389 /// requested using "amdgpu-flat-work-group-size" attribute attached to
390 /// function \p F.
391 ///
392 /// \returns Subtarget's default values if explicitly requested values cannot
393 /// be converted to integer, or violate subtarget's specifications.
394 std::pair<unsigned, unsigned> getFlatWorkGroupSizes(const Function &F) const;
395
396 /// \returns Subtarget's default pair of minimum/maximum number of waves per
397 /// execution unit for function \p F, or minimum/maximum number of waves per
398 /// execution unit explicitly requested using "amdgpu-waves-per-eu" attribute
399 /// attached to function \p F.
400 ///
401 /// \returns Subtarget's default values if explicitly requested values cannot
402 /// be converted to integer, violate subtarget's specifications, or are not
403 /// compatible with minimum/maximum number of waves limited by flat work group
404 /// size, register usage, and/or lds usage.
405 std::pair<unsigned, unsigned> getWavesPerEU(const Function &F) const;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000406};
407
408class R600Subtarget final : public AMDGPUSubtarget {
409private:
410 R600InstrInfo InstrInfo;
411 R600FrameLowering FrameLowering;
412 R600TargetLowering TLInfo;
413
414public:
415 R600Subtarget(const Triple &TT, StringRef CPU, StringRef FS,
416 const TargetMachine &TM);
417
418 const R600InstrInfo *getInstrInfo() const override {
419 return &InstrInfo;
420 }
421
422 const R600FrameLowering *getFrameLowering() const override {
423 return &FrameLowering;
424 }
425
426 const R600TargetLowering *getTargetLowering() const override {
427 return &TLInfo;
428 }
429
430 const R600RegisterInfo *getRegisterInfo() const override {
431 return &InstrInfo.getRegisterInfo();
432 }
433
434 bool hasCFAluBug() const {
435 return CFALUBug;
436 }
437
438 bool hasVertexCache() const {
439 return HasVertexCache;
440 }
441
442 short getTexVTXClauseSize() const {
443 return TexVTXClauseSize;
444 }
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000445};
446
447class SISubtarget final : public AMDGPUSubtarget {
448public:
449 enum {
Marek Olsak355a8642016-08-05 21:23:29 +0000450 // The closed Vulkan driver sets 96, which limits the wave count to 8 but
451 // doesn't spill SGPRs as much as when 80 is set.
452 FIXED_SGPR_COUNT_FOR_INIT_BUG = 96
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000453 };
454
455private:
456 SIInstrInfo InstrInfo;
457 SIFrameLowering FrameLowering;
458 SITargetLowering TLInfo;
459 std::unique_ptr<GISelAccessor> GISel;
460
461public:
462 SISubtarget(const Triple &TT, StringRef CPU, StringRef FS,
463 const TargetMachine &TM);
464
465 const SIInstrInfo *getInstrInfo() const override {
466 return &InstrInfo;
467 }
468
469 const SIFrameLowering *getFrameLowering() const override {
470 return &FrameLowering;
471 }
472
473 const SITargetLowering *getTargetLowering() const override {
474 return &TLInfo;
475 }
476
477 const CallLowering *getCallLowering() const override {
478 assert(GISel && "Access to GlobalISel APIs not set");
479 return GISel->getCallLowering();
480 }
481
482 const SIRegisterInfo *getRegisterInfo() const override {
483 return &InstrInfo.getRegisterInfo();
484 }
485
486 void setGISelAccessor(GISelAccessor &GISel) {
487 this->GISel.reset(&GISel);
488 }
489
Tom Stellard83f0bce2015-01-29 16:55:25 +0000490 void overrideSchedPolicy(MachineSchedPolicy &Policy,
Tom Stellard83f0bce2015-01-29 16:55:25 +0000491 unsigned NumRegionInstrs) const override;
492
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000493 bool isVGPRSpillingEnabled(const Function& F) const;
494
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000495 unsigned getMaxNumUserSGPRs() const {
496 return 16;
497 }
498
499 bool hasFlatAddressSpace() const {
500 return FlatAddressSpace;
501 }
502
503 bool hasSMemRealTime() const {
504 return HasSMemRealTime;
505 }
506
507 bool has16BitInsts() const {
508 return Has16BitInsts;
Matt Arsenaultd782d052014-06-27 17:57:00 +0000509 }
Tom Stellard75aadc22012-12-11 21:25:42 +0000510
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000511 bool hasMovrel() const {
512 return HasMovrel;
513 }
514
515 bool hasVGPRIndexMode() const {
516 return HasVGPRIndexMode;
517 }
518
Matt Arsenault7b1dc2c2016-09-17 02:02:19 +0000519 bool hasScalarCompareEq64() const {
520 return getGeneration() >= VOLCANIC_ISLANDS;
521 }
522
Tom Stellardde008d32016-01-21 04:28:34 +0000523 bool enableSIScheduler() const {
524 return EnableSIScheduler;
525 }
526
Konstantin Zhuravlyovf2f3d142016-06-25 03:11:28 +0000527 bool debuggerSupported() const {
528 return debuggerInsertNops() && debuggerReserveRegs() &&
529 debuggerEmitPrologue();
530 }
531
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000532 bool debuggerInsertNops() const {
533 return DebuggerInsertNops;
534 }
535
Konstantin Zhuravlyov29ddd2b2016-05-24 18:37:18 +0000536 bool debuggerReserveRegs() const {
537 return DebuggerReserveRegs;
Konstantin Zhuravlyov1d99c4d2016-04-26 15:43:14 +0000538 }
539
Konstantin Zhuravlyovf2f3d142016-06-25 03:11:28 +0000540 bool debuggerEmitPrologue() const {
541 return DebuggerEmitPrologue;
542 }
543
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000544 bool loadStoreOptEnabled() const {
545 return EnableLoadStoreOpt;
Nicolai Haehnle5b504972016-01-04 23:35:53 +0000546 }
547
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000548 bool hasSGPRInitBug() const {
549 return SGPRInitBug;
Matt Arsenault41003af2015-11-30 21:16:07 +0000550 }
Tom Stellard0d23ebe2016-08-29 19:42:52 +0000551
Tom Stellarde88bbc32016-09-23 01:33:26 +0000552 unsigned getKernArgSegmentSize(unsigned ExplictArgBytes) const;
553
Tom Stellard0d23ebe2016-08-29 19:42:52 +0000554 /// Return the maximum number of waves per SIMD for kernels using \p SGPRs SGPRs
555 unsigned getOccupancyWithNumSGPRs(unsigned SGPRs) const;
556
557 /// Return the maximum number of waves per SIMD for kernels using \p VGPRs VGPRs
558 unsigned getOccupancyWithNumVGPRs(unsigned VGPRs) const;
Konstantin Zhuravlyovd7bdf242016-09-30 16:50:36 +0000559
560 /// \returns True if waitcnt instruction is needed before barrier instruction,
561 /// false otherwise.
562 bool needWaitcntBeforeBarrier() const {
563 return true;
564 }
Tom Stellard75aadc22012-12-11 21:25:42 +0000565};
566
567} // End namespace llvm
568
Benjamin Kramera7c40ef2014-08-13 16:26:38 +0000569#endif