From 3621a925b2e9b49c79caa06312c95dc01f0ed9e1 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Wed, 30 Nov 2016 19:42:41 +0000 Subject: [PATCH] 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. --- src/backend_x64/hostloc.cpp | 2 -- src/backend_x64/reg_alloc.cpp | 1 + src/backend_x64/reg_alloc.h | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend_x64/hostloc.cpp b/src/backend_x64/hostloc.cpp index bc1683af..2093623a 100644 --- a/src/backend_x64/hostloc.cpp +++ b/src/backend_x64/hostloc.cpp @@ -11,8 +11,6 @@ namespace BackendX64 { Xbyak::Reg64 HostLocToReg64(HostLoc loc) { DEBUG_ASSERT(HostLocIsGPR(loc)); - DEBUG_ASSERT(loc != HostLoc::RSP); - DEBUG_ASSERT(loc != HostLoc::R15); return Xbyak::Reg64(static_cast(loc)); } diff --git a/src/backend_x64/reg_alloc.cpp b/src/backend_x64/reg_alloc.cpp index 9800e022..925ed136 100644 --- a/src/backend_x64/reg_alloc.cpp +++ b/src/backend_x64/reg_alloc.cpp @@ -34,6 +34,7 @@ static u32 ImmediateToU32(const IR::Value& imm) { static Xbyak::Reg HostLocToX64(HostLoc hostloc) { if (HostLocIsGPR(hostloc)) { + DEBUG_ASSERT(hostloc != HostLoc::RSP && hostloc != HostLoc::R15); return HostLocToReg64(hostloc); } if (HostLocIsXMM(hostloc)) { diff --git a/src/backend_x64/reg_alloc.h b/src/backend_x64/reg_alloc.h index 565465e6..bfaa412e 100644 --- a/src/backend_x64/reg_alloc.h +++ b/src/backend_x64/reg_alloc.h @@ -201,9 +201,11 @@ private: }; std::array hostloc_info; HostLocInfo& LocInfo(HostLoc loc) { + DEBUG_ASSERT(loc != HostLoc::RSP && loc != HostLoc::R15); return hostloc_info[static_cast(loc)]; } const HostLocInfo& LocInfo(HostLoc loc) const { + DEBUG_ASSERT(loc != HostLoc::RSP && loc != HostLoc::R15); return hostloc_info[static_cast(loc)]; } };