@@ -163,17 +163,18 @@ AArch64RegisterBankInfo::AArch64RegisterBankInfo(
163163 unsigned PartialMapSrcIdx = PMI_##RBNameSrc##Size - PMI_Min; \
164164 (void )PartialMapDstIdx; \
165165 (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)); \
168169 (void )Map; \
169170 assert (Map[0 ].BreakDown == \
170171 &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" ); \
173174 assert (Map[1 ].BreakDown == \
174175 &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" ); \
177178 \
178179 } while (false )
179180
@@ -218,7 +219,7 @@ AArch64RegisterBankInfo::AArch64RegisterBankInfo(
218219
219220unsigned AArch64RegisterBankInfo::copyCost (const RegisterBank &A,
220221 const RegisterBank &B,
221- TypeSize Size) const {
222+ const TypeSize Size) const {
222223 // What do we do with different size?
223224 // copy are same size.
224225 // Will introduce other hooks for different size:
@@ -258,6 +259,7 @@ AArch64RegisterBankInfo::getRegBankFromRegClass(const TargetRegisterClass &RC,
258259 case AArch64::QQQRegClassID:
259260 case AArch64::QQQQRegClassID:
260261 case AArch64::ZPRRegClassID:
262+ case AArch64::ZPR_3bRegClassID:
261263 return getRegBank (AArch64::FPRRegBankID);
262264 case AArch64::GPR32commonRegClassID:
263265 case AArch64::GPR32RegClassID:
@@ -304,7 +306,7 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
304306 case TargetOpcode::G_OR: {
305307 // 32 and 64-bit or can be mapped on either FPR or
306308 // 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);
308310 if (Size != 32 && Size != 64 )
309311 break ;
310312
@@ -325,7 +327,7 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
325327 return AltMappings;
326328 }
327329 case TargetOpcode::G_BITCAST: {
328- unsigned Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
330+ TypeSize Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
329331 if (Size != 32 && Size != 64 )
330332 break ;
331333
@@ -365,7 +367,7 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
365367 return AltMappings;
366368 }
367369 case TargetOpcode::G_LOAD: {
368- unsigned Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
370+ TypeSize Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
369371 if (Size != 64 )
370372 break ;
371373
@@ -377,15 +379,17 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
377379 InstructionMappings AltMappings;
378380 const InstructionMapping &GPRMapping = getInstructionMapping (
379381 /* 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 ))}),
383386 /* NumOperands*/ 2 );
384387 const InstructionMapping &FPRMapping = getInstructionMapping (
385388 /* 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 ))}),
389393 /* NumOperands*/ 2 );
390394
391395 AltMappings.push_back (&GPRMapping);
@@ -437,7 +441,7 @@ AArch64RegisterBankInfo::getSameKindOfOperandsMapping(
437441 " This code is for instructions with 3 or less operands" );
438442
439443 LLT Ty = MRI.getType (MI.getOperand (0 ).getReg ());
440- unsigned Size = Ty.getSizeInBits ();
444+ TypeSize Size = Ty.getSizeInBits ();
441445 bool IsFPR = Ty.isVector () || isPreISelGenericFloatingPointOpcode (Opc);
442446
443447 PartialMappingIdx RBIdx = IsFPR ? PMI_FirstFPR : PMI_FirstGPR;
@@ -714,9 +718,9 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
714718 // If both RB are null that means both registers are generic.
715719 // We shouldn't be here.
716720 assert (DstRB && SrcRB && " Both RegBank were nullptr" );
717- unsigned Size = getSizeInBits (DstReg, MRI, TRI);
721+ TypeSize Size = getSizeInBits (DstReg, MRI, TRI);
718722 return getInstructionMapping (
719- DefaultMappingID, copyCost (*DstRB, *SrcRB, TypeSize::getFixed ( Size) ),
723+ DefaultMappingID, copyCost (*DstRB, *SrcRB, Size),
720724 getCopyMapping (DstRB->getID (), SrcRB->getID (), Size),
721725 // We only care about the mapping of the destination.
722726 /* NumOperands*/ 1 );
@@ -727,15 +731,15 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
727731 case TargetOpcode::G_BITCAST: {
728732 LLT DstTy = MRI.getType (MI.getOperand (0 ).getReg ());
729733 LLT SrcTy = MRI.getType (MI.getOperand (1 ).getReg ());
730- unsigned Size = DstTy.getSizeInBits ();
734+ TypeSize Size = DstTy.getSizeInBits ();
731735 bool DstIsGPR = !DstTy.isVector () && DstTy.getSizeInBits () <= 64 ;
732736 bool SrcIsGPR = !SrcTy.isVector () && SrcTy.getSizeInBits () <= 64 ;
733737 const RegisterBank &DstRB =
734738 DstIsGPR ? AArch64::GPRRegBank : AArch64::FPRRegBank;
735739 const RegisterBank &SrcRB =
736740 SrcIsGPR ? AArch64::GPRRegBank : AArch64::FPRRegBank;
737741 return getInstructionMapping (
738- DefaultMappingID, copyCost (DstRB, SrcRB, TypeSize::getFixed ( Size) ),
742+ DefaultMappingID, copyCost (DstRB, SrcRB, Size),
739743 getCopyMapping (DstRB.getID (), SrcRB.getID (), Size),
740744 // We only care about the mapping of the destination for COPY.
741745 /* NumOperands*/ Opc == TargetOpcode::G_BITCAST ? 2 : 1 );
@@ -1126,7 +1130,8 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
11261130 LLT Ty = MRI.getType (MI.getOperand (Idx).getReg ());
11271131 if (!Ty.isValid ())
11281132 continue ;
1129- auto Mapping = getValueMapping (OpRegBankIdx[Idx], OpSize[Idx]);
1133+ auto Mapping =
1134+ getValueMapping (OpRegBankIdx[Idx], TypeSize::getFixed (OpSize[Idx]));
11301135 if (!Mapping->isValid ())
11311136 return getInvalidInstructionMapping ();
11321137
0 commit comments