LLVM 22.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"
18
19#define GET_REGINFO_HEADER
20#include "AMDGPUGenRegisterInfo.inc"
21
22#include "SIDefines.h"
23
24namespace llvm {
25
26class GCNSubtarget;
27class LiveIntervals;
28class LiveRegUnits;
29class MachineInstrBuilder;
30class RegisterBank;
31struct SGPRSpillBuilder;
32
33/// Register allocation hint types. Helps eliminate unneeded COPY with True16
34namespace AMDGPURI {
35
36enum { Size16 = 1, Size32 = 2 };
37
38} // end namespace AMDGPURI
39
41private:
42 const GCNSubtarget &ST;
43 bool SpillSGPRToVGPR;
44 bool isWave32;
45 BitVector RegPressureIgnoredUnits;
46
47 /// Sub reg indexes for getRegSplitParts.
48 /// First index represents subreg size from 1 to 32 Half DWORDS.
49 /// The inner vector is sorted by bit offset.
50 /// Provided a register can be fully split with given subregs,
51 /// all elements of the inner vector combined give a full lane mask.
52 static std::array<std::vector<int16_t>, 32> RegSplitParts;
53
54 // Table representing sub reg of given width and offset.
55 // First index is subreg size: 32, 64, 96, 128, 160, 192, 224, 256, 512.
56 // Second index is 32 different dword offsets.
57 static std::array<std::array<uint16_t, 32>, 9> SubRegFromChannelTable;
58
59 void reserveRegisterTuples(BitVector &, MCRegister Reg) const;
60
61public:
63
64 struct SpilledReg {
66 int Lane = -1;
67
68 SpilledReg() = default;
69 SpilledReg(Register R, int L) : VGPR(R), Lane(L) {}
70
71 bool hasLane() { return Lane != -1; }
72 bool hasReg() { return VGPR != 0; }
73 };
74
75 /// \returns the sub reg enum value for the given \p Channel
76 /// (e.g. getSubRegFromChannel(0) -> AMDGPU::sub0)
77 static unsigned getSubRegFromChannel(unsigned Channel, unsigned NumRegs = 1);
78
79 bool spillSGPRToVGPR() const {
80 return SpillSGPRToVGPR;
81 }
82
83 /// Return the largest available SGPR aligned to \p Align for the register
84 /// class \p RC.
86 const unsigned Align,
87 const TargetRegisterClass *RC) const;
88
89 /// Return the end register initially reserved for the scratch buffer in case
90 /// spilling is needed.
92
93 BitVector getReservedRegs(const MachineFunction &MF) const override;
94 bool isAsmClobberable(const MachineFunction &MF,
95 MCRegister PhysReg) const override;
96
97 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
100 CallingConv::ID) const override;
101 const uint32_t *getNoPreservedMask() const override;
102
103 // Functions with the amdgpu_cs_chain or amdgpu_cs_chain_preserve calling
104 // conventions are free to use certain VGPRs without saving and restoring any
105 // lanes (not even inactive ones).
106 static bool isChainScratchRegister(Register VGPR);
107
108 // Stack access is very expensive. CSRs are also the high registers, and we
109 // want to minimize the number of used registers.
110 unsigned getCSRFirstUseCost() const override {
111 return 100;
112 }
113
114 // When building a block VGPR load, we only really transfer a subset of the
115 // registers in the block, based on a mask. Liveness analysis is not aware of
116 // the mask, so it might consider that any register in the block is available
117 // before the load and may therefore be scavenged. This is not ok for CSRs
118 // that are not clobbered, since the caller will expect them to be preserved.
119 // This method will add artificial implicit uses for those registers on the
120 // load instruction, so liveness analysis knows they're unavailable.
122 Register BlockReg) const;
123
124 const TargetRegisterClass *
126 const MachineFunction &MF) const override;
127
128 Register getFrameRegister(const MachineFunction &MF) const override;
129
130 bool hasBasePointer(const MachineFunction &MF) const;
132
133 bool shouldRealignStack(const MachineFunction &MF) const override;
134 bool requiresRegisterScavenging(const MachineFunction &Fn) const override;
135
136 bool requiresFrameIndexScavenging(const MachineFunction &MF) const override;
138 const MachineFunction &MF) const override;
139 bool requiresVirtualBaseRegisters(const MachineFunction &Fn) const override;
140
141 int64_t getScratchInstrOffset(const MachineInstr *MI) const;
142
144 int Idx) const override;
145
146 bool needsFrameBaseReg(MachineInstr *MI, int64_t Offset) const override;
147
149 int64_t Offset) const override;
150
152 int64_t Offset) const override;
153
154 bool isFrameOffsetLegal(const MachineInstr *MI, Register BaseReg,
155 int64_t Offset) const override;
156
157 const TargetRegisterClass *
158 getPointerRegClass(unsigned Kind = 0) const override;
159
160 /// Returns a legal register class to copy a register in the specified class
161 /// to or from. If it is possible to copy the register directly without using
162 /// a cross register class copy, return the specified RC. Returns NULL if it
163 /// is not possible to copy between two registers of the specified class.
164 const TargetRegisterClass *
165 getCrossCopyRegClass(const TargetRegisterClass *RC) const override;
166
167 const TargetRegisterClass *
169 return &AMDGPU::VReg_1024RegClass;
170 }
171
172 void buildVGPRSpillLoadStore(SGPRSpillBuilder &SB, int Index, int Offset,
173 bool IsLoad, bool IsKill = true) const;
174
175 /// If \p OnlyToVGPR is true, this will only succeed if this manages to find a
176 /// free VGPR lane to spill.
178 SlotIndexes *Indexes = nullptr, LiveIntervals *LIS = nullptr,
179 bool OnlyToVGPR = false,
180 bool SpillToPhysVGPRLane = false) const;
181
183 SlotIndexes *Indexes = nullptr, LiveIntervals *LIS = nullptr,
184 bool OnlyToVGPR = false,
185 bool SpillToPhysVGPRLane = false) const;
186
188 MachineBasicBlock &RestoreMBB, Register SGPR,
189 RegScavenger *RS) const;
190
192 unsigned FIOperandNum,
193 RegScavenger *RS) const override;
194
197 SlotIndexes *Indexes = nullptr, LiveIntervals *LIS = nullptr,
198 bool SpillToPhysVGPRLane = false) const;
199
200 StringRef getRegAsmName(MCRegister Reg) const override;
201
202 // Pseudo regs are not allowed
203 unsigned getHWRegIndex(MCRegister Reg) const;
204
207
210
213
215 const TargetRegisterClass *
217
219 const TargetRegisterClass *
221
224
225 /// \returns true if this class contains only SGPR registers
226 static bool isSGPRClass(const TargetRegisterClass *RC) {
227 return hasSGPRs(RC) && !hasVGPRs(RC) && !hasAGPRs(RC);
228 }
229
230 /// \returns true if this class ID contains only SGPR registers
231 bool isSGPRClassID(unsigned RCID) const {
232 return isSGPRClass(getRegClass(RCID));
233 }
234
235 bool isSGPRReg(const MachineRegisterInfo &MRI, Register Reg) const;
237 return isSGPRClass(getPhysRegBaseClass(Reg));
238 }
239
241 return isVGPRClass(getPhysRegBaseClass(Reg));
242 }
243
244 /// \returns true if this class contains only VGPR registers
245 static bool isVGPRClass(const TargetRegisterClass *RC) {
246 return hasVGPRs(RC) && !hasAGPRs(RC) && !hasSGPRs(RC);
247 }
248
249 /// \returns true if this class contains only AGPR registers
250 static bool isAGPRClass(const TargetRegisterClass *RC) {
251 return hasAGPRs(RC) && !hasVGPRs(RC) && !hasSGPRs(RC);
252 }
253
254 /// \returns true only if this class contains both VGPR and AGPR registers
256 return hasVGPRs(RC) && hasAGPRs(RC) && !hasSGPRs(RC);
257 }
258
259 /// \returns true only if this class contains both VGPR and SGPR registers
260 bool isVSSuperClass(const TargetRegisterClass *RC) const {
261 return hasVGPRs(RC) && hasSGPRs(RC) && !hasAGPRs(RC);
262 }
263
264 /// \returns true if this class contains VGPR registers.
265 static bool hasVGPRs(const TargetRegisterClass *RC) {
266 return RC->TSFlags & SIRCFlags::HasVGPR;
267 }
268
269 /// \returns true if this class contains AGPR registers.
270 static bool hasAGPRs(const TargetRegisterClass *RC) {
271 return RC->TSFlags & SIRCFlags::HasAGPR;
272 }
273
274 /// \returns true if this class contains SGPR registers.
275 static bool hasSGPRs(const TargetRegisterClass *RC) {
276 return RC->TSFlags & SIRCFlags::HasSGPR;
277 }
278
279 /// \returns true if this class contains any vector registers.
281 return hasVGPRs(RC) || hasAGPRs(RC);
282 }
283
284 /// \returns A VGPR reg class with the same width as \p SRC
285 const TargetRegisterClass *
287
288 /// \returns An AGPR reg class with the same width as \p SRC
289 const TargetRegisterClass *
291
292 /// \returns An AGPR+VGPR super reg class with the same width as \p SRC
293 const TargetRegisterClass *
295
296 /// \returns A SGPR reg class with the same width as \p SRC
297 const TargetRegisterClass *
299
300 /// Returns a register class which is compatible with \p SuperRC, such that a
301 /// subregister exists with class \p SubRC with subregister index \p
302 /// SubIdx. If this is impossible (e.g., an unaligned subregister index within
303 /// a register tuple), return null.
304 const TargetRegisterClass *
306 const TargetRegisterClass *SubRC,
307 unsigned SubIdx) const;
308
309 /// \returns True if operands defined with this operand type can accept
310 /// a literal constant (i.e. any 32-bit immediate).
311 bool opCanUseLiteralConstant(unsigned OpType) const;
312
313 /// \returns True if operands defined with this operand type can accept
314 /// an inline constant. i.e. An integer value in the range (-16, 64) or
315 /// -4.0f, -2.0f, -1.0f, -0.5f, 0.0f, 0.5f, 1.0f, 2.0f, 4.0f.
316 bool opCanUseInlineConstant(unsigned OpType) const;
317
319 const TargetRegisterClass *RC,
320 const MachineFunction &MF,
321 bool ReserveHighestVGPR = false) const;
322
324 Register Reg) const;
325 const TargetRegisterClass *
327 const MachineOperand &MO) const;
328
329 bool isVGPR(const MachineRegisterInfo &MRI, Register Reg) const;
330 bool isAGPR(const MachineRegisterInfo &MRI, Register Reg) const;
332 return isVGPR(MRI, Reg) || isAGPR(MRI, Reg);
333 }
334
335 // FIXME: SGPRs are assumed to be uniform, but this is not true for i1 SGPRs
336 // (such as VCC) which hold a wave-wide vector of boolean values. Examining
337 // just the register class is not suffcient; it needs to be combined with a
338 // value type. The next predicate isUniformReg() does this correctly.
339 bool isDivergentRegClass(const TargetRegisterClass *RC) const override {
340 return !isSGPRClass(RC);
341 }
342
344 Register Reg) const override;
345
347 unsigned EltSize) const;
348
350 const TargetRegisterClass *SrcRC,
351 unsigned SubReg,
352 const TargetRegisterClass *DstRC,
353 unsigned DstSubReg,
354 const TargetRegisterClass *NewRC,
355 LiveIntervals &LIS) const override;
356
357 unsigned getRegPressureLimit(const TargetRegisterClass *RC,
358 MachineFunction &MF) const override;
359
360 unsigned getRegPressureSetLimit(const MachineFunction &MF,
361 unsigned Idx) const override;
362
365 const MachineFunction &MF, const VirtRegMap *VRM,
366 const LiveRegMatrix *Matrix) const override;
367
368 const int *getRegUnitPressureSets(MCRegUnit RegUnit) const override;
369
371
372 const TargetRegisterClass *
373 getRegClassForSizeOnBank(unsigned Size, const RegisterBank &Bank) const;
374
375 const TargetRegisterClass *
377 return getRegClassForSizeOnBank(Ty.getSizeInBits(), Bank);
378 }
379
380 const TargetRegisterClass *
382 const MachineRegisterInfo &MRI) const override;
383
385 return isWave32 ? &AMDGPU::SReg_32RegClass
386 : &AMDGPU::SReg_64RegClass;
387 }
388
390 return isWave32 ? &AMDGPU::SReg_32_XM0_XEXECRegClass
391 : &AMDGPU::SReg_64_XEXECRegClass;
392 }
393
394 // Return the appropriate register class to use for 64-bit VGPRs for the
395 // subtarget.
396 const TargetRegisterClass *getVGPR64Class() const;
397
398 MCRegister getVCC() const;
399
400 MCRegister getExec() const;
401
402 // Find reaching register definition
406 LiveIntervals *LIS) const;
407
408 const uint32_t *getAllVGPRRegMask() const;
409 const uint32_t *getAllAGPRRegMask() const;
410 const uint32_t *getAllVectorRegMask() const;
411 const uint32_t *getAllAllocatableSRegMask() const;
412
413 // \returns number of 32 bit registers covered by a \p LM
414 static unsigned getNumCoveredRegs(LaneBitmask LM) {
415 // The assumption is that every lo16 subreg is an even bit and every hi16
416 // is an adjacent odd bit or vice versa.
417 uint64_t Mask = LM.getAsInteger();
418 uint64_t Even = Mask & 0xAAAAAAAAAAAAAAAAULL;
419 Mask = (Even >> 1) | Mask;
420 uint64_t Odd = Mask & 0x5555555555555555ULL;
421 return llvm::popcount(Odd);
422 }
423
424 // \returns a DWORD offset of a \p SubReg
425 unsigned getChannelFromSubReg(unsigned SubReg) const {
426 return SubReg ? (getSubRegIdxOffset(SubReg) + 31) / 32 : 0;
427 }
428
429 // \returns a DWORD size of a \p SubReg
430 unsigned getNumChannelsFromSubReg(unsigned SubReg) const {
431 return getNumCoveredRegs(getSubRegIndexLaneMask(SubReg));
432 }
433
434 // For a given 16 bit \p Reg \returns a 32 bit register holding it.
435 // \returns \p Reg otherwise.
437
438 // Returns true if a given register class is properly aligned for
439 // the subtarget.
440 bool isProperlyAlignedRC(const TargetRegisterClass &RC) const;
441
442 /// Return all SGPR128 which satisfy the waves per execution unit requirement
443 /// of the subtarget.
445
446 /// Return all SGPR64 which satisfy the waves per execution unit requirement
447 /// of the subtarget.
449
450 /// Return all SGPR32 which satisfy the waves per execution unit requirement
451 /// of the subtarget.
453
454 // Insert spill or restore instructions.
455 // When lowering spill pseudos, the RegScavenger should be set.
456 // For creating spill instructions during frame lowering, where no scavenger
457 // is available, LiveUnits can be used.
460 unsigned LoadStoreOp, int Index, Register ValueReg,
461 bool ValueIsKill, MCRegister ScratchOffsetReg,
462 int64_t InstrOffset, MachineMemOperand *MMO,
463 RegScavenger *RS,
464 LiveRegUnits *LiveUnits = nullptr) const;
465
466 // Return alignment in register file of first register in a register tuple.
468 return (RC->TSFlags & SIRCFlags::RegTupleAlignUnitsMask) * 32;
469 }
470
471 // Check if register class RC has required alignment.
473 unsigned AlignNumBits) const {
474 assert(AlignNumBits != 0);
475 unsigned RCAlign = getRegClassAlignmentNumBits(RC);
476 return RCAlign == AlignNumBits ||
477 (RCAlign > AlignNumBits && (RCAlign % AlignNumBits) == 0);
478 }
479
480 // Return alignment of a SubReg relative to start of a register in RC class.
481 // No check if the subreg is supported by the current RC is made.
483 unsigned SubReg) const;
484
485 // \returns a number of registers of a given \p RC used in a function.
486 // Does not go inside function calls. If \p IncludeCalls is true, it will
487 // include registers that may be clobbered by calls.
489 const TargetRegisterClass &RC,
490 bool IncludeCalls = true) const;
491
492 std::optional<uint8_t> getVRegFlagValue(StringRef Name) const override {
493 return Name == "WWM_REG" ? AMDGPU::VirtRegFlag::WWM_REG
494 : std::optional<uint8_t>{};
495 }
496
498 getVRegFlagsOfReg(Register Reg, const MachineFunction &MF) const override;
499};
500
501namespace AMDGPU {
502/// Get the size in bits of a register from the register class \p RC.
503unsigned getRegBitWidth(const TargetRegisterClass &RC);
504} // namespace AMDGPU
505
506} // End namespace llvm
507
508#endif
unsigned SubReg
unsigned const MachineRegisterInfo * MRI
static const TargetRegisterClass * getRegClass(const MachineInstr &MI, Register Reg)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file implements the BitVector class.
#define LLVM_READONLY
Definition Compiler.h:322
IRTranslator LLVM IR MI
Live Register Matrix
Register Reg
ArrayRef - 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:124
A set of register units used to track register liveness.
Wrapper class representing physical registers. Should be passed by value.
Definition MCRegister.h:33
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,...
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
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
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
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) const
const TargetRegisterClass * getRegClassForBlockOp(const MachineFunction &MF) const
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
const TargetRegisterClass * getConstrainedRegClassForOperand(const MachineOperand &MO, const MachineRegisterInfo &MRI) const override
bool isVGPRPhysReg(Register Reg) const
bool isUniformReg(const MachineRegisterInfo &MRI, const RegisterBankInfo &RBI, Register Reg) const override
const uint32_t * getNoPreservedMask() const override
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.
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
static LLVM_READONLY const TargetRegisterClass * getSGPRClassForBitWidth(unsigned BitWidth)
const TargetRegisterClass * getPointerRegClass(unsigned Kind=0) const override
const TargetRegisterClass * getRegClassForTypeOnBank(LLT Ty, const RegisterBank &Bank) const
bool opCanUseLiteralConstant(unsigned OpType) const
Register getBaseRegister() const
bool getRegAllocationHints(Register VirtReg, ArrayRef< MCPhysReg > Order, SmallVectorImpl< MCPhysReg > &Hints, const MachineFunction &MF, const VirtRegMap *VRM, const LiveRegMatrix *Matrix) const override
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
unsigned getCSRFirstUseCost() 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 shouldCoalesce(MachineInstr *MI, const TargetRegisterClass *SrcRC, unsigned SubReg, const TargetRegisterClass *DstRC, unsigned DstSubReg, const TargetRegisterClass *NewRC, LiveIntervals &LIS) 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 isVSSuperClass(const TargetRegisterClass *RC) const
bool spillSGPR(MachineBasicBlock::iterator MI, int FI, RegScavenger *RS, SlotIndexes *Indexes=nullptr, LiveIntervals *LIS=nullptr, bool OnlyToVGPR=false, bool SpillToPhysVGPRLane=false) const
If OnlyToVGPR is true, this will only succeed if this manages to find a free VGPR lane to spill.
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
bool spillSGPRToVGPR() const
const TargetRegisterClass * getVGPR64Class() const
void buildVGPRSpillLoadStore(SGPRSpillBuilder &SB, int Index, int Offset, bool IsLoad, bool IsKill=true) const
unsigned getRegClassAlignmentNumBits(const TargetRegisterClass *RC) const
static bool isSGPRClass(const TargetRegisterClass *RC)
static bool isAGPRClass(const TargetRegisterClass *RC)
SlotIndexes pass.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
const uint8_t TSFlags
Configurable target specific flags.
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 getRegBitWidth(const TargetRegisterClass &RC)
Get the size in bits of a register from the register class RC.
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:477
constexpr int popcount(T Value) noexcept
Count the number of set bits in a value.
Definition bit.h:154
@ HasSGPR
Definition SIDefines.h:26
@ RegTupleAlignUnitsMask
Definition SIDefines.h:28
@ HasVGPR
Definition SIDefines.h:24
@ HasAGPR
Definition SIDefines.h:25
unsigned MCRegUnit
Register units are used to compute register aliasing.
Definition MCRegister.h:30
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
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