From 01f28facbd0312421d3774205d7ff3dce953203b Mon Sep 17 00:00:00 2001 From: Merry Date: Sat, 23 Jul 2022 11:46:43 +0100 Subject: [PATCH] abi: Add Rscratch{0,1} --- src/dynarmic/backend/arm64/abi.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/dynarmic/backend/arm64/abi.h b/src/dynarmic/backend/arm64/abi.h index 56dc2569..86d6cef3 100644 --- a/src/dynarmic/backend/arm64/abi.h +++ b/src/dynarmic/backend/arm64/abi.h @@ -15,4 +15,26 @@ constexpr oaknut::XReg Xhalt{27}; constexpr oaknut::XReg Xscratch0{16}, Xscratch1{17}; constexpr oaknut::WReg Wscratch0{16}, Wscratch1{17}; +template +constexpr auto Rscratch0() { + if constexpr (bitsize == 32) { + return Wscratch0; + } else if constexpr (bitsize == 64) { + return Xscratch0; + } else { + static_assert(bitsize == 32 || bitsize == 64); + } +} + +template +constexpr auto Rscratch1() { + if constexpr (bitsize == 32) { + return Wscratch1; + } else if constexpr (bitsize == 64) { + return Xscratch1; + } else { + static_assert(bitsize == 32 || bitsize == 64); + } +} + } // namespace Dynarmic::Backend::Arm64