summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2022-01-26 16:29:13 -0500
committerGravatar Lioncash2022-01-26 16:29:15 -0500
commitf6a049337ec17dee986e28fc050ddbe55bd2ac70 (patch)
tree5ed1c14b66c6ff409314c49918e70dea70c22450 /src
parentMerge pull request #7780 from lioncash/macro (diff)
downloadyuzu-f6a049337ec17dee986e28fc050ddbe55bd2ac70.tar.gz
yuzu-f6a049337ec17dee986e28fc050ddbe55bd2ac70.tar.xz
yuzu-f6a049337ec17dee986e28fc050ddbe55bd2ac70.zip
common/xbyak_api: Make BuildRegSet() constexpr
This allows us to eliminate any static constructors that would have been emitted due to the function not being constexpr.
Diffstat (limited to 'src')
-rw-r--r--src/common/x64/xbyak_abi.h16
-rw-r--r--src/video_core/macro/macro_jit_x64.cpp2
2 files changed, 9 insertions, 9 deletions
diff --git a/src/common/x64/xbyak_abi.h b/src/common/x64/xbyak_abi.h
index 0ddf9b83e..87b3d63a4 100644
--- a/src/common/x64/xbyak_abi.h
+++ b/src/common/x64/xbyak_abi.h
@@ -37,12 +37,12 @@ constexpr Xbyak::Reg IndexToReg(size_t reg_index) {
37 } 37 }
38} 38}
39 39
40inline std::bitset<32> BuildRegSet(std::initializer_list<Xbyak::Reg> regs) { 40constexpr std::bitset<32> BuildRegSet(std::initializer_list<Xbyak::Reg> regs) {
41 std::bitset<32> bits; 41 size_t bits = 0;
42 for (const Xbyak::Reg& reg : regs) { 42 for (const Xbyak::Reg& reg : regs) {
43 bits[RegToIndex(reg)] = true; 43 bits |= size_t{1} << RegToIndex(reg);
44 } 44 }
45 return bits; 45 return {bits};
46} 46}
47 47
48constexpr inline std::bitset<32> ABI_ALL_GPRS(0x0000FFFF); 48constexpr inline std::bitset<32> ABI_ALL_GPRS(0x0000FFFF);
@@ -57,7 +57,7 @@ constexpr inline Xbyak::Reg ABI_PARAM2 = Xbyak::util::rdx;
57constexpr inline Xbyak::Reg ABI_PARAM3 = Xbyak::util::r8; 57constexpr inline Xbyak::Reg ABI_PARAM3 = Xbyak::util::r8;
58constexpr inline Xbyak::Reg ABI_PARAM4 = Xbyak::util::r9; 58constexpr inline Xbyak::Reg ABI_PARAM4 = Xbyak::util::r9;
59 59
60const std::bitset<32> ABI_ALL_CALLER_SAVED = BuildRegSet({ 60constexpr inline std::bitset<32> ABI_ALL_CALLER_SAVED = BuildRegSet({
61 // GPRs 61 // GPRs
62 Xbyak::util::rcx, 62 Xbyak::util::rcx,
63 Xbyak::util::rdx, 63 Xbyak::util::rdx,
@@ -74,7 +74,7 @@ const std::bitset<32> ABI_ALL_CALLER_SAVED = BuildRegSet({
74 Xbyak::util::xmm5, 74 Xbyak::util::xmm5,
75}); 75});
76 76
77const std::bitset<32> ABI_ALL_CALLEE_SAVED = BuildRegSet({ 77constexpr inline std::bitset<32> ABI_ALL_CALLEE_SAVED = BuildRegSet({
78 // GPRs 78 // GPRs
79 Xbyak::util::rbx, 79 Xbyak::util::rbx,
80 Xbyak::util::rsi, 80 Xbyak::util::rsi,
@@ -108,7 +108,7 @@ constexpr inline Xbyak::Reg ABI_PARAM2 = Xbyak::util::rsi;
108constexpr inline Xbyak::Reg ABI_PARAM3 = Xbyak::util::rdx; 108constexpr inline Xbyak::Reg ABI_PARAM3 = Xbyak::util::rdx;
109constexpr inline Xbyak::Reg ABI_PARAM4 = Xbyak::util::rcx; 109constexpr inline Xbyak::Reg ABI_PARAM4 = Xbyak::util::rcx;
110 110
111const std::bitset<32> ABI_ALL_CALLER_SAVED = BuildRegSet({ 111constexpr inline std::bitset<32> ABI_ALL_CALLER_SAVED = BuildRegSet({
112 // GPRs 112 // GPRs
113 Xbyak::util::rcx, 113 Xbyak::util::rcx,
114 Xbyak::util::rdx, 114 Xbyak::util::rdx,
@@ -137,7 +137,7 @@ const std::bitset<32> ABI_ALL_CALLER_SAVED = BuildRegSet({
137 Xbyak::util::xmm15, 137 Xbyak::util::xmm15,
138}); 138});
139 139
140const std::bitset<32> ABI_ALL_CALLEE_SAVED = BuildRegSet({ 140constexpr inline std::bitset<32> ABI_ALL_CALLEE_SAVED = BuildRegSet({
141 // GPRs 141 // GPRs
142 Xbyak::util::rbx, 142 Xbyak::util::rbx,
143 Xbyak::util::rbp, 143 Xbyak::util::rbp,
diff --git a/src/video_core/macro/macro_jit_x64.cpp b/src/video_core/macro/macro_jit_x64.cpp
index 924c9fe5c..47b28ad16 100644
--- a/src/video_core/macro/macro_jit_x64.cpp
+++ b/src/video_core/macro/macro_jit_x64.cpp
@@ -29,7 +29,7 @@ constexpr Xbyak::Reg64 PARAMETERS = Xbyak::util::r12;
29constexpr Xbyak::Reg32 METHOD_ADDRESS = Xbyak::util::r14d; 29constexpr Xbyak::Reg32 METHOD_ADDRESS = Xbyak::util::r14d;
30constexpr Xbyak::Reg64 BRANCH_HOLDER = Xbyak::util::r15; 30constexpr Xbyak::Reg64 BRANCH_HOLDER = Xbyak::util::r15;
31 31
32const std::bitset<32> PERSISTENT_REGISTERS = Common::X64::BuildRegSet({ 32constexpr std::bitset<32> PERSISTENT_REGISTERS = Common::X64::BuildRegSet({
33 STATE, 33 STATE,
34 RESULT, 34 RESULT,
35 PARAMETERS, 35 PARAMETERS,