reg_alloc: Register allocator related constraints belong with the rest of the register allocator

HostLocToReg64 contained two DEBUG_ASSERTs invloving constraints that
really belonged to the register allocator.

The register allocator prevents allocation of RSP and R15 because those
are reserved for the stack pointer and the state pointer respectively.
This commit is contained in:
MerryMage 2016-11-30 19:42:41 +00:00
parent 5f11b4f50e
commit 3621a925b2
3 changed files with 3 additions and 2 deletions

View file

@ -11,8 +11,6 @@ namespace BackendX64 {
Xbyak::Reg64 HostLocToReg64(HostLoc loc) { Xbyak::Reg64 HostLocToReg64(HostLoc loc) {
DEBUG_ASSERT(HostLocIsGPR(loc)); DEBUG_ASSERT(HostLocIsGPR(loc));
DEBUG_ASSERT(loc != HostLoc::RSP);
DEBUG_ASSERT(loc != HostLoc::R15);
return Xbyak::Reg64(static_cast<int>(loc)); return Xbyak::Reg64(static_cast<int>(loc));
} }

View file

@ -34,6 +34,7 @@ static u32 ImmediateToU32(const IR::Value& imm) {
static Xbyak::Reg HostLocToX64(HostLoc hostloc) { static Xbyak::Reg HostLocToX64(HostLoc hostloc) {
if (HostLocIsGPR(hostloc)) { if (HostLocIsGPR(hostloc)) {
DEBUG_ASSERT(hostloc != HostLoc::RSP && hostloc != HostLoc::R15);
return HostLocToReg64(hostloc); return HostLocToReg64(hostloc);
} }
if (HostLocIsXMM(hostloc)) { if (HostLocIsXMM(hostloc)) {

View file

@ -201,9 +201,11 @@ private:
}; };
std::array<HostLocInfo, HostLocCount> hostloc_info; std::array<HostLocInfo, HostLocCount> hostloc_info;
HostLocInfo& LocInfo(HostLoc loc) { HostLocInfo& LocInfo(HostLoc loc) {
DEBUG_ASSERT(loc != HostLoc::RSP && loc != HostLoc::R15);
return hostloc_info[static_cast<size_t>(loc)]; return hostloc_info[static_cast<size_t>(loc)];
} }
const HostLocInfo& LocInfo(HostLoc loc) const { const HostLocInfo& LocInfo(HostLoc loc) const {
DEBUG_ASSERT(loc != HostLoc::RSP && loc != HostLoc::R15);
return hostloc_info[static_cast<size_t>(loc)]; return hostloc_info[static_cast<size_t>(loc)];
} }
}; };