Simplified unavailable register handing in RAPass (Compiler)

This commit is contained in:
kobalicek
2025-05-30 15:30:14 +02:00
parent c993fd9bfc
commit 9f6ef3a2f3
5 changed files with 8 additions and 9 deletions

View File

@@ -646,7 +646,6 @@ void ARMRAPass::onInit() noexcept {
_physRegCount.set(RegGroup::kExtraVirt3, 0);
_buildPhysIndex();
_availableRegCount = _physRegCount;
_availableRegs[RegGroup::kGp] = Support::lsbMask<uint32_t>(_physRegCount.get(RegGroup::kGp));
_availableRegs[RegGroup::kVec] = Support::lsbMask<uint32_t>(_physRegCount.get(RegGroup::kVec));
_availableRegs[RegGroup::kMask] = Support::lsbMask<uint32_t>(_physRegCount.get(RegGroup::kMask));

View File

@@ -314,6 +314,10 @@ struct RARegMask {
_masks[group] = _masks[group] & ~mask;
}
inline void clear(const RegMasks& masks) noexcept {
_masks.combine<Support::AndNot>(masks);
}
//! \}
};

View File

@@ -77,7 +77,6 @@ static void BaseRAPass_reset(BaseRAPass* self, FuncDetail* funcDetail) noexcept
self->_scratchRegIndexes.fill(BaseReg::kIdBad);
self->_availableRegs.reset();
self->_availableRegCount.reset();
self->_clobberedRegs.reset();
self->_workRegs.reset();

View File

@@ -883,8 +883,6 @@ public:
//! Registers available for allocation.
RARegMask _availableRegs = RARegMask();
//! Count of physical registers per group.
RARegCount _availableRegCount = RARegCount();
//! Registers clobbered by the function.
RARegMask _clobberedRegs = RARegMask();
@@ -990,7 +988,10 @@ public:
inline void makeUnavailable(RegGroup group, uint32_t regId) noexcept {
_availableRegs[group] &= ~Support::bitMask(regId);
_availableRegCount[group]--;
}
inline void makeUnavailable(const RARegMask::RegMasks& regs) noexcept {
_availableRegs.clear(regs);
}
//! Runs the register allocator for the given `func`.
@@ -1231,9 +1232,6 @@ public:
[[nodiscard]]
ASMJIT_INLINE_NODEBUG uint32_t registerSize() const noexcept { return _sp.size(); }
[[nodiscard]]
ASMJIT_INLINE_NODEBUG uint32_t availableRegCount(RegGroup group) const noexcept { return _availableRegCount[group]; }
[[nodiscard]]
ASMJIT_INLINE_NODEBUG RAWorkReg* workRegById(uint32_t workId) const noexcept { return _workRegs[workId]; }

View File

@@ -1291,7 +1291,6 @@ void X86RAPass::onInit() noexcept {
_physRegCount.set(RegGroup::kX86_MM, 8);
_buildPhysIndex();
_availableRegCount = _physRegCount;
_availableRegs[RegGroup::kGp] = Support::lsbMask<RegMask>(_physRegCount.get(RegGroup::kGp));
_availableRegs[RegGroup::kVec] = Support::lsbMask<RegMask>(_physRegCount.get(RegGroup::kVec));
_availableRegs[RegGroup::kX86_K] = Support::lsbMask<RegMask>(_physRegCount.get(RegGroup::kX86_K)) ^ 1u;