@@ -3422,6 +3422,9 @@ struct Properties {
3422
3422
uint16_t numRegisters = 0 ;
3423
3423
3424
3424
public:
3425
+ static uint16_t MaxNumUses = 65535 ;
3426
+ static uint16_t MaxNumRegisters = 65535 ;
3427
+
3425
3428
void addConstructor () {
3426
3429
sawConstructor = true ;
3427
3430
}
@@ -3458,17 +3461,19 @@ struct Properties {
3458
3461
}
3459
3462
3460
3463
void addUse () {
3461
- if (use == 65535 )
3464
+ if (use == MaxNumUses )
3462
3465
return ;
3463
3466
++use;
3464
3467
}
3465
3468
uint16_t numUses () const {
3466
3469
return use;
3467
3470
}
3468
-
3471
+ void setAsVeryLargeType () {
3472
+ setNumRegisters (MaxNumRegisters);
3473
+ }
3469
3474
void setNumRegisters (unsigned regs) {
3470
- if (regs > 65535 ) {
3471
- regs = 65535 ;
3475
+ if (regs > MaxNumRegisters ) {
3476
+ numRegisters = MaxNumRegisters ;
3472
3477
return ;
3473
3478
}
3474
3479
numRegisters = regs;
@@ -3560,7 +3565,7 @@ void LargeLoadableHeuristic::propagate(PostOrderFunctionInfo &po) {
3560
3565
if (isLargeLoadableType (proj.getType ())) {
3561
3566
auto opdTy = proj.getOperand (0 )->getType ();
3562
3567
auto entry = largeTypeProperties[opdTy];
3563
- entry.setNumRegisters ( 65535 );
3568
+ entry.setAsVeryLargeType ( );
3564
3569
largeTypeProperties[opdTy] = entry;
3565
3570
}
3566
3571
}
@@ -3612,7 +3617,7 @@ void LargeLoadableHeuristic::visit(SILInstruction *i) {
3612
3617
if (numRegisters (resTy) > NumRegistersLargeType) {
3613
3618
// Force the source type to be indirect.
3614
3619
auto entry = largeTypeProperties[opdTy];
3615
- entry.setNumRegisters ( 65535 );
3620
+ entry.setAsVeryLargeType ( );
3616
3621
largeTypeProperties[opdTy] = entry;
3617
3622
return ;
3618
3623
}
0 commit comments