From 89cbf36611daa0bebb5d2d75b2fba5b7a3139b6b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 30 Dec 2017 00:32:31 -0800 Subject: [PATCH] arm64jit: Free up W23 for static alloc. We shouldn't always reserve W23 for this uncommon case. --- Core/MIPS/ARM64/Arm64CompBranch.cpp | 6 ++++-- Core/MIPS/ARM64/Arm64RegCache.h | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Core/MIPS/ARM64/Arm64CompBranch.cpp b/Core/MIPS/ARM64/Arm64CompBranch.cpp index ea9acffa6f..9d8f41fb8c 100644 --- a/Core/MIPS/ARM64/Arm64CompBranch.cpp +++ b/Core/MIPS/ARM64/Arm64CompBranch.cpp @@ -536,7 +536,7 @@ void Arm64Jit::Comp_JumpReg(MIPSOpcode op) delaySlotIsNice = false; CONDITIONAL_NICE_DELAYSLOT; - ARM64Reg destReg = OTHERTEMPREG; + ARM64Reg destReg = INVALID_REG; if (IsSyscall(delaySlotOp)) { gpr.MapReg(rs); MovToPC(gpr.R(rs)); // For syscall to be able to return. @@ -574,7 +574,9 @@ void Arm64Jit::Comp_JumpReg(MIPSOpcode op) destReg = gpr.R(rs); // Safe because FlushAll doesn't change any regs FlushAll(); } else { - // Delay slot - this case is very rare, might be able to free up W24. + // Since we can't be in a delay slot, should be safe to steal FLAGTEMPREG for a temp reg. + // It will be saved, even if a function is called. + destReg = FLAGTEMPREG; gpr.MapReg(rs); MOV(destReg, gpr.R(rs)); if (andLink) diff --git a/Core/MIPS/ARM64/Arm64RegCache.h b/Core/MIPS/ARM64/Arm64RegCache.h index 603dca1289..b95caf7854 100644 --- a/Core/MIPS/ARM64/Arm64RegCache.h +++ b/Core/MIPS/ARM64/Arm64RegCache.h @@ -23,8 +23,7 @@ namespace Arm64JitConstants { -const Arm64Gen::ARM64Reg DOWNCOUNTREG = Arm64Gen::W23; -const Arm64Gen::ARM64Reg OTHERTEMPREG = Arm64Gen::W24; +const Arm64Gen::ARM64Reg DOWNCOUNTREG = Arm64Gen::W24; const Arm64Gen::ARM64Reg FLAGTEMPREG = Arm64Gen::X25; const Arm64Gen::ARM64Reg JITBASEREG = Arm64Gen::X26; const Arm64Gen::ARM64Reg CTXREG = Arm64Gen::X27;