@@ -162,17 +162,18 @@ AArch64RegisterBankInfo::AArch64RegisterBankInfo(
162
162
unsigned PartialMapSrcIdx = PMI_##RBNameSrc##Size - PMI_Min; \
163
163
(void )PartialMapDstIdx; \
164
164
(void )PartialMapSrcIdx; \
165
- const ValueMapping *Map = getCopyMapping ( \
166
- AArch64::RBNameDst##RegBankID, AArch64::RBNameSrc##RegBankID, Size); \
165
+ const ValueMapping *Map = getCopyMapping (AArch64::RBNameDst##RegBankID, \
166
+ AArch64::RBNameSrc##RegBankID, \
167
+ TypeSize::getFixed (Size)); \
167
168
(void )Map; \
168
169
assert (Map[0 ].BreakDown == \
169
170
&AArch64GenRegisterBankInfo::PartMappings[PartialMapDstIdx] && \
170
- Map[0 ].NumBreakDowns == 1 && #RBNameDst #Size \
171
- " Dst is incorrectly initialized" ); \
171
+ Map[0 ].NumBreakDowns == 1 && \
172
+ #RBNameDst #Size " Dst is incorrectly initialized" ); \
172
173
assert (Map[1 ].BreakDown == \
173
174
&AArch64GenRegisterBankInfo::PartMappings[PartialMapSrcIdx] && \
174
- Map[1 ].NumBreakDowns == 1 && #RBNameSrc #Size \
175
- " Src is incorrectly initialized" ); \
175
+ Map[1 ].NumBreakDowns == 1 && \
176
+ #RBNameSrc #Size " Src is incorrectly initialized" ); \
176
177
\
177
178
} while (false )
178
179
@@ -256,6 +257,9 @@ AArch64RegisterBankInfo::getRegBankFromRegClass(const TargetRegisterClass &RC,
256
257
case AArch64::QQRegClassID:
257
258
case AArch64::QQQRegClassID:
258
259
case AArch64::QQQQRegClassID:
260
+ case AArch64::ZPR_3bRegClassID:
261
+ case AArch64::ZPR_4bRegClassID:
262
+ case AArch64::ZPRRegClassID:
259
263
return getRegBank (AArch64::FPRRegBankID);
260
264
case AArch64::GPR32commonRegClassID:
261
265
case AArch64::GPR32RegClassID:
@@ -300,8 +304,8 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
300
304
case TargetOpcode::G_OR: {
301
305
// 32 and 64-bit or can be mapped on either FPR or
302
306
// GPR for the same cost.
303
- unsigned Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
304
- if (Size != 32 && Size != 64 )
307
+ TypeSize Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
308
+ if (Size != TypeSize::getFixed ( 32 ) && Size != TypeSize::getFixed ( 64 ) )
305
309
break ;
306
310
307
311
// If the instruction has any implicit-defs or uses,
@@ -321,8 +325,8 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
321
325
return AltMappings;
322
326
}
323
327
case TargetOpcode::G_BITCAST: {
324
- unsigned Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
325
- if (Size != 32 && Size != 64 )
328
+ TypeSize Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
329
+ if (Size != TypeSize::getFixed ( 32 ) && Size != TypeSize::getFixed ( 64 ) )
326
330
break ;
327
331
328
332
// If the instruction has any implicit-defs or uses,
@@ -341,16 +345,12 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
341
345
/* NumOperands*/ 2 );
342
346
const InstructionMapping &GPRToFPRMapping = getInstructionMapping (
343
347
/* ID*/ 3 ,
344
- /* Cost*/
345
- copyCost (AArch64::GPRRegBank, AArch64::FPRRegBank,
346
- TypeSize::getFixed (Size)),
348
+ /* Cost*/ copyCost (AArch64::GPRRegBank, AArch64::FPRRegBank, Size),
347
349
getCopyMapping (AArch64::FPRRegBankID, AArch64::GPRRegBankID, Size),
348
350
/* NumOperands*/ 2 );
349
351
const InstructionMapping &FPRToGPRMapping = getInstructionMapping (
350
352
/* ID*/ 3 ,
351
- /* Cost*/
352
- copyCost (AArch64::GPRRegBank, AArch64::FPRRegBank,
353
- TypeSize::getFixed (Size)),
353
+ /* Cost*/ copyCost (AArch64::GPRRegBank, AArch64::FPRRegBank, Size),
354
354
getCopyMapping (AArch64::GPRRegBankID, AArch64::FPRRegBankID, Size),
355
355
/* NumOperands*/ 2 );
356
356
@@ -361,8 +361,8 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
361
361
return AltMappings;
362
362
}
363
363
case TargetOpcode::G_LOAD: {
364
- unsigned Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
365
- if (Size != 64 )
364
+ TypeSize Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
365
+ if (Size != TypeSize::getFixed ( 64 ) )
366
366
break ;
367
367
368
368
// If the instruction has any implicit-defs or uses,
@@ -373,15 +373,17 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
373
373
InstructionMappings AltMappings;
374
374
const InstructionMapping &GPRMapping = getInstructionMapping (
375
375
/* ID*/ 1 , /* Cost*/ 1 ,
376
- getOperandsMapping ({getValueMapping (PMI_FirstGPR, Size),
377
- // Addresses are GPR 64-bit.
378
- getValueMapping (PMI_FirstGPR, 64 )}),
376
+ getOperandsMapping (
377
+ {getValueMapping (PMI_FirstGPR, Size),
378
+ // Addresses are GPR 64-bit.
379
+ getValueMapping (PMI_FirstGPR, TypeSize::getFixed (64 ))}),
379
380
/* NumOperands*/ 2 );
380
381
const InstructionMapping &FPRMapping = getInstructionMapping (
381
382
/* ID*/ 2 , /* Cost*/ 1 ,
382
- getOperandsMapping ({getValueMapping (PMI_FirstFPR, Size),
383
- // Addresses are GPR 64-bit.
384
- getValueMapping (PMI_FirstGPR, 64 )}),
383
+ getOperandsMapping (
384
+ {getValueMapping (PMI_FirstFPR, Size),
385
+ // Addresses are GPR 64-bit.
386
+ getValueMapping (PMI_FirstGPR, TypeSize::getFixed (64 ))}),
385
387
/* NumOperands*/ 2 );
386
388
387
389
AltMappings.push_back (&GPRMapping);
@@ -459,7 +461,7 @@ AArch64RegisterBankInfo::getSameKindOfOperandsMapping(
459
461
" This code is for instructions with 3 or less operands" );
460
462
461
463
LLT Ty = MRI.getType (MI.getOperand (0 ).getReg ());
462
- unsigned Size = Ty.getSizeInBits ();
464
+ TypeSize Size = Ty.getSizeInBits ();
463
465
bool IsFPR = Ty.isVector () || isPreISelGenericFloatingPointOpcode (Opc);
464
466
465
467
PartialMappingIdx RBIdx = IsFPR ? PMI_FirstFPR : PMI_FirstGPR;
@@ -719,9 +721,9 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
719
721
// If both RB are null that means both registers are generic.
720
722
// We shouldn't be here.
721
723
assert (DstRB && SrcRB && " Both RegBank were nullptr" );
722
- unsigned Size = getSizeInBits (DstReg, MRI, TRI);
724
+ TypeSize Size = getSizeInBits (DstReg, MRI, TRI);
723
725
return getInstructionMapping (
724
- DefaultMappingID, copyCost (*DstRB, *SrcRB, TypeSize::getFixed ( Size) ),
726
+ DefaultMappingID, copyCost (*DstRB, *SrcRB, Size),
725
727
getCopyMapping (DstRB->getID (), SrcRB->getID (), Size),
726
728
// We only care about the mapping of the destination.
727
729
/* NumOperands*/ 1 );
@@ -732,15 +734,15 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
732
734
case TargetOpcode::G_BITCAST: {
733
735
LLT DstTy = MRI.getType (MI.getOperand (0 ).getReg ());
734
736
LLT SrcTy = MRI.getType (MI.getOperand (1 ).getReg ());
735
- unsigned Size = DstTy.getSizeInBits ();
737
+ TypeSize Size = DstTy.getSizeInBits ();
736
738
bool DstIsGPR = !DstTy.isVector () && DstTy.getSizeInBits () <= 64 ;
737
739
bool SrcIsGPR = !SrcTy.isVector () && SrcTy.getSizeInBits () <= 64 ;
738
740
const RegisterBank &DstRB =
739
741
DstIsGPR ? AArch64::GPRRegBank : AArch64::FPRRegBank;
740
742
const RegisterBank &SrcRB =
741
743
SrcIsGPR ? AArch64::GPRRegBank : AArch64::FPRRegBank;
742
744
return getInstructionMapping (
743
- DefaultMappingID, copyCost (DstRB, SrcRB, TypeSize::getFixed ( Size) ),
745
+ DefaultMappingID, copyCost (DstRB, SrcRB, Size),
744
746
getCopyMapping (DstRB.getID (), SrcRB.getID (), Size),
745
747
// We only care about the mapping of the destination for COPY.
746
748
/* NumOperands*/ Opc == TargetOpcode::G_BITCAST ? 2 : 1 );
@@ -752,7 +754,7 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
752
754
unsigned NumOperands = MI.getNumOperands ();
753
755
754
756
// Track the size and bank of each register. We don't do partial mappings.
755
- SmallVector<unsigned , 4 > OpSize (NumOperands);
757
+ SmallVector<TypeSize , 4 > OpSize (NumOperands, TypeSize::getFixed ( 0 ) );
756
758
SmallVector<PartialMappingIdx, 4 > OpRegBankIdx (NumOperands);
757
759
for (unsigned Idx = 0 ; Idx < NumOperands; ++Idx) {
758
760
auto &MO = MI.getOperand (Idx);
@@ -833,7 +835,7 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
833
835
Cost = copyCost (
834
836
*AArch64GenRegisterBankInfo::PartMappings[OpRegBankIdx[0 ]].RegBank ,
835
837
*AArch64GenRegisterBankInfo::PartMappings[OpRegBankIdx[1 ]].RegBank ,
836
- TypeSize::getFixed ( OpSize[0 ]) );
838
+ OpSize[0 ]);
837
839
break ;
838
840
case TargetOpcode::G_LOAD: {
839
841
// Loading in vector unit is slightly more expensive.
0 commit comments