Skip to content

Commit

Permalink
AddRegsetForType()
Browse files Browse the repository at this point in the history
  • Loading branch information
kunalspathak committed May 29, 2024
1 parent 535c2e1 commit 147a88b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/coreclr/jit/lsra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5221,13 +5221,13 @@ void LinearScan::allocateRegistersMinimal()
}
#endif // TARGET_ARM
}
regsInUseThisLocation |= currentRefPosition.registerAssignment;
regsInUseThisLocation.AddRegsetForType(currentRefPosition.registerAssignment, regRecord->registerType);
INDEBUG(dumpLsraAllocationEvent(LSRA_EVENT_FIXED_REG, nullptr, currentRefPosition.assignedReg()));

#ifdef SWIFT_SUPPORT
if (currentRefPosition.delayRegFree)
{
regsInUseNextLocation |= currentRefPosition.registerAssignment;
regsInUseNextLocation.AddRegsetForType(currentRefPosition.registerAssignment, regRecord->registerType);
}
#endif // SWIFT_SUPPORT
continue;
Expand Down Expand Up @@ -5932,13 +5932,13 @@ void LinearScan::allocateRegisters()
}
#endif // TARGET_ARM
}
regsInUseThisLocation |= currentRefPosition.registerAssignment;
regsInUseThisLocation.AddRegsetForType(currentRefPosition.registerAssignment, regRecord->registerType);
INDEBUG(dumpLsraAllocationEvent(LSRA_EVENT_FIXED_REG, nullptr, currentRefPosition.assignedReg()));

#ifdef SWIFT_SUPPORT
if (currentRefPosition.delayRegFree)
{
regsInUseNextLocation |= currentRefPosition.registerAssignment;
regsInUseNextLocation.AddRegsetForType(currentRefPosition.registerAssignment, regRecord->registerType);
}
#endif // SWIFT_SUPPORT
continue;
Expand Down
17 changes: 17 additions & 0 deletions src/coreclr/jit/regMaskTPOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,23 @@ void regMaskTP::AddRegNum(regNumber reg, var_types type)
#endif
}

//------------------------------------------------------------------------
// AddRegsetForType: Add regs of `type` in mask.
//
// Parameters:
// maskToAdd - Register to check
// type - type of register
//
void regMaskTP::AddRegsetForType(SingleTypeRegSet regs, var_types type)
{
#ifdef HAS_MORE_THAN_64_REGISTERS
int index = getRegisterTypeIndex(type);
_registers[index] |= encodeForRegisterIndex(index, regs);
#else
low |= regs;
#endif
}

//------------------------------------------------------------------------
// IsRegNumInMask: Checks if `reg` is in the mask
//
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ struct regMaskTP
void AddGprRegs(SingleTypeRegSet gprRegs);
void AddRegNum(regNumber reg, var_types type);
void AddRegNumInMask(regNumber reg);
void AddRegsetForType(SingleTypeRegSet maskToAdd, var_types type);
void RemoveRegNum(regNumber reg, var_types type);
void RemoveRegNumFromMask(regNumber reg);
bool IsRegNumInMask(regNumber reg) const;
Expand Down

0 comments on commit 147a88b

Please sign in to comment.