Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

On x86-64: r12, r13, r14, r15, rbx, rsp, rbp are callee-saved. See:

https://stackoverflow.com/questions/18024672/what-registers-...

> Why shouldn't the caller save all the registers it needs instead of relying on the good behavior of the callee?

The cost to save a register is non-zero so it's helpful to have some registers the caller doesn't have to preserve and that don't need to be saved by the callee if it won't be using them.

https://stackoverflow.com/questions/65864046/why-make-some-r...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: