3 ms·
Six arguments use registers (and rax for return). The first two in your example are in the lea instruction. Using rdi, rsi, rdx, rcx, r8, r9 and then the stack
by archgoon 6y ago
Six arguments use registers (and rax for return). The first two in your example are in the lea instruction. Using rdi, rsi, rdx, rcx, r8, r9 and then the stack is the calling convention used on x64 linux. 32-bit (-m32 in godbolt) linux would use the stack exclusively.
- account42 6y ago> Using rdi, rsi, rdx, rcx, r8, r9 and then the stack is the calling convention used on x64 linux It's more complicated than that - floats/doubles and structs of them are put in SSE registers instead. Mixed structs are packed into integer registers (!) if they are small enough. And with C++ classes with non-trivial destructor/etc. are always passed on the stack.