@@ -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:
@@ -305,7 +306,7 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
305
306
case TargetOpcode::G_OR: {
306
307
// 32 and 64-bit or can be mapped on either FPR or
307
308
// GPR for the same cost.
308
- unsigned Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
309
+ TypeSize Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
309
310
if (Size != 32 && Size != 64 )
310
311
break ;
311
312
@@ -326,7 +327,7 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
326
327
return AltMappings;
327
328
}
328
329
case TargetOpcode::G_BITCAST: {
329
- unsigned Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
330
+ TypeSize Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
330
331
if (Size != 32 && Size != 64 )
331
332
break ;
332
333
@@ -366,7 +367,7 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
366
367
return AltMappings;
367
368
}
368
369
case TargetOpcode::G_LOAD: {
369
- unsigned Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
370
+ TypeSize Size = getSizeInBits (MI.getOperand (0 ).getReg (), MRI, TRI);
370
371
if (Size != 64 )
371
372
break ;
372
373
@@ -378,15 +379,17 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
378
379
InstructionMappings AltMappings;
379
380
const InstructionMapping &GPRMapping = getInstructionMapping (
380
381
/* ID*/ 1 , /* Cost*/ 1 ,
381
- getOperandsMapping ({getValueMapping (PMI_FirstGPR, Size),
382
- // Addresses are GPR 64-bit.
383
- getValueMapping (PMI_FirstGPR, 64 )}),
382
+ getOperandsMapping (
383
+ {getValueMapping (PMI_FirstGPR, Size),
384
+ // Addresses are GPR 64-bit.
385
+ getValueMapping (PMI_FirstGPR, TypeSize::getFixed (64 ))}),
384
386
/* NumOperands*/ 2 );
385
387
const InstructionMapping &FPRMapping = getInstructionMapping (
386
388
/* ID*/ 2 , /* Cost*/ 1 ,
387
- getOperandsMapping ({getValueMapping (PMI_FirstFPR, Size),
388
- // Addresses are GPR 64-bit.
389
- getValueMapping (PMI_FirstGPR, 64 )}),
389
+ getOperandsMapping (
390
+ {getValueMapping (PMI_FirstFPR, Size),
391
+ // Addresses are GPR 64-bit.
392
+ getValueMapping (PMI_FirstGPR, TypeSize::getFixed (64 ))}),
390
393
/* NumOperands*/ 2 );
391
394
392
395
AltMappings.push_back (&GPRMapping);
@@ -438,7 +441,7 @@ AArch64RegisterBankInfo::getSameKindOfOperandsMapping(
438
441
" This code is for instructions with 3 or less operands" );
439
442
440
443
LLT Ty = MRI.getType (MI.getOperand (0 ).getReg ());
441
- unsigned Size = Ty.getSizeInBits ();
444
+ TypeSize Size = Ty.getSizeInBits ();
442
445
bool IsFPR = Ty.isVector () || isPreISelGenericFloatingPointOpcode (Opc);
443
446
444
447
PartialMappingIdx RBIdx = IsFPR ? PMI_FirstFPR : PMI_FirstGPR;
@@ -718,8 +721,7 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
718
721
TypeSize Size = getSizeInBits (DstReg, MRI, TRI);
719
722
return getInstructionMapping (
720
723
DefaultMappingID, copyCost (*DstRB, *SrcRB, Size),
721
- getCopyMapping (DstRB->getID (), SrcRB->getID (),
722
- Size.getKnownMinValue ()),
724
+ getCopyMapping (DstRB->getID (), SrcRB->getID (), Size),
723
725
// We only care about the mapping of the destination.
724
726
/* NumOperands*/ 1 );
725
727
}
@@ -729,15 +731,15 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
729
731
case TargetOpcode::G_BITCAST: {
730
732
LLT DstTy = MRI.getType (MI.getOperand (0 ).getReg ());
731
733
LLT SrcTy = MRI.getType (MI.getOperand (1 ).getReg ());
732
- unsigned Size = DstTy.getSizeInBits ();
734
+ TypeSize Size = DstTy.getSizeInBits ();
733
735
bool DstIsGPR = !DstTy.isVector () && DstTy.getSizeInBits () <= 64 ;
734
736
bool SrcIsGPR = !SrcTy.isVector () && SrcTy.getSizeInBits () <= 64 ;
735
737
const RegisterBank &DstRB =
736
738
DstIsGPR ? AArch64::GPRRegBank : AArch64::FPRRegBank;
737
739
const RegisterBank &SrcRB =
738
740
SrcIsGPR ? AArch64::GPRRegBank : AArch64::FPRRegBank;
739
741
return getInstructionMapping (
740
- DefaultMappingID, copyCost (DstRB, SrcRB, TypeSize::getFixed ( Size) ),
742
+ DefaultMappingID, copyCost (DstRB, SrcRB, Size),
741
743
getCopyMapping (DstRB.getID (), SrcRB.getID (), Size),
742
744
// We only care about the mapping of the destination for COPY.
743
745
/* NumOperands*/ Opc == TargetOpcode::G_BITCAST ? 2 : 1 );
@@ -1128,7 +1130,8 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
1128
1130
LLT Ty = MRI.getType (MI.getOperand (Idx).getReg ());
1129
1131
if (!Ty.isValid ())
1130
1132
continue ;
1131
- auto Mapping = getValueMapping (OpRegBankIdx[Idx], OpSize[Idx]);
1133
+ auto Mapping =
1134
+ getValueMapping (OpRegBankIdx[Idx], TypeSize::getFixed (OpSize[Idx]));
1132
1135
if (!Mapping->isValid ())
1133
1136
return getInvalidInstructionMapping ();
1134
1137
0 commit comments