@@ -3422,6 +3422,9 @@ struct Properties {
3422
3422
uint16_t numRegisters = 0 ;
3423
3423
3424
3424
public:
3425
+ static uint16_t MaxNumUses;
3426
+ static uint16_t MaxNumRegisters;
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;
@@ -3479,6 +3484,9 @@ struct Properties {
3479
3484
};
3480
3485
}
3481
3486
3487
+ uint16_t Properties::MaxNumUses = 65535 ;
3488
+ uint16_t Properties::MaxNumRegisters = 65535 ;
3489
+
3482
3490
namespace {
3483
3491
class LargeLoadableHeuristic {
3484
3492
GenericEnvironment *genEnv;
@@ -3560,7 +3568,7 @@ void LargeLoadableHeuristic::propagate(PostOrderFunctionInfo &po) {
3560
3568
if (isLargeLoadableType (proj.getType ())) {
3561
3569
auto opdTy = proj.getOperand (0 )->getType ();
3562
3570
auto entry = largeTypeProperties[opdTy];
3563
- entry.setNumRegisters ( 65535 );
3571
+ entry.setAsVeryLargeType ( );
3564
3572
largeTypeProperties[opdTy] = entry;
3565
3573
}
3566
3574
}
@@ -3612,7 +3620,7 @@ void LargeLoadableHeuristic::visit(SILInstruction *i) {
3612
3620
if (numRegisters (resTy) > NumRegistersLargeType) {
3613
3621
// Force the source type to be indirect.
3614
3622
auto entry = largeTypeProperties[opdTy];
3615
- entry.setNumRegisters ( 65535 );
3623
+ entry.setAsVeryLargeType ( );
3616
3624
largeTypeProperties[opdTy] = entry;
3617
3625
return ;
3618
3626
}
0 commit comments