diff options
Diffstat (limited to 'src/common/x64/xbyak_abi.h')
| -rw-r--r-- | src/common/x64/xbyak_abi.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/common/x64/xbyak_abi.h b/src/common/x64/xbyak_abi.h index 927da9187..636a5c0f9 100644 --- a/src/common/x64/xbyak_abi.h +++ b/src/common/x64/xbyak_abi.h | |||
| @@ -97,7 +97,7 @@ const BitSet32 ABI_ALL_CALLEE_SAVED = BuildRegSet({ | |||
| 97 | Xbyak::util::xmm15, | 97 | Xbyak::util::xmm15, |
| 98 | }); | 98 | }); |
| 99 | 99 | ||
| 100 | constexpr size_t ABI_SHADOW_SPACE = 0x20; | 100 | constexpr std::size_t ABI_SHADOW_SPACE = 0x20; |
| 101 | 101 | ||
| 102 | #else | 102 | #else |
| 103 | 103 | ||
| @@ -147,22 +147,23 @@ const BitSet32 ABI_ALL_CALLEE_SAVED = BuildRegSet({ | |||
| 147 | Xbyak::util::r15, | 147 | Xbyak::util::r15, |
| 148 | }); | 148 | }); |
| 149 | 149 | ||
| 150 | constexpr size_t ABI_SHADOW_SPACE = 0; | 150 | constexpr std::size_t ABI_SHADOW_SPACE = 0; |
| 151 | 151 | ||
| 152 | #endif | 152 | #endif |
| 153 | 153 | ||
| 154 | inline void ABI_CalculateFrameSize(BitSet32 regs, size_t rsp_alignment, size_t needed_frame_size, | 154 | inline void ABI_CalculateFrameSize(BitSet32 regs, std::size_t rsp_alignment, |
| 155 | s32* out_subtraction, s32* out_xmm_offset) { | 155 | std::size_t needed_frame_size, s32* out_subtraction, |
| 156 | s32* out_xmm_offset) { | ||
| 156 | int count = (regs & ABI_ALL_GPRS).Count(); | 157 | int count = (regs & ABI_ALL_GPRS).Count(); |
| 157 | rsp_alignment -= count * 8; | 158 | rsp_alignment -= count * 8; |
| 158 | size_t subtraction = 0; | 159 | std::size_t subtraction = 0; |
| 159 | int xmm_count = (regs & ABI_ALL_XMMS).Count(); | 160 | int xmm_count = (regs & ABI_ALL_XMMS).Count(); |
| 160 | if (xmm_count) { | 161 | if (xmm_count) { |
| 161 | // If we have any XMMs to save, we must align the stack here. | 162 | // If we have any XMMs to save, we must align the stack here. |
| 162 | subtraction = rsp_alignment & 0xF; | 163 | subtraction = rsp_alignment & 0xF; |
| 163 | } | 164 | } |
| 164 | subtraction += 0x10 * xmm_count; | 165 | subtraction += 0x10 * xmm_count; |
| 165 | size_t xmm_base_subtraction = subtraction; | 166 | std::size_t xmm_base_subtraction = subtraction; |
| 166 | subtraction += needed_frame_size; | 167 | subtraction += needed_frame_size; |
| 167 | subtraction += ABI_SHADOW_SPACE; | 168 | subtraction += ABI_SHADOW_SPACE; |
| 168 | // Final alignment. | 169 | // Final alignment. |
| @@ -173,8 +174,9 @@ inline void ABI_CalculateFrameSize(BitSet32 regs, size_t rsp_alignment, size_t n | |||
| 173 | *out_xmm_offset = (s32)(subtraction - xmm_base_subtraction); | 174 | *out_xmm_offset = (s32)(subtraction - xmm_base_subtraction); |
| 174 | } | 175 | } |
| 175 | 176 | ||
| 176 | inline size_t ABI_PushRegistersAndAdjustStack(Xbyak::CodeGenerator& code, BitSet32 regs, | 177 | inline std::size_t ABI_PushRegistersAndAdjustStack(Xbyak::CodeGenerator& code, BitSet32 regs, |
| 177 | size_t rsp_alignment, size_t needed_frame_size = 0) { | 178 | std::size_t rsp_alignment, |
| 179 | std::size_t needed_frame_size = 0) { | ||
| 178 | s32 subtraction, xmm_offset; | 180 | s32 subtraction, xmm_offset; |
| 179 | ABI_CalculateFrameSize(regs, rsp_alignment, needed_frame_size, &subtraction, &xmm_offset); | 181 | ABI_CalculateFrameSize(regs, rsp_alignment, needed_frame_size, &subtraction, &xmm_offset); |
| 180 | 182 | ||
| @@ -195,7 +197,8 @@ inline size_t ABI_PushRegistersAndAdjustStack(Xbyak::CodeGenerator& code, BitSet | |||
| 195 | } | 197 | } |
| 196 | 198 | ||
| 197 | inline void ABI_PopRegistersAndAdjustStack(Xbyak::CodeGenerator& code, BitSet32 regs, | 199 | inline void ABI_PopRegistersAndAdjustStack(Xbyak::CodeGenerator& code, BitSet32 regs, |
| 198 | size_t rsp_alignment, size_t needed_frame_size = 0) { | 200 | std::size_t rsp_alignment, |
| 201 | std::size_t needed_frame_size = 0) { | ||
| 199 | s32 subtraction, xmm_offset; | 202 | s32 subtraction, xmm_offset; |
| 200 | ABI_CalculateFrameSize(regs, rsp_alignment, needed_frame_size, &subtraction, &xmm_offset); | 203 | ABI_CalculateFrameSize(regs, rsp_alignment, needed_frame_size, &subtraction, &xmm_offset); |
| 201 | 204 | ||