add clarifying comment to callee_saved

This commit is contained in:
Folkert 2023-11-25 19:54:51 +01:00
parent 668a9d363d
commit 85afcdd011
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 4 additions and 0 deletions

View file

@ -365,6 +365,7 @@ impl CallConv<AArch64GeneralReg, AArch64FloatReg, AArch64Assembler> for AArch64C
/// 213568: f90033fd str x29, [sp, #96]
const SHADOW_SPACE_SIZE: u8 = 16;
// These are registers that a called function must save and restore if it wants to use them.
#[inline(always)]
fn general_callee_saved(reg: &AArch64GeneralReg) -> bool {
matches!(

View file

@ -199,6 +199,7 @@ impl CallConv<X86_64GeneralReg, X86_64FloatReg, X86_64Assembler> for X86_64Syste
];
const SHADOW_SPACE_SIZE: u8 = 0;
// These are registers that a called function must save and restore if it wants to use them.
#[inline(always)]
fn general_callee_saved(reg: &X86_64GeneralReg) -> bool {
matches!(
@ -1409,6 +1410,8 @@ impl CallConv<X86_64GeneralReg, X86_64FloatReg, X86_64Assembler> for X86_64Windo
];
const SHADOW_SPACE_SIZE: u8 = 32;
// These are registers that a called function must save and restore if it wants to use them.
//
// Refer https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170#callercallee-saved-registers
// > The x64 ABI considers registers RBX, RBP, RDI, RSI, RSP, R12, R13, R14, R15, and XMM6-XMM15 nonvolatile.
// > They must be saved and restored by a function that uses them.