mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 08:42:45 +01:00
Merge pull request #7783 from lioncash/abi-cexpr
common/xbyak_api: Make BuildRegSet() constexpr
This commit is contained in:
commit
8a244dd3d3
2 changed files with 9 additions and 9 deletions
|
@ -37,12 +37,12 @@ constexpr Xbyak::Reg IndexToReg(size_t reg_index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::bitset<32> BuildRegSet(std::initializer_list<Xbyak::Reg> regs) {
|
constexpr std::bitset<32> BuildRegSet(std::initializer_list<Xbyak::Reg> regs) {
|
||||||
std::bitset<32> bits;
|
size_t bits = 0;
|
||||||
for (const Xbyak::Reg& reg : regs) {
|
for (const Xbyak::Reg& reg : regs) {
|
||||||
bits[RegToIndex(reg)] = true;
|
bits |= size_t{1} << RegToIndex(reg);
|
||||||
}
|
}
|
||||||
return bits;
|
return {bits};
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr inline std::bitset<32> ABI_ALL_GPRS(0x0000FFFF);
|
constexpr inline std::bitset<32> ABI_ALL_GPRS(0x0000FFFF);
|
||||||
|
@ -57,7 +57,7 @@ constexpr inline Xbyak::Reg ABI_PARAM2 = Xbyak::util::rdx;
|
||||||
constexpr inline Xbyak::Reg ABI_PARAM3 = Xbyak::util::r8;
|
constexpr inline Xbyak::Reg ABI_PARAM3 = Xbyak::util::r8;
|
||||||
constexpr inline Xbyak::Reg ABI_PARAM4 = Xbyak::util::r9;
|
constexpr inline Xbyak::Reg ABI_PARAM4 = Xbyak::util::r9;
|
||||||
|
|
||||||
const std::bitset<32> ABI_ALL_CALLER_SAVED = BuildRegSet({
|
constexpr inline std::bitset<32> ABI_ALL_CALLER_SAVED = BuildRegSet({
|
||||||
// GPRs
|
// GPRs
|
||||||
Xbyak::util::rcx,
|
Xbyak::util::rcx,
|
||||||
Xbyak::util::rdx,
|
Xbyak::util::rdx,
|
||||||
|
@ -74,7 +74,7 @@ const std::bitset<32> ABI_ALL_CALLER_SAVED = BuildRegSet({
|
||||||
Xbyak::util::xmm5,
|
Xbyak::util::xmm5,
|
||||||
});
|
});
|
||||||
|
|
||||||
const std::bitset<32> ABI_ALL_CALLEE_SAVED = BuildRegSet({
|
constexpr inline std::bitset<32> ABI_ALL_CALLEE_SAVED = BuildRegSet({
|
||||||
// GPRs
|
// GPRs
|
||||||
Xbyak::util::rbx,
|
Xbyak::util::rbx,
|
||||||
Xbyak::util::rsi,
|
Xbyak::util::rsi,
|
||||||
|
@ -108,7 +108,7 @@ constexpr inline Xbyak::Reg ABI_PARAM2 = Xbyak::util::rsi;
|
||||||
constexpr inline Xbyak::Reg ABI_PARAM3 = Xbyak::util::rdx;
|
constexpr inline Xbyak::Reg ABI_PARAM3 = Xbyak::util::rdx;
|
||||||
constexpr inline Xbyak::Reg ABI_PARAM4 = Xbyak::util::rcx;
|
constexpr inline Xbyak::Reg ABI_PARAM4 = Xbyak::util::rcx;
|
||||||
|
|
||||||
const std::bitset<32> ABI_ALL_CALLER_SAVED = BuildRegSet({
|
constexpr inline std::bitset<32> ABI_ALL_CALLER_SAVED = BuildRegSet({
|
||||||
// GPRs
|
// GPRs
|
||||||
Xbyak::util::rcx,
|
Xbyak::util::rcx,
|
||||||
Xbyak::util::rdx,
|
Xbyak::util::rdx,
|
||||||
|
@ -137,7 +137,7 @@ const std::bitset<32> ABI_ALL_CALLER_SAVED = BuildRegSet({
|
||||||
Xbyak::util::xmm15,
|
Xbyak::util::xmm15,
|
||||||
});
|
});
|
||||||
|
|
||||||
const std::bitset<32> ABI_ALL_CALLEE_SAVED = BuildRegSet({
|
constexpr inline std::bitset<32> ABI_ALL_CALLEE_SAVED = BuildRegSet({
|
||||||
// GPRs
|
// GPRs
|
||||||
Xbyak::util::rbx,
|
Xbyak::util::rbx,
|
||||||
Xbyak::util::rbp,
|
Xbyak::util::rbp,
|
||||||
|
|
|
@ -29,7 +29,7 @@ constexpr Xbyak::Reg64 PARAMETERS = Xbyak::util::r12;
|
||||||
constexpr Xbyak::Reg32 METHOD_ADDRESS = Xbyak::util::r14d;
|
constexpr Xbyak::Reg32 METHOD_ADDRESS = Xbyak::util::r14d;
|
||||||
constexpr Xbyak::Reg64 BRANCH_HOLDER = Xbyak::util::r15;
|
constexpr Xbyak::Reg64 BRANCH_HOLDER = Xbyak::util::r15;
|
||||||
|
|
||||||
const std::bitset<32> PERSISTENT_REGISTERS = Common::X64::BuildRegSet({
|
constexpr std::bitset<32> PERSISTENT_REGISTERS = Common::X64::BuildRegSet({
|
||||||
STATE,
|
STATE,
|
||||||
RESULT,
|
RESULT,
|
||||||
PARAMETERS,
|
PARAMETERS,
|
||||||
|
|
Loading…
Reference in a new issue