mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
d19ec35363
(1) Rename ABI_ALL_CALLEE_SAVED to ABI_ALL_CALLER_SAVED, because that's what it was actually defined as (and used as). Derp. (2) RegistersInUse is always used for the purpose of saving registers before calling a C++ function in the middle of a JIT block (without flushing). There is no need to save callee-saved registers in this case. Change the name to CallerSavedRegistersInUse and mask with ABI_ALL_CALLER_SAVED. Nothing obvious broke when starting up a Melee game. (I added a test for anything actually being masked out; it happens, but in this particular case seemed to occur at most a few dozen times per second, so the actual performance benefit is probably negligible.)
53 lines
1.8 KiB
C
53 lines
1.8 KiB
C
// Copyright 2013 Dolphin Emulator Project
|
|
// Licensed under GPLv2
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include "Common/x64Emitter.h"
|
|
|
|
// x64 ABI:s, and helpers to help follow them when JIT-ing code.
|
|
// All convensions return values in EAX (+ possibly EDX).
|
|
|
|
// Windows 64-bit
|
|
// * 4-reg "fastcall" variant, very new-skool stack handling
|
|
// * Callee moves stack pointer, to make room for shadow regs for the biggest function _it itself calls_
|
|
// * Parameters passed in RCX, RDX, ... further parameters are MOVed into the allocated stack space.
|
|
// Scratch: RAX RCX RDX R8 R9 R10 R11
|
|
// Callee-save: RBX RSI RDI RBP R12 R13 R14 R15
|
|
// Parameters: RCX RDX R8 R9, further MOV-ed
|
|
|
|
// Linux 64-bit
|
|
// * 6-reg "fastcall" variant, old skool stack handling (parameters are pushed)
|
|
// Scratch: RAX RCX RDX RSI RDI R8 R9 R10 R11
|
|
// Callee-save: RBX RBP R12 R13 R14 R15
|
|
// Parameters: RDI RSI RDX RCX R8 R9
|
|
|
|
#ifdef _WIN32 // 64-bit Windows - the really exotic calling convention
|
|
|
|
#define ABI_PARAM1 RCX
|
|
#define ABI_PARAM2 RDX
|
|
#define ABI_PARAM3 R8
|
|
#define ABI_PARAM4 R9
|
|
|
|
#define ABI_ALL_CALLER_SAVED ((1 << RAX) | (1 << RCX) | (1 << RDX) | (1 << R8) | \
|
|
(1 << R9) | (1 << R10) | (1 << R11) | \
|
|
(1 << XMM0) | (1 << XMM1) | (1 << XMM2) | (1 << XMM3) | \
|
|
(1 << XMM4) | (1 << XMM5))
|
|
|
|
#else //64-bit Unix / OS X
|
|
|
|
#define ABI_PARAM1 RDI
|
|
#define ABI_PARAM2 RSI
|
|
#define ABI_PARAM3 RDX
|
|
#define ABI_PARAM4 RCX
|
|
#define ABI_PARAM5 R8
|
|
#define ABI_PARAM6 R9
|
|
|
|
#define ABI_ALL_CALLER_SAVED ((1 << RAX) | (1 << RCX) | (1 << RDX) | (1 << RDI) | \
|
|
(1 << RSI) | (1 << R8) | (1 << R9) | (1 << R10) | (1 << R11) | \
|
|
0xffff0000 /* xmm0..15 */)
|
|
|
|
#endif // WIN32
|
|
|