LLVM 24.0.0git
SIRegisterInfo.h
Go to the documentation of this file.
1//===-- SIRegisterInfo.h - SI Register Info Interface ----------*- 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/// \file
10/// Interface definition for SIRegisterInfo
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_AMDGPU_SIREGISTERINFO_H
15#define LLVM_LIB_TARGET_AMDGPU_SIREGISTERINFO_H
16
17#include "llvm/ADT/BitVector.h"
22#include "llvm/MC/MCRegister.h"
23
24#define GET_REGINFO_HEADER
25#include "AMDGPUGenRegisterInfo.inc"
26
27#include "SIDefines.h"
28
29namespace llvm {
30
31class GCNSubtarget;
32class LiveIntervals;
33class LiveRegUnits;
34class MachineInstrBuilder;
35class RegisterBank;
36struct SGPRSpillBuilder;
37
38/// Register allocation hint types. Helps eliminate unneeded COPY with True16
39namespace AMDGPURI {
40
41enum { Size16 = 1, Size32 = 2 };
42
43} // end namespace AMDGPURI
44
46private:
47 const GCNSubtarget &ST;
48 bool SpillSGPRToVGPR;
49 bool isWave32;
50 BitVector RegPressureIgnoredUnits;
51
52 /// Sub reg indexes for getRegSplitParts.
53 /// First index represents subreg size from 1 to 32 Half DWORDS.
54 /// The inner vector is sorted by bit offset.
55 /// Provided a register can be fully split with given subregs,
56 /// all elements of the inner vector combined give a full lane mask.
57 static std::array<std::vector<int16_t>, 32> RegSplitParts;
58
59 // Table representing sub reg of given width and offset.
60 // First index is subreg size: 32, 64, 96, 128, 160, 192, 224, 256, 512.
61 // Second index is 32 different dword offsets.
62 static std::array<std::array<uint16_t, 32>, 9> SubRegFromChannelTable;
63
64 void reserveRegisterTuples(BitVector &, MCRegister Reg) const;
65
66 /// True if assigning Reg would fit in the current occupancy VGPR budget.
67 bool isRegWithinOccupancyBudget(MCPhysReg Reg, unsigned NumVGPRs,
68 unsigned NumAGPRs,
69 unsigned MaxVGPRsForCurrentOccupancy) const;
70
71public:
73
74 struct SpilledReg {
76 int Lane = -1;
77
78 SpilledReg() = default;
79 SpilledReg(Register R, int L) : VGPR(R), Lane(L) {}
80
81 bool hasLane() { return Lane != -1; }
82 bool hasReg() { return VGPR != 0; }
83 };
84
85 /// \returns the sub reg enum value for the given \p Channel
86 /// (e.g. getSubRegFromChannel(0) -> AMDGPU::sub0)
87 static unsigned getSubRegFromChannel(unsigned Channel, unsigned NumRegs = 1);
88
89 bool spillSGPRToVGPR() const {
90 return SpillSGPRToVGPR;
91 }
92
93 bool isCFISavedRegsSpillEnabled() const;
94
95 /// Return the largest available SGPR aligned to \p Align for the register
96 /// class \p RC.
98 const unsigned Align,
99 const TargetRegisterClass *RC) const;
100
101 /// Return the end register initially reserved for the scratch buffer in case
102 /// spilling is needed.
104
105 BitVector getReservedRegs(const MachineFunction &MF) const override;
106 bool isAsmClobberable(const MachineFunction &MF,
107 MCRegister PhysReg) const override;
108
109 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
112 CallingConv::ID) const override;
113 const uint32_t *getNoPreservedMask() const override;
114
115 // Functions with the amdgpu_cs_chain or amdgpu_cs_chain_preserve calling
116 // conventions are free to use certain VGPRs without saving and restoring any
117 // lanes (not even inactive ones).
118 static bool isChainScratchRegister(Register VGPR);
119
120 unsigned getCSRFirstUseCost(const MachineFunction &) const override {
121 // The cost of 27 balances multiple factors that influence CSR cost:
122 // - Saving a SGPR CSR to VGPR lanes is relatively cheap.
123 // - In cases where this is not possible, stack access is very expensive.
124 // - CSRs are also the high registers, and we want to minimize the number of
125 // used registers as it impacts occupancy.
126 // Note: Register allocation only applies these cost to callee-save
127 // registers according to getCalleeSavedRegs, so handling of calling
128 // conventions with no CSR is handled there.
129 return 27;
130 }
131
132 // When building a block VGPR load, we only really transfer a subset of the
133 // registers in the block, based on a mask. Liveness analysis is not aware of
134 // the mask, so it might consider that any register in the block is available
135 // before the load and may therefore be scavenged. This is not ok for CSRs
136 // that are not clobbered, since the caller will expect them to be preserved.
137 // This method will add artificial implicit uses for those registers on the
138 // load instruction, so liveness analysis knows they're unavailable.
140 Register BlockReg) const;
141
142 // Iterate over all VGPRs in the given BlockReg and emit CFI for each VGPR
143 // as-needed depending on the (statically known) mask, relative to the given
144 // base Offset.
147 Register BlockReg, int64_t Offset) const;
148
149 const TargetRegisterClass *
151 const MachineFunction &MF) const override;
152
153 Register getFrameRegister(const MachineFunction &MF) const override;
154
155 bool hasBasePointer(const MachineFunction &MF) const;
157
158 bool shouldRealignStack(const MachineFunction &MF) const override;
159 bool requiresRegisterScavenging(const MachineFunction &Fn) const override;
160
161 bool requiresFrameIndexScavenging(const MachineFunction &MF) const override;
163 const MachineFunction &MF) const override;
164 bool requiresVirtualBaseRegisters(const MachineFunction &Fn) const override;
165
166 int64_t getScratchInstrOffset(const MachineInstr *MI) const;
167
169 int Idx) const override;
170
171 bool needsFrameBaseReg(MachineInstr *MI, int64_t Offset) const override;
172
174 int64_t Offset) const override;
175
177 int64_t Offset) const override;
178
179 bool isFrameOffsetLegal(const MachineInstr *MI, Register BaseReg,
180 int64_t Offset) const override;
181
182 /// Returns a legal register class to copy a register in the specified class
183 /// to or from. If it is possible to copy the register directly without using
184 /// a cross register class copy, return the specified RC. Returns NULL if it
185 /// is not possible to copy between two registers of the specified class.
186 const TargetRegisterClass *
187 getCrossCopyRegClass(const TargetRegisterClass *RC) const override;
188
189 const TargetRegisterClass *
191 return &AMDGPU::VReg_1024RegClass;
192 }
193
194 void buildVGPRSpillLoadStore(SGPRSpillBuilder &SB, int Index, int Offset,
195 bool IsLoad, bool IsKill = true) const;
196
197 /// If \p OnlyToVGPR is true, this will only succeed if this manages to find a
198 /// free VGPR lane to spill.
200 SlotIndexes *Indexes = nullptr, LiveIntervals *LIS = nullptr,
201 bool OnlyToVGPR = false, bool SpillToPhysVGPRLane = false,
202 bool NeedsCFI = false) const;
203
205 SlotIndexes *Indexes = nullptr, LiveIntervals *LIS = nullptr,
206 bool OnlyToVGPR = false,
207 bool SpillToPhysVGPRLane = false) const;
208
210 MachineBasicBlock &RestoreMBB, Register SGPR,
211 RegScavenger *RS) const;
212
214 unsigned FIOperandNum,
215 RegScavenger *RS) const override;
216
219 SlotIndexes *Indexes = nullptr, LiveIntervals *LIS = nullptr,
220 bool SpillToPhysVGPRLane = false) const;
221
222 StringRef getRegAsmName(MCRegister Reg) const override;
223
224 // Pseudo regs are not allowed
225 unsigned getHWRegIndex(MCRegister Reg) const;
226
229
232
235
237 const TargetRegisterClass *
239
241 const TargetRegisterClass *
243
246
247 /// \returns true if this class contains only SGPR registers
248 static bool isSGPRClass(const TargetRegisterClass *RC) {
249 return hasSGPRs(RC) && !hasVGPRs(RC) && !hasAGPRs(RC);
250 }
251
252 /// \returns true if this class ID contains only SGPR registers
253 bool isSGPRClassID(unsigned RCID) const {
254 return isSGPRClass(getRegClass(RCID));
255 }
256
257 bool isSGPRReg(const MachineRegisterInfo &MRI, Register Reg) const;
259 return isSGPRClass(getPhysRegBaseClass(Reg));
260 }
261
263 return isVGPRClass(getPhysRegBaseClass(Reg));
264 }
265
266 /// \returns true if this class contains only VGPR registers
267 static bool isVGPRClass(const TargetRegisterClass *RC) {
268 return hasVGPRs(RC) && !hasAGPRs(RC) && !hasSGPRs(RC);
269 }
270
271 /// \returns true if this class contains only AGPR registers
272 static bool isAGPRClass(const TargetRegisterClass *RC) {
273 return hasAGPRs(RC) && !hasVGPRs(RC) && !hasSGPRs(RC);
274 }
275
276 /// \returns true only if this class contains both VGPR and AGPR registers
278 return hasVGPRs(RC) && hasAGPRs(RC) && !hasSGPRs(RC);
279 }
280
281 /// \returns true only if this class contains both VGPR and SGPR registers
282 bool isVSSuperClass(const TargetRegisterClass *RC) const {
283 return hasVGPRs(RC) && hasSGPRs(RC) && !hasAGPRs(RC);
284 }
285
286 /// \returns true if this class contains VGPR registers.
287 static bool hasVGPRs(const TargetRegisterClass *RC) {
288 return RC->TSFlags & SIRCFlags::HasVGPR;
289 }
290
291 /// \returns true if this class contains AGPR registers.
292 static bool hasAGPRs(const TargetRegisterClass *RC) {
293 return RC->TSFlags & SIRCFlags::HasAGPR;
294 }
295
296 /// \returns true if this class contains SGPR registers.
297 static bool hasSGPRs(const TargetRegisterClass *RC) {
298 return RC->TSFlags & SIRCFlags::HasSGPR;
299 }
300
301 /// \returns true if this class contains any vector registers.
303 return hasVGPRs(RC) || hasAGPRs(RC);
304 }
305
306 /// \returns A VGPR reg class with the same width as \p SRC
307 const TargetRegisterClass *
309
310 /// \returns An AGPR reg class with the same width as \p SRC
311 const TargetRegisterClass *
313
314 /// \returns An AGPR+VGPR super reg class with the same width as \p SRC
315 const TargetRegisterClass *
317
318 /// \returns A SGPR reg class with the same width as \p SRC
319 const TargetRegisterClass *
321
322 /// Returns a register class which is compatible with \p SuperRC, such that a
323 /// subregister exists with class \p SubRC with subregister index \p
324 /// SubIdx. If this is impossible (e.g., an unaligned subregister index within
325 /// a register tuple), return null.
326 const TargetRegisterClass *
328 const TargetRegisterClass *SubRC,
329 unsigned SubIdx) const;
330
331 /// \returns True if operands defined with this operand type can accept
332 /// a literal constant (i.e. any 32-bit immediate).
333 bool opCanUseLiteralConstant(unsigned OpType) const;
334
335 /// \returns True if operands defined with this operand type can accept
336 /// an inline constant. i.e. An integer value in the range (-16, 64) or
337 /// -4.0f, -2.0f, -1.0f, -0.5f, 0.0f, 0.5f, 1.0f, 2.0f, 4.0f.
338 bool opCanUseInlineConstant(unsigned OpType) const;
339
341 const TargetRegisterClass *RC,
342 const MachineFunction &MF,
343 bool ReserveHighestVGPR = false) const;
344
346 Register Reg) const;
347 const TargetRegisterClass *
349 const MachineOperand &MO) const;
350
351 bool isVGPR(const MachineRegisterInfo &MRI, Register Reg) const;
352 bool isAGPR(const MachineRegisterInfo &MRI, Register Reg) const;
354 return isVGPR(MRI, Reg) || isAGPR(MRI, Reg);
355 }
356
357 // FIXME: SGPRs are assumed to be uniform, but this is not true for i1 SGPRs
358 // (such as VCC) which hold a wave-wide vector of boolean values. Examining
359 // just the register class is not suffcient; it needs to be combined with a
360 // value type. The next predicate isUniformReg() does this correctly.
361 bool isDivergentRegClass(const TargetRegisterClass *RC) const override {
362 return !isSGPRClass(RC);
363 }
364
365 bool isUniformReg(const MachineRegisterInfo &MRI, const RegisterBankInfo &RBI,
366 Register Reg) const override;
367
369 unsigned EltSize) const;
370
371 unsigned getRegPressureLimit(const TargetRegisterClass *RC,
372 MachineFunction &MF) const override;
373
374 unsigned getRegPressureSetLimit(const MachineFunction &MF,
375 unsigned Idx) const override;
376
379 const MachineFunction &MF, const VirtRegMap *VRM,
380 const LiveRegMatrix *Matrix) const override;
381
383 unsigned NumAllocatedVGPRs,
384 unsigned &MaxVGPRsForCurrentOccupancy) const;
385
387 Register VirtReg, MutableArrayRef<MCPhysReg> CustomOrder,
388 const BitVector &AntiHintedRegUnits, const MachineFunction &MF,
389 const LiveRegMatrix *Matrix = nullptr,
390 const RegisterClassInfo *RegClassInfo = nullptr) const override;
391
392 const int *getRegUnitPressureSets(MCRegUnit RegUnit) const override;
393
395
396 const TargetRegisterClass *
397 getRegClassForSizeOnBank(unsigned Size, const RegisterBank &Bank) const;
398
399 const TargetRegisterClass *
401 return getRegClassForSizeOnBank(Ty.getSizeInBits(), Bank);
402 }
403
404 const TargetRegisterClass *
406 const MachineRegisterInfo &MRI) const override;
407
409 return isWave32 ? &AMDGPU::SReg_32RegClass
410 : &AMDGPU::SReg_64RegClass;
411 }
412
414 return isWave32 ? &AMDGPU::SReg_32_XM0_XEXECRegClass
415 : &AMDGPU::SReg_64_XEXECRegClass;
416 }
417
418 // Return the appropriate register class to use for 64-bit VGPRs for the
419 // subtarget.
420 const TargetRegisterClass *getVGPR64Class() const;
421
422 MCRegister getVCC() const;
423
424 MCRegister getExec() const;
425
426 // Find reaching register definition
427 MachineInstr *findReachingDef(Register Reg, unsigned SubReg,
430 LiveIntervals *LIS) const;
431
432 const uint32_t *getAllVGPRRegMask() const;
433 const uint32_t *getAllAGPRRegMask() const;
434 const uint32_t *getAllVectorRegMask() const;
435 const uint32_t *getAllAllocatableSRegMask() const;
436
437 // \returns number of 32 bit registers covered by a \p LM
438 static unsigned getNumCoveredRegs(LaneBitmask LM) {
439 // The assumption is that every lo16 subreg is an even bit and every hi16
440 // is an adjacent odd bit or vice versa.
441 uint64_t Mask = LM.getAsInteger();
442 uint64_t Even = Mask & 0xAAAAAAAAAAAAAAAAULL;
443 Mask = (Even >> 1) | Mask;
444 uint64_t Odd = Mask & 0x5555555555555555ULL;
445 return llvm::popcount(Odd);
446 }
447
448 // \returns a DWORD offset of a \p SubReg
449 unsigned getChannelFromSubReg(unsigned SubReg) const {
450 return SubReg ? (getSubRegIdxOffset(SubReg) + 31) / 32 : 0;
451 }
452
453 // \returns a DWORD size of a \p SubReg
454 unsigned getNumChannelsFromSubReg(unsigned SubReg) const {
455 return getNumCoveredRegs(getSubRegIndexLaneMask(SubReg));
456 }
457
458 // For a given 16 bit \p Reg \returns a 32 bit register holding it.
459 // \returns \p Reg otherwise.
461
462 // Returns true if a given register class is properly aligned for
463 // the subtarget.
464 bool isProperlyAlignedRC(const TargetRegisterClass &RC) const;
465
466 /// Return all SGPR128 which satisfy the waves per execution unit requirement
467 /// of the subtarget.
469
470 /// Return all SGPR64 which satisfy the waves per execution unit requirement
471 /// of the subtarget.
473
474 /// Return all SGPR32 which satisfy the waves per execution unit requirement
475 /// of the subtarget.
477
478 // Insert spill or restore instructions.
479 // When lowering spill pseudos, the RegScavenger should be set.
480 // For creating spill instructions during frame lowering, where no scavenger
481 // is available, LiveUnits can be used.
484 unsigned LoadStoreOp, int Index, Register ValueReg,
485 bool ValueIsKill, MCRegister ScratchOffsetReg,
486 int64_t InstrOffset, MachineMemOperand *MMO,
487 RegScavenger *RS, LiveRegUnits *LiveUnits = nullptr,
488 bool NeedsCFI = false) const;
489
490 // Return alignment in register file of first register in a register tuple.
492 return (RC->TSFlags & SIRCFlags::RegTupleAlignUnitsMask) * 32;
493 }
494
495 // Check if register class RC has required alignment.
497 unsigned AlignNumBits) const {
498 assert(AlignNumBits != 0);
499 unsigned RCAlign = getRegClassAlignmentNumBits(RC);
500 return RCAlign == AlignNumBits ||
501 (RCAlign > AlignNumBits && (RCAlign % AlignNumBits) == 0);
502 }
503
504 // Return alignment of a SubReg relative to start of a register in RC class.
505 // No check if the subreg is supported by the current RC is made.
507 unsigned SubReg) const;
508
509 // \returns a number of registers of a given \p RC used in a function.
510 // Does not go inside function calls. If \p IncludeCalls is true, it will
511 // include registers that may be clobbered by calls.
512 unsigned getNumUsedPhysRegs(const MachineRegisterInfo &MRI,
513 const TargetRegisterClass &RC,
514 bool IncludeCalls = true) const;
515
516 std::optional<uint8_t> getVRegFlagValue(StringRef Name) const override {
517 return Name == "WWM_REG" ? AMDGPU::VirtRegFlag::WWM_REG
518 : std::optional<uint8_t>{};
519 }
520
522 getVRegFlagsOfReg(Register Reg, const MachineFunction &MF) const override;
523
524 float
526 // Prioritize VGPR_32_Lo256 over other classes which may occupy registers
527 // beyond v256.
528 return AMDGPUGenRegisterInfo::getSpillWeightScaleFactor(RC) *
529 ((RC == &AMDGPU::VGPR_32_Lo256RegClass ||
530 RC == &AMDGPU::VReg_64_Lo256_Align2RegClass)
531 ? 2.0
532 : 1.0);
533 }
534};
535
536} // End namespace llvm
537
538#endif
static const TargetRegisterClass * getRegClass(const MachineInstr &MI, Register Reg)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
unsigned uint64_t
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
This file implements the BitVector class.
#define LLVM_READONLY
Definition Compiler.h:338
IRTranslator LLVM IR MI
Live Register Matrix
Register Reg
This file defines the SmallVector class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
A debug info location.
Definition DebugLoc.h:126
A set of register units used to track register liveness.
const uint8_t TSFlags
Configurable target specific flags.
Wrapper class representing physical registers. Should be passed by value.
Definition MCRegister.h:41
MachineInstrBundleIterator< MachineInstr > iterator
Representation of each machine instruction.
A description of a memory reference used in the backend.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Represent a mutable reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:294
Holds all the information related to register banks.
This class implements the register bank concept.
Wrapper class representing virtual and physical registers.
Definition Register.h:20
Register materializeFrameBaseRegister(MachineBasicBlock *MBB, int FrameIdx, int64_t Offset) const override
int64_t getScratchInstrOffset(const MachineInstr *MI) const
bool isFrameOffsetLegal(const MachineInstr *MI, Register BaseReg, int64_t Offset) const override
const TargetRegisterClass * getCompatibleSubRegClass(const TargetRegisterClass *SuperRC, const TargetRegisterClass *SubRC, unsigned SubIdx) const
Returns a register class which is compatible with SuperRC, such that a subregister exists with class ...
ArrayRef< MCPhysReg > getAllSGPR64(const MachineFunction &MF) const
Return all SGPR64 which satisfy the waves per execution unit requirement of the subtarget.
MCRegister findUnusedRegister(const MachineRegisterInfo &MRI, const TargetRegisterClass *RC, const MachineFunction &MF, bool ReserveHighestVGPR=false) const
Returns a lowest register that is not used at any point in the function.
static unsigned getSubRegFromChannel(unsigned Channel, unsigned NumRegs=1)
static unsigned getNumCoveredRegs(LaneBitmask LM)
MCPhysReg get32BitRegister(MCPhysReg Reg) const
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override
void buildSpillLoadStore(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, unsigned LoadStoreOp, int Index, Register ValueReg, bool ValueIsKill, MCRegister ScratchOffsetReg, int64_t InstrOffset, MachineMemOperand *MMO, RegScavenger *RS, LiveRegUnits *LiveUnits=nullptr, bool NeedsCFI=false) const
bool requiresFrameIndexReplacementScavenging(const MachineFunction &MF) const override
bool shouldRealignStack(const MachineFunction &MF) const override
bool restoreSGPR(MachineBasicBlock::iterator MI, int FI, RegScavenger *RS, SlotIndexes *Indexes=nullptr, LiveIntervals *LIS=nullptr, bool OnlyToVGPR=false, bool SpillToPhysVGPRLane=false) const
bool isProperlyAlignedRC(const TargetRegisterClass &RC) const
static bool hasVectorRegisters(const TargetRegisterClass *RC)
const TargetRegisterClass * getEquivalentVGPRClass(const TargetRegisterClass *SRC) const
Register getFrameRegister(const MachineFunction &MF) const override
LLVM_READONLY const TargetRegisterClass * getVectorSuperClassForBitWidth(unsigned BitWidth) const
bool spillEmergencySGPR(MachineBasicBlock::iterator MI, MachineBasicBlock &RestoreMBB, Register SGPR, RegScavenger *RS) const
float getSpillWeightScaleFactor(const TargetRegisterClass *RC) const override
SIRegisterInfo(const GCNSubtarget &ST)
const uint32_t * getAllVGPRRegMask() const
MCRegister getReturnAddressReg(const MachineFunction &MF) const
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
bool hasBasePointer(const MachineFunction &MF) const
const TargetRegisterClass * getCrossCopyRegClass(const TargetRegisterClass *RC) const override
Returns a legal register class to copy a register in the specified class to or from.
ArrayRef< int16_t > getRegSplitParts(const TargetRegisterClass *RC, unsigned EltSize) const
ArrayRef< MCPhysReg > getAllSGPR32(const MachineFunction &MF) const
Return all SGPR32 which satisfy the waves per execution unit requirement of the subtarget.
const TargetRegisterClass * getLargestLegalSuperClass(const TargetRegisterClass *RC, const MachineFunction &MF) const override
MCRegister reservedPrivateSegmentBufferReg(const MachineFunction &MF) const
Return the end register initially reserved for the scratch buffer in case spilling is needed.
bool eliminateSGPRToVGPRSpillFrameIndex(MachineBasicBlock::iterator MI, int FI, RegScavenger *RS, SlotIndexes *Indexes=nullptr, LiveIntervals *LIS=nullptr, bool SpillToPhysVGPRLane=false) const
Special case of eliminateFrameIndex.
bool isVGPR(const MachineRegisterInfo &MRI, Register Reg) const
const TargetRegisterClass * getRegClassForBlockOp(const MachineFunction &MF) const
bool getRegAllocationHints(Register VirtReg, ArrayRef< MCPhysReg > Order, SmallSetVector< MCPhysReg, 16 > &Hints, const MachineFunction &MF, const VirtRegMap *VRM, const LiveRegMatrix *Matrix) const override
bool isAsmClobberable(const MachineFunction &MF, MCRegister PhysReg) const override
LLVM_READONLY const TargetRegisterClass * getAGPRClassForBitWidth(unsigned BitWidth) const
static bool isChainScratchRegister(Register VGPR)
bool requiresRegisterScavenging(const MachineFunction &Fn) const override
bool opCanUseInlineConstant(unsigned OpType) const
const TargetRegisterClass * getRegClassForSizeOnBank(unsigned Size, const RegisterBank &Bank) const
bool isVGPRPhysReg(Register Reg) const
bool isUniformReg(const MachineRegisterInfo &MRI, const RegisterBankInfo &RBI, Register Reg) const override
const uint32_t * getNoPreservedMask() const override
bool shouldApplyAntiHints(const MachineFunction &MF, unsigned NumAllocatedVGPRs, unsigned &MaxVGPRsForCurrentOccupancy) const
StringRef getRegAsmName(MCRegister Reg) const override
const uint32_t * getAllAllocatableSRegMask() const
bool isVectorRegister(const MachineRegisterInfo &MRI, Register Reg) const
MCRegister getAlignedHighSGPRForRC(const MachineFunction &MF, const unsigned Align, const TargetRegisterClass *RC) const
Return the largest available SGPR aligned to Align for the register class RC.
void buildCFIForBlockCSRStore(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register BlockReg, int64_t Offset) const
const TargetRegisterClass * getRegClassForReg(const MachineRegisterInfo &MRI, Register Reg) const
unsigned getHWRegIndex(MCRegister Reg) const
const MCPhysReg * getCalleeSavedRegsViaCopy(const MachineFunction *MF) const
const uint32_t * getAllVectorRegMask() const
const TargetRegisterClass * getEquivalentAGPRClass(const TargetRegisterClass *SRC) const
void filterAndSortForAntiHintedRegs(Register VirtReg, MutableArrayRef< MCPhysReg > CustomOrder, const BitVector &AntiHintedRegUnits, const MachineFunction &MF, const LiveRegMatrix *Matrix=nullptr, const RegisterClassInfo *RegClassInfo=nullptr) const override
static LLVM_READONLY const TargetRegisterClass * getSGPRClassForBitWidth(unsigned BitWidth)
const TargetRegisterClass * getRegClassForTypeOnBank(LLT Ty, const RegisterBank &Bank) const
bool opCanUseLiteralConstant(unsigned OpType) const
Register getBaseRegister() const
LLVM_READONLY const TargetRegisterClass * getAlignedLo256VGPRClassForBitWidth(unsigned BitWidth) const
LLVM_READONLY const TargetRegisterClass * getVGPRClassForBitWidth(unsigned BitWidth) const
const TargetRegisterClass * getEquivalentAVClass(const TargetRegisterClass *SRC) const
bool requiresFrameIndexScavenging(const MachineFunction &MF) const override
static bool hasVGPRs(const TargetRegisterClass *RC)
static bool isVGPRClass(const TargetRegisterClass *RC)
MachineInstr * findReachingDef(Register Reg, unsigned SubReg, MachineInstr &Use, MachineRegisterInfo &MRI, LiveIntervals *LIS) const
bool isSGPRReg(const MachineRegisterInfo &MRI, Register Reg) const
const TargetRegisterClass * getEquivalentSGPRClass(const TargetRegisterClass *VRC) const
SmallVector< StringLiteral > getVRegFlagsOfReg(Register Reg, const MachineFunction &MF) const override
unsigned getNumChannelsFromSubReg(unsigned SubReg) const
LLVM_READONLY const TargetRegisterClass * getDefaultVectorSuperClassForBitWidth(unsigned BitWidth) const
unsigned getRegPressureLimit(const TargetRegisterClass *RC, MachineFunction &MF) const override
ArrayRef< MCPhysReg > getAllSGPR128(const MachineFunction &MF) const
Return all SGPR128 which satisfy the waves per execution unit requirement of the subtarget.
unsigned getRegPressureSetLimit(const MachineFunction &MF, unsigned Idx) const override
BitVector getReservedRegs(const MachineFunction &MF) const override
bool needsFrameBaseReg(MachineInstr *MI, int64_t Offset) const override
const TargetRegisterClass * getRegClassForOperandReg(const MachineRegisterInfo &MRI, const MachineOperand &MO) const
void addImplicitUsesForBlockCSRLoad(MachineInstrBuilder &MIB, Register BlockReg) const
bool isSGPRClassID(unsigned RCID) const
unsigned getNumUsedPhysRegs(const MachineRegisterInfo &MRI, const TargetRegisterClass &RC, bool IncludeCalls=true) const
const uint32_t * getAllAGPRRegMask() const
const int * getRegUnitPressureSets(MCRegUnit RegUnit) const override
bool isDivergentRegClass(const TargetRegisterClass *RC) const override
const TargetRegisterClass * getBoolRC() const
bool isAGPR(const MachineRegisterInfo &MRI, Register Reg) const
bool eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS) const override
bool spillSGPR(MachineBasicBlock::iterator MI, int FI, RegScavenger *RS, SlotIndexes *Indexes=nullptr, LiveIntervals *LIS=nullptr, bool OnlyToVGPR=false, bool SpillToPhysVGPRLane=false, bool NeedsCFI=false) const
If OnlyToVGPR is true, this will only succeed if this manages to find a free VGPR lane to spill.
bool isVSSuperClass(const TargetRegisterClass *RC) const
unsigned getChannelFromSubReg(unsigned SubReg) const
MCRegister getExec() const
bool isSGPRPhysReg(Register Reg) const
std::optional< uint8_t > getVRegFlagValue(StringRef Name) const override
MCRegister getVCC() const
int64_t getFrameIndexInstrOffset(const MachineInstr *MI, int Idx) const override
bool isVectorSuperClass(const TargetRegisterClass *RC) const
bool isRegClassAligned(const TargetRegisterClass *RC, unsigned AlignNumBits) const
static bool hasAGPRs(const TargetRegisterClass *RC)
const TargetRegisterClass * getWaveMaskRegClass() const
unsigned getSubRegAlignmentNumBits(const TargetRegisterClass *RC, unsigned SubReg) const
static bool hasSGPRs(const TargetRegisterClass *RC)
void resolveFrameIndex(MachineInstr &MI, Register BaseReg, int64_t Offset) const override
bool requiresVirtualBaseRegisters(const MachineFunction &Fn) const override
unsigned getCSRFirstUseCost(const MachineFunction &) const override
bool spillSGPRToVGPR() const
const TargetRegisterClass * getVGPR64Class() const
void buildVGPRSpillLoadStore(SGPRSpillBuilder &SB, int Index, int Offset, bool IsLoad, bool IsKill=true) const
bool isCFISavedRegsSpillEnabled() const
unsigned getRegClassAlignmentNumBits(const TargetRegisterClass *RC) const
static bool isSGPRClass(const TargetRegisterClass *RC)
static bool isAGPRClass(const TargetRegisterClass *RC)
const TargetRegisterClass * getConstrainedRegClassForReg(Register Reg, const MachineRegisterInfo &MRI) const override
SlotIndexes pass.
A SetVector that performs no allocations if smaller than a certain size.
Definition SetVector.h:345
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
A Use represents the edge between a Value definition and its users.
Definition Use.h:35
Register allocation hint types. Helps eliminate unneeded COPY with True16.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
constexpr int popcount(T Value) noexcept
Count the number of set bits in a value.
Definition bit.h:156
@ HasSGPR
Definition SIDefines.h:29
@ RegTupleAlignUnitsMask
Definition SIDefines.h:31
@ HasVGPR
Definition SIDefines.h:27
@ HasAGPR
Definition SIDefines.h:28
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
Definition MCRegister.h:21
constexpr unsigned BitWidth
MCRegisterClass TargetRegisterClass
Definition FastISel.h:58
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
constexpr Type getAsInteger() const
Definition LaneBitmask.h:74