@@ -163,17 +163,18 @@ AArch64RegisterBankInfo::AArch64RegisterBankInfo(
163
163
unsigned PartialMapSrcIdx = PMI_##RBNameSrc##Size - PMI_Min; \
164
164
(void )PartialMapDstIdx; \
165
165
(void )PartialMapSrcIdx; \
166
- const ValueMapping *Map = getCopyMapping ( \
167
- AArch64::RBNameDst##RegBankID, AArch64::RBNameSrc##RegBankID, Size); \
166
+ const ValueMapping *Map = getCopyMapping (AArch64::RBNameDst##RegBankID, \
167
+ AArch64::RBNameSrc##RegBankID, \
168
+ TypeSize::getFixed (Size)); \
168
169
(void )Map; \
169
170
assert (Map[0 ].BreakDown == \
170
171
&AArch64GenRegisterBankInfo::PartMappings[PartialMapDstIdx] && \
171
- Map[0 ].NumBreakDowns == 1 && #RBNameDst #Size \
172
- " Dst is incorrectly initialized" ); \
172
+ Map[0 ].NumBreakDowns == 1 && \
173
+ #RBNameDst #Size " Dst is incorrectly initialized" ); \
173
174
assert (Map[1 ].BreakDown == \
174
175
&AArch64GenRegisterBankInfo::PartMappings[PartialMapSrcIdx] && \
175
- Map[1 ].NumBreakDowns == 1 && #RBNameSrc #Size \
176
- " Src is incorrectly initialized" ); \
176
+ Map[1 ].NumBreakDowns == 1 && \
177
+ #RBNameSrc #Size " Src is incorrectly initialized" ); \
177
178
\
178
179
} while (false )
179
180
@@ -218,7 +219,7 @@ AArch64RegisterBankInfo::AArch64RegisterBankInfo(
218
219
219
220
unsigned AArch64RegisterBankInfo::copyCost (const RegisterBank &A,
220
221
const RegisterBank &B,
221
- TypeSize Size) const {
222
+ const TypeSize Size) const {
222
223
// What do we do with different size?
223
224
// copy are same size.
224
225
// Will introduce other hooks for different size:
@@ -258,6 +259,7 @@ AArch64RegisterBankInfo::getRegBankFromRegClass(const TargetRegisterClass &RC,
258
259
case AArch64::QQQRegClassID:
259
260
case AArch64::QQQQRegClassID:
260
261
case AArch64::ZPRRegClassID:
262
+ case AArch64::ZPR_3bRegClassID:
261
263
return getRegBank (AArch64::FPRRegBankID);
262
264
case AArch64::GPR32commonRegClassID:
263
265
case AArch64::GPR32RegClassID:
@@ -304,7 +306,7 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
304
306
case TargetOpcode::G_OR: {
305
307
// 32 and 64-bit or can be mapped on either FPR or
306
308
// GPR for the same cost.
307
- unsigned Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
309
+ TypeSize Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
308
310
if (Size != 32 && Size != 64 )
309
311
break ;
310
312
@@ -325,7 +327,7 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
325
327
return AltMappings;
326
328
}
327
329
case TargetOpcode::G_BITCAST: {
328
- unsigned Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
330
+ TypeSize Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
329
331
if (Size != 32 && Size != 64 )
330
332
break ;
331
333
@@ -365,7 +367,7 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
365
367
return AltMappings;
366
368
}
367
369
case TargetOpcode::G_LOAD: {
368
- unsigned Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
370
+ TypeSize Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
369
371
if (Size != 64 )
370
372
break ;
371
373
@@ -377,15 +379,17 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
377
379
InstructionMappings AltMappings;
378
380
const InstructionMapping &GPRMapping = getInstructionMapping (
379
381
/* ID*/ 1 , /* Cost*/ 1 ,
380
- getOperandsMapping ({getValueMapping (PMI_FirstGPR, Size),
381
- // Addresses are GPR 64-bit.
382
- getValueMapping (PMI_FirstGPR, 64 )}),
382
+ getOperandsMapping (
383
+ {getValueMapping (PMI_FirstGPR, Size),
384
+ // Addresses are GPR 64-bit.
385
+ getValueMapping (PMI_FirstGPR, TypeSize::getFixed (64 ))}),
383
386
/* NumOperands*/ 2 );
384
387
const InstructionMapping &FPRMapping = getInstructionMapping (
385
388
/* ID*/ 2 , /* Cost*/ 1 ,
386
- getOperandsMapping ({getValueMapping (PMI_FirstFPR, Size),
387
- // Addresses are GPR 64-bit.
388
- getValueMapping (PMI_FirstGPR, 64 )}),
389
+ getOperandsMapping (
390
+ {getValueMapping (PMI_FirstFPR, Size),
391
+ // Addresses are GPR 64-bit.
392
+ getValueMapping (PMI_FirstGPR, TypeSize::getFixed (64 ))}),
389
393
/* NumOperands*/ 2 );
390
394
391
395
AltMappings.push_back (&GPRMapping);
@@ -437,7 +441,7 @@ AArch64RegisterBankInfo::getSameKindOfOperandsMapping(
437
441
" This code is for instructions with 3 or less operands" );
438
442
439
443
LLT Ty = MRI.getType (MI.getOperand (0 ).getReg ());
440
- unsigned Size = Ty.getSizeInBits ();
444
+ TypeSize Size = Ty.getSizeInBits ();
441
445
bool IsFPR = Ty.isVector () || isPreISelGenericFloatingPointOpcode (Opc);
442
446
443
447
PartialMappingIdx RBIdx = IsFPR ? PMI_FirstFPR : PMI_FirstGPR;
@@ -714,9 +718,9 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
714
718
// If both RB are null that means both registers are generic.
715
719
// We shouldn't be here.
716
720
assert (DstRB && SrcRB && " Both RegBank were nullptr" );
717
- unsigned Size = getSizeInBits (DstReg, MRI, TRI);
721
+ TypeSize Size = getSizeInBits (DstReg, MRI, TRI);
718
722
return getInstructionMapping (
719
- DefaultMappingID, copyCost (*DstRB, *SrcRB, TypeSize::getFixed ( Size) ),
723
+ DefaultMappingID, copyCost (*DstRB, *SrcRB, Size),
720
724
getCopyMapping (DstRB->getID (), SrcRB->getID (), Size),
721
725
// We only care about the mapping of the destination.
722
726
/* NumOperands*/ 1 );
@@ -727,15 +731,15 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
727
731
case TargetOpcode::G_BITCAST: {
728
732
LLT DstTy = MRI.getType (MI.getOperand (0 ).getReg ());
729
733
LLT SrcTy = MRI.getType (MI.getOperand (1 ).getReg ());
730
- unsigned Size = DstTy.getSizeInBits ();
734
+ TypeSize Size = DstTy.getSizeInBits ();
731
735
bool DstIsGPR = !DstTy.isVector () && DstTy.getSizeInBits () <= 64 ;
732
736
bool SrcIsGPR = !SrcTy.isVector () && SrcTy.getSizeInBits () <= 64 ;
733
737
const RegisterBank &DstRB =
734
738
DstIsGPR ? AArch64::GPRRegBank : AArch64::FPRRegBank;
735
739
const RegisterBank &SrcRB =
736
740
SrcIsGPR ? AArch64::GPRRegBank : AArch64::FPRRegBank;
737
741
return getInstructionMapping (
738
- DefaultMappingID, copyCost (DstRB, SrcRB, TypeSize::getFixed ( Size) ),
742
+ DefaultMappingID, copyCost (DstRB, SrcRB, Size),
739
743
getCopyMapping (DstRB.getID (), SrcRB.getID (), Size),
740
744
// We only care about the mapping of the destination for COPY.
741
745
/* NumOperands*/ Opc == TargetOpcode::G_BITCAST ? 2 : 1 );
@@ -1126,7 +1130,8 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
1126
1130
LLT Ty = MRI.getType (MI.getOperand (Idx).getReg ());
1127
1131
if (!Ty.isValid ())
1128
1132
continue ;
1129
- auto Mapping = getValueMapping (OpRegBankIdx[Idx], OpSize[Idx]);
1133
+ auto Mapping =
1134
+ getValueMapping (OpRegBankIdx[Idx], TypeSize::getFixed (OpSize[Idx]));
1130
1135
if (!Mapping->isValid ())
1131
1136
return getInvalidInstructionMapping ();
1132
1137
0 commit comments