3 ms·
Do you mean thar rax is caller-saved?
by thayne 7y ago
Do you mean thar rax is caller-saved?
- ridiculous_fish 7y agorax is indeed caller-saved, but I was referring to rbx. In this code: int bar(int a, int b) { int z = a * b; foo(); return z; } https://godbolt.org/z/a8Y35r https://godbolt.org/z/a8Y35r Where to put `z`? It has to be someplace where `foo` won't clobber it, like a callee-saved register - in this case ebx. But now `bar` is responsible for saving the value of ebx for its caller. That explains the push and pop. Alignment is unrelated; this is just about calling conventions.