BackendX64/RegAlloc: HostLocToX64 now handles XMM registers properly

This commit is contained in:
MerryMage 2016-08-06 17:11:22 +01:00
parent cd1eef2801
commit 8cc4fe8a10

View file

@ -33,8 +33,15 @@ static Gen::OpArg ImmediateToOpArg(const IR::Value& imm) {
static Gen::X64Reg HostLocToX64(HostLoc loc) { static Gen::X64Reg HostLocToX64(HostLoc loc) {
DEBUG_ASSERT(HostLocIsRegister(loc)); DEBUG_ASSERT(HostLocIsRegister(loc));
// HostLoc is ordered such that the numbers line up. // HostLoc is ordered such that the numbers line up.
if (HostLocIsGPR(loc)) {
return static_cast<Gen::X64Reg>(loc); return static_cast<Gen::X64Reg>(loc);
} }
if (HostLocIsXMM(loc)) {
return static_cast<Gen::X64Reg>(size_t(loc) - size_t(HostLoc::XMM0));
}
ASSERT_MSG(false, "This should never happen.");
return Gen::INVALID_REG;
}
static Gen::OpArg SpillToOpArg(HostLoc loc) { static Gen::OpArg SpillToOpArg(HostLoc loc) {
static_assert(std::is_same<decltype(JitState{}.Spill[0]), u64&>::value, "Spill must be u64"); static_assert(std::is_same<decltype(JitState{}.Spill[0]), u64&>::value, "Spill must be u64");