Table of Contents Previous topic Next topic
C/C++ COMPILER->Compiler command line options->Stack Frame Pointer Elimination (/Ok)
The /Ok option tells the compiler to try to avoid using a frame pointer.
R11 is use as the frame pointer. It is used to access function parameters and local variables not stored in registers. In many cases the compiler is instead able to use the stack pointer R13 to access these function parameters and local variables.
If R11 is not used then is does not need to be saved on function entry, it does not need to be initialized and it does not have to be restored on function exit.
Consider the code generated for the C library abs() function.
With the default optimizations, the following code is generated:
With stack frame pointer elimination enabled, the following code is generated: