David Brown wrote:
Grant Edwards wrote:
I've noticed that msp430-gcc 3.2.3 often generates
unnecessarily large frame sizes?
<snip>
Can you post some compilable code that demonstrates these issues? I
haven't been able to reproduce them with simple test code - in every
case, independent branches have re-used stack and/or register space for
local variables, regardless of optimisation level.
You will find that for complicated code, the optimisation setting will
make a difference - higher levels run more analysis routines and are
therefore better at figuring out which code paths are independent, but
may also use more space (stack or registers) to track temporary
calculated data or to combine stack pointer manipulations.
In my experience, there is no point in ever compiling without at least
-O1. The code generated at -O0 is far less readable, and therefore less
useful for debugging, and you lose much of the compiler's warning
abilities. There is no such thing as code that only runs correctly when
compiled without optimisation, so there is very rarely use for it
(except for testing like this).
With -O0 variables are generally not optimised away, so you can
generally see them in a debugger. With -O2 many variables cannot be
watched, because the space gets reused so quickly. IAR is a pain in this
respect, because even their minimum optimisation leaves many variables
un-viewable in their debugger.
Regards,
Steve