4 ms·
A function is being called, so it gets a stack frame at the start of the call and that stack frame goes away when it returns. rbp points to the base of the cur
by elgenie 9y ago
A function is being called, so it gets a stack frame at the start of the call and that stack frame goes away when it returns.
rbp points to the base of the current stack frame (register base pointer) and rsp points to the top of the current stack frame (register stack pointer).
What the function actually does is just the single popcnt instruction.
- Flow 9y agoYes, I get the reserve space for local variables and so on. But this is a leaf-function and one that has no register trashing or temporary variables. Could this be inlined later on via link-time optimizations? Will the linker then remove that function prologue and epilogue?
- elgenie 9y agoYeah, it can certainly be inlined or optimized away with various compiler options. However, as you might surmise, debugging without stack frames becomes rather difficult as functions corresponding to source code disappear into a goo of assembly. The example with slightly different options (as mentioned in another comment) gives what you're looking for: https://godbolt.org/g/GlkEQK https://godbolt.org/g/GlkEQK
- pja 9y agogcc has the -fomit-leaf-frame-pointer option at least.