blob: 7cfdb5cfb73a7666caf11a770dba14018076d29e [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,
Yaxun Liu94add852016-10-26 16:37:56 +000054 ISAVersion7_0_2,
Tom Stellard347ac792015-06-26 21:15:07 +000055 ISAVersion8_0_0,
Changpeng Fangc16be002016-01-13 20:39:25 +000056 ISAVersion8_0_1,
Changpeng Fang98317d22016-10-11 16:00:47 +000057 ISAVersion8_0_2,
Yaxun Liu94add852016-10-26 16:37:56 +000058 ISAVersion8_0_3,
59 ISAVersion8_0_4,
60 ISAVersion8_1_0,
Tom Stellard347ac792015-06-26 21:15:07 +000061 };
62
Matt Arsenault43e92fe2016-06-24 06:30:11 +000063protected:
64 // Basic subtarget description.
65 Triple TargetTriple;
Matt Arsenaultd782d052014-06-27 17:57:00 +000066 Generation Gen;
Matt Arsenault43e92fe2016-06-24 06:30:11 +000067 unsigned IsaVersion;
68 unsigned WavefrontSize;
69 int LocalMemorySize;
70 int LDSBankCount;
71 unsigned MaxPrivateElementSize;
72
73 // Possibly statically set by tablegen, but may want to be overridden.
Matt Arsenaultb035a572015-01-29 19:34:25 +000074 bool FastFMAF32;
Matt Arsenaulte83690c2016-01-18 21:13:50 +000075 bool HalfRate64Ops;
Matt Arsenault43e92fe2016-06-24 06:30:11 +000076
77 // Dynamially set bits that enable features.
78 bool FP32Denormals;
79 bool FP64Denormals;
80 bool FPExceptions;
Changpeng Fangb41574a2015-12-22 20:55:23 +000081 bool FlatForGlobal;
Tom Stellard64a9d082016-10-14 18:10:39 +000082 bool UnalignedScratchAccess;
Matt Arsenault7f681ac2016-07-01 23:03:44 +000083 bool UnalignedBufferAccess;
Matt Arsenault43e92fe2016-06-24 06:30:11 +000084 bool EnableXNACK;
85 bool DebuggerInsertNops;
86 bool DebuggerReserveRegs;
Konstantin Zhuravlyovf2f3d142016-06-25 03:11:28 +000087 bool DebuggerEmitPrologue;
Matt Arsenault43e92fe2016-06-24 06:30:11 +000088
89 // Used as options.
90 bool EnableVGPRSpilling;
Matt Arsenaultd9a23ab2014-07-13 02:08:26 +000091 bool EnablePromoteAlloca;
Matt Arsenault41033282014-10-10 22:01:59 +000092 bool EnableLoadStoreOpt;
Matt Arsenault706f9302015-07-06 16:01:58 +000093 bool EnableUnsafeDSOffsetFolding;
Matt Arsenault43e92fe2016-06-24 06:30:11 +000094 bool EnableSIScheduler;
95 bool DumpCode;
96
97 // Subtarget statically properties set by tablegen
98 bool FP64;
Tom Stellardd7e6f132015-04-08 01:09:26 +000099 bool IsGCN;
100 bool GCN1Encoding;
101 bool GCN3Encoding;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000102 bool CIInsts;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000103 bool SGPRInitBug;
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000104 bool HasSMemRealTime;
105 bool Has16BitInsts;
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000106 bool HasMovrel;
107 bool HasVGPRIndexMode;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000108 bool FlatAddressSpace;
109 bool R600ALUInst;
110 bool CaymanISA;
111 bool CFALUBug;
112 bool HasVertexCache;
113 short TexVTXClauseSize;
Tom Stellard75aadc22012-12-11 21:25:42 +0000114
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000115 // Dummy feature to use for assembler in tablegen.
116 bool FeatureDisable;
117
Tom Stellard75aadc22012-12-11 21:25:42 +0000118 InstrItineraryData InstrItins;
Matt Arsenault56684d42016-08-11 17:31:42 +0000119 SelectionDAGTargetInfo TSInfo;
Tom Stellard75aadc22012-12-11 21:25:42 +0000120
121public:
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000122 AMDGPUSubtarget(const Triple &TT, StringRef GPU, StringRef FS,
123 const TargetMachine &TM);
124 virtual ~AMDGPUSubtarget();
Daniel Sandersa73f1fd2015-06-10 12:11:26 +0000125 AMDGPUSubtarget &initializeSubtargetDependencies(const Triple &TT,
126 StringRef GPU, StringRef FS);
Tom Stellard75aadc22012-12-11 21:25:42 +0000127
Matt Arsenaultf9245b72016-07-22 17:01:25 +0000128 const AMDGPUInstrInfo *getInstrInfo() const override = 0;
129 const AMDGPUFrameLowering *getFrameLowering() const override = 0;
130 const AMDGPUTargetLowering *getTargetLowering() const override = 0;
131 const AMDGPURegisterInfo *getRegisterInfo() const override = 0;
Tom Stellard000c5af2016-04-14 19:09:28 +0000132
Eric Christopherd9134482014-08-04 21:25:23 +0000133 const InstrItineraryData *getInstrItineraryData() const override {
134 return &InstrItins;
135 }
Matt Arsenaultd782d052014-06-27 17:57:00 +0000136
Matt Arsenault56684d42016-08-11 17:31:42 +0000137 // Nothing implemented, just prevent crashes on use.
138 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
139 return &TSInfo;
140 }
141
Craig Topperee7b0f32014-04-30 05:53:27 +0000142 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
Tom Stellard75aadc22012-12-11 21:25:42 +0000143
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000144 bool isAmdHsaOS() const {
145 return TargetTriple.getOS() == Triple::AMDHSA;
Matt Arsenaultd782d052014-06-27 17:57:00 +0000146 }
147
Tom Stellard0b76fc4c2016-09-16 21:34:26 +0000148 bool isMesa3DOS() const {
149 return TargetTriple.getOS() == Triple::Mesa3D;
150 }
151
Tom Stellarde88bbc32016-09-23 01:33:26 +0000152 bool isOpenCLEnv() const {
153 return TargetTriple.getEnvironment() == Triple::OpenCL;
154 }
155
Matt Arsenaultd782d052014-06-27 17:57:00 +0000156 Generation getGeneration() const {
157 return Gen;
158 }
159
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000160 unsigned getWavefrontSize() const {
161 return WavefrontSize;
162 }
163
164 int getLocalMemorySize() const {
165 return LocalMemorySize;
166 }
167
168 int getLDSBankCount() const {
169 return LDSBankCount;
170 }
171
172 unsigned getMaxPrivateElementSize() const {
173 return MaxPrivateElementSize;
174 }
175
Matt Arsenaultd782d052014-06-27 17:57:00 +0000176 bool hasHWFP64() const {
177 return FP64;
178 }
179
Matt Arsenaultb035a572015-01-29 19:34:25 +0000180 bool hasFastFMAF32() const {
181 return FastFMAF32;
182 }
183
Matt Arsenaulte83690c2016-01-18 21:13:50 +0000184 bool hasHalfRate64Ops() const {
185 return HalfRate64Ops;
186 }
187
Matt Arsenault88701812016-06-09 23:42:48 +0000188 bool hasAddr64() const {
189 return (getGeneration() < VOLCANIC_ISLANDS);
190 }
191
Matt Arsenaultfae02982014-03-17 18:58:11 +0000192 bool hasBFE() const {
193 return (getGeneration() >= EVERGREEN);
194 }
195
Matt Arsenault6e439652014-06-10 19:00:20 +0000196 bool hasBFI() const {
197 return (getGeneration() >= EVERGREEN);
198 }
199
Matt Arsenaultfae02982014-03-17 18:58:11 +0000200 bool hasBFM() const {
201 return hasBFE();
202 }
203
Matt Arsenault60425062014-06-10 19:18:28 +0000204 bool hasBCNT(unsigned Size) const {
205 if (Size == 32)
206 return (getGeneration() >= EVERGREEN);
207
Matt Arsenault3dd43fc2014-07-18 06:07:13 +0000208 if (Size == 64)
209 return (getGeneration() >= SOUTHERN_ISLANDS);
210
211 return false;
Matt Arsenault60425062014-06-10 19:18:28 +0000212 }
213
Tom Stellard50122a52014-04-07 19:45:41 +0000214 bool hasMulU24() const {
215 return (getGeneration() >= EVERGREEN);
216 }
217
218 bool hasMulI24() const {
219 return (getGeneration() >= SOUTHERN_ISLANDS ||
220 hasCaymanISA());
221 }
222
Jan Vesely6ddb8dd2014-07-15 15:51:09 +0000223 bool hasFFBL() const {
224 return (getGeneration() >= EVERGREEN);
225 }
226
227 bool hasFFBH() const {
228 return (getGeneration() >= EVERGREEN);
229 }
230
Jan Vesely808fff52015-04-30 17:15:56 +0000231 bool hasCARRY() const {
232 return (getGeneration() >= EVERGREEN);
233 }
234
235 bool hasBORROW() const {
236 return (getGeneration() >= EVERGREEN);
237 }
238
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000239 bool hasCaymanISA() const {
240 return CaymanISA;
241 }
242
Matt Arsenaultd9a23ab2014-07-13 02:08:26 +0000243 bool isPromoteAllocaEnabled() const {
244 return EnablePromoteAlloca;
245 }
246
Matt Arsenault706f9302015-07-06 16:01:58 +0000247 bool unsafeDSOffsetFoldingEnabled() const {
248 return EnableUnsafeDSOffsetFolding;
249 }
250
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000251 bool dumpCode() const {
252 return DumpCode;
Matt Arsenaultd782d052014-06-27 17:57:00 +0000253 }
254
Wei Ding3cb2a1e2016-10-19 22:34:49 +0000255 bool enableIEEEBit(const MachineFunction &MF) const {
256 return AMDGPU::isCompute(MF.getFunction()->getCallingConv());
257 }
258
Matt Arsenault8a028bf2016-05-16 21:19:59 +0000259 /// Return the amount of LDS that can be used that will not restrict the
260 /// occupancy lower than WaveCount.
261 unsigned getMaxLocalMemSizeWithWaveCount(unsigned WaveCount) const;
262
263 /// Inverse of getMaxLocalMemWithWaveCount. Return the maximum wavecount if
264 /// the given LDS memory size is the only constraint.
265 unsigned getOccupancyWithLocalMemSize(uint32_t Bytes) const;
266
267
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000268 bool hasFP32Denormals() const {
269 return FP32Denormals;
Matt Arsenaultd782d052014-06-27 17:57:00 +0000270 }
Tom Stellard75aadc22012-12-11 21:25:42 +0000271
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000272 bool hasFP64Denormals() const {
273 return FP64Denormals;
Matt Arsenault24ee0782016-02-12 02:40:47 +0000274 }
275
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000276 bool hasFPExceptions() const {
277 return FPExceptions;
Marek Olsak4d00dd22015-03-09 15:48:09 +0000278 }
279
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000280 bool useFlatForGlobal() const {
281 return FlatForGlobal;
Tom Stellardec87f842015-05-25 16:15:54 +0000282 }
283
Matt Arsenault7f681ac2016-07-01 23:03:44 +0000284 bool hasUnalignedBufferAccess() const {
285 return UnalignedBufferAccess;
286 }
287
Tom Stellard64a9d082016-10-14 18:10:39 +0000288 bool hasUnalignedScratchAccess() const {
289 return UnalignedScratchAccess;
290 }
291
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000292 bool isXNACKEnabled() const {
293 return EnableXNACK;
294 }
Tom Stellardb8fd6ef2014-12-02 22:00:07 +0000295
Tom Stellard0b76fc4c2016-09-16 21:34:26 +0000296 bool isAmdCodeObjectV2() const {
297 return isAmdHsaOS() || isMesa3DOS();
298 }
299
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000300 /// \brief Returns the offset in bytes from the start of the input buffer
301 /// of the first explicit kernel argument.
302 unsigned getExplicitKernelArgOffset() const {
Tom Stellard0b76fc4c2016-09-16 21:34:26 +0000303 return isAmdCodeObjectV2() ? 0 : 36;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000304 }
305
Tom Stellardb2869eb2016-09-09 19:28:00 +0000306 unsigned getAlignmentForImplicitArgPtr() const {
307 return isAmdHsaOS() ? 8 : 4;
308 }
309
Tom Stellarde88bbc32016-09-23 01:33:26 +0000310 unsigned getImplicitArgNumBytes() const {
311 if (isMesa3DOS())
312 return 16;
313 if (isAmdHsaOS() && isOpenCLEnv())
314 return 32;
315 return 0;
316 }
317
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000318 unsigned getStackAlignment() const {
319 // Scratch is allocated in 256 dword per wave blocks.
320 return 4 * 256 / getWavefrontSize();
321 }
Tom Stellard347ac792015-06-26 21:15:07 +0000322
Craig Topper5656db42014-04-29 07:57:24 +0000323 bool enableMachineScheduler() const override {
Tom Stellard83f0bce2015-01-29 16:55:25 +0000324 return true;
Andrew Trick978674b2013-09-20 05:14:41 +0000325 }
326
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000327 bool enableSubRegLiveness() const override {
328 return true;
329 }
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000330
331 /// \returns Number of execution units per compute unit supported by the
332 /// subtarget.
333 unsigned getEUsPerCU() const {
334 return 4;
335 }
336
337 /// \returns Maximum number of work groups per compute unit supported by the
338 /// subtarget and limited by given flat work group size.
339 unsigned getMaxWorkGroupsPerCU(unsigned FlatWorkGroupSize) const {
340 if (getGeneration() < AMDGPUSubtarget::SOUTHERN_ISLANDS)
341 return 8;
342 return getWavesPerWorkGroup(FlatWorkGroupSize) == 1 ? 40 : 16;
343 }
344
345 /// \returns Maximum number of waves per compute unit supported by the
346 /// subtarget without any kind of limitation.
347 unsigned getMaxWavesPerCU() const {
348 return getMaxWavesPerEU() * getEUsPerCU();
349 }
350
351 /// \returns Maximum number of waves per compute unit supported by the
352 /// subtarget and limited by given flat work group size.
353 unsigned getMaxWavesPerCU(unsigned FlatWorkGroupSize) const {
354 return getWavesPerWorkGroup(FlatWorkGroupSize);
355 }
356
357 /// \returns Minimum number of waves per execution unit supported by the
358 /// subtarget.
359 unsigned getMinWavesPerEU() const {
360 return 1;
361 }
362
363 /// \returns Maximum number of waves per execution unit supported by the
364 /// subtarget without any kind of limitation.
365 unsigned getMaxWavesPerEU() const {
366 if (getGeneration() < AMDGPUSubtarget::SOUTHERN_ISLANDS)
367 return 8;
368 // FIXME: Need to take scratch memory into account.
369 return 10;
370 }
371
372 /// \returns Maximum number of waves per execution unit supported by the
373 /// subtarget and limited by given flat work group size.
374 unsigned getMaxWavesPerEU(unsigned FlatWorkGroupSize) const {
375 return alignTo(getMaxWavesPerCU(FlatWorkGroupSize), getEUsPerCU()) /
376 getEUsPerCU();
377 }
378
379 /// \returns Minimum flat work group size supported by the subtarget.
380 unsigned getMinFlatWorkGroupSize() const {
381 return 1;
382 }
383
384 /// \returns Maximum flat work group size supported by the subtarget.
385 unsigned getMaxFlatWorkGroupSize() const {
386 return 2048;
387 }
388
389 /// \returns Number of waves per work group given the flat work group size.
390 unsigned getWavesPerWorkGroup(unsigned FlatWorkGroupSize) const {
391 return alignTo(FlatWorkGroupSize, getWavefrontSize()) / getWavefrontSize();
392 }
393
394 /// \returns Subtarget's default pair of minimum/maximum flat work group sizes
395 /// for function \p F, or minimum/maximum flat work group sizes explicitly
396 /// requested using "amdgpu-flat-work-group-size" attribute attached to
397 /// function \p F.
398 ///
399 /// \returns Subtarget's default values if explicitly requested values cannot
400 /// be converted to integer, or violate subtarget's specifications.
401 std::pair<unsigned, unsigned> getFlatWorkGroupSizes(const Function &F) const;
402
403 /// \returns Subtarget's default pair of minimum/maximum number of waves per
404 /// execution unit for function \p F, or minimum/maximum number of waves per
405 /// execution unit explicitly requested using "amdgpu-waves-per-eu" attribute
406 /// attached to function \p F.
407 ///
408 /// \returns Subtarget's default values if explicitly requested values cannot
409 /// be converted to integer, violate subtarget's specifications, or are not
410 /// compatible with minimum/maximum number of waves limited by flat work group
411 /// size, register usage, and/or lds usage.
412 std::pair<unsigned, unsigned> getWavesPerEU(const Function &F) const;
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000413};
414
415class R600Subtarget final : public AMDGPUSubtarget {
416private:
417 R600InstrInfo InstrInfo;
418 R600FrameLowering FrameLowering;
419 R600TargetLowering TLInfo;
420
421public:
422 R600Subtarget(const Triple &TT, StringRef CPU, StringRef FS,
423 const TargetMachine &TM);
424
425 const R600InstrInfo *getInstrInfo() const override {
426 return &InstrInfo;
427 }
428
429 const R600FrameLowering *getFrameLowering() const override {
430 return &FrameLowering;
431 }
432
433 const R600TargetLowering *getTargetLowering() const override {
434 return &TLInfo;
435 }
436
437 const R600RegisterInfo *getRegisterInfo() const override {
438 return &InstrInfo.getRegisterInfo();
439 }
440
441 bool hasCFAluBug() const {
442 return CFALUBug;
443 }
444
445 bool hasVertexCache() const {
446 return HasVertexCache;
447 }
448
449 short getTexVTXClauseSize() const {
450 return TexVTXClauseSize;
451 }
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000452};
453
454class SISubtarget final : public AMDGPUSubtarget {
455public:
456 enum {
Marek Olsak355a8642016-08-05 21:23:29 +0000457 // The closed Vulkan driver sets 96, which limits the wave count to 8 but
458 // doesn't spill SGPRs as much as when 80 is set.
459 FIXED_SGPR_COUNT_FOR_INIT_BUG = 96
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000460 };
461
462private:
463 SIInstrInfo InstrInfo;
464 SIFrameLowering FrameLowering;
465 SITargetLowering TLInfo;
466 std::unique_ptr<GISelAccessor> GISel;
467
468public:
469 SISubtarget(const Triple &TT, StringRef CPU, StringRef FS,
470 const TargetMachine &TM);
471
472 const SIInstrInfo *getInstrInfo() const override {
473 return &InstrInfo;
474 }
475
476 const SIFrameLowering *getFrameLowering() const override {
477 return &FrameLowering;
478 }
479
480 const SITargetLowering *getTargetLowering() const override {
481 return &TLInfo;
482 }
483
484 const CallLowering *getCallLowering() const override {
485 assert(GISel && "Access to GlobalISel APIs not set");
486 return GISel->getCallLowering();
487 }
488
489 const SIRegisterInfo *getRegisterInfo() const override {
490 return &InstrInfo.getRegisterInfo();
491 }
492
493 void setGISelAccessor(GISelAccessor &GISel) {
494 this->GISel.reset(&GISel);
495 }
496
Tom Stellard83f0bce2015-01-29 16:55:25 +0000497 void overrideSchedPolicy(MachineSchedPolicy &Policy,
Tom Stellard83f0bce2015-01-29 16:55:25 +0000498 unsigned NumRegionInstrs) const override;
499
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000500 bool isVGPRSpillingEnabled(const Function& F) const;
501
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000502 unsigned getMaxNumUserSGPRs() const {
503 return 16;
504 }
505
506 bool hasFlatAddressSpace() const {
507 return FlatAddressSpace;
508 }
509
510 bool hasSMemRealTime() const {
511 return HasSMemRealTime;
512 }
513
514 bool has16BitInsts() const {
515 return Has16BitInsts;
Matt Arsenaultd782d052014-06-27 17:57:00 +0000516 }
Tom Stellard75aadc22012-12-11 21:25:42 +0000517
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000518 bool hasMovrel() const {
519 return HasMovrel;
520 }
521
522 bool hasVGPRIndexMode() const {
523 return HasVGPRIndexMode;
524 }
525
Matt Arsenault7b1dc2c2016-09-17 02:02:19 +0000526 bool hasScalarCompareEq64() const {
527 return getGeneration() >= VOLCANIC_ISLANDS;
528 }
529
Tom Stellardde008d32016-01-21 04:28:34 +0000530 bool enableSIScheduler() const {
531 return EnableSIScheduler;
532 }
533
Konstantin Zhuravlyovf2f3d142016-06-25 03:11:28 +0000534 bool debuggerSupported() const {
535 return debuggerInsertNops() && debuggerReserveRegs() &&
536 debuggerEmitPrologue();
537 }
538
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000539 bool debuggerInsertNops() const {
540 return DebuggerInsertNops;
541 }
542
Konstantin Zhuravlyov29ddd2b2016-05-24 18:37:18 +0000543 bool debuggerReserveRegs() const {
544 return DebuggerReserveRegs;
Konstantin Zhuravlyov1d99c4d2016-04-26 15:43:14 +0000545 }
546
Konstantin Zhuravlyovf2f3d142016-06-25 03:11:28 +0000547 bool debuggerEmitPrologue() const {
548 return DebuggerEmitPrologue;
549 }
550
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000551 bool loadStoreOptEnabled() const {
552 return EnableLoadStoreOpt;
Nicolai Haehnle5b504972016-01-04 23:35:53 +0000553 }
554
Matt Arsenault43e92fe2016-06-24 06:30:11 +0000555 bool hasSGPRInitBug() const {
556 return SGPRInitBug;
Matt Arsenault41003af2015-11-30 21:16:07 +0000557 }
Tom Stellard0d23ebe2016-08-29 19:42:52 +0000558
Tom Stellarde88bbc32016-09-23 01:33:26 +0000559 unsigned getKernArgSegmentSize(unsigned ExplictArgBytes) const;
560
Tom Stellard0d23ebe2016-08-29 19:42:52 +0000561 /// Return the maximum number of waves per SIMD for kernels using \p SGPRs SGPRs
562 unsigned getOccupancyWithNumSGPRs(unsigned SGPRs) const;
563
564 /// Return the maximum number of waves per SIMD for kernels using \p VGPRs VGPRs
565 unsigned getOccupancyWithNumVGPRs(unsigned VGPRs) const;
Konstantin Zhuravlyovd7bdf242016-09-30 16:50:36 +0000566
567 /// \returns True if waitcnt instruction is needed before barrier instruction,
568 /// false otherwise.
569 bool needWaitcntBeforeBarrier() const {
570 return true;
571 }
Tom Stellard75aadc22012-12-11 21:25:42 +0000572};
573
574} // End namespace llvm
575
Benjamin Kramera7c40ef2014-08-13 16:26:38 +0000576#endif