On 2007-02-15, David Brown <[email protected]> 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'm trying.
I think part of the recipe might be to allow one or two cases
to fall through to the next one on the page, and throw in a
goto or three for exception handling. I may have inadvertently
defeated the compilers flow analysis by being overly "clever".
> I haven't been able to reproduce them with simple test code -
Neither have I. :(
> 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).
I finally settled on -O1. It generates the smallest frame sizes
(about 25% smaller than -O2) with almost no code size penalty
compared to -O2. Frame sizes blow up pretty badly using -O3
because functions that are only called once are get inlined.
--
Grant Edwards grante Yow! I want a VEGETARIAN
at BURRITO to go... with
visi.com EXTRA MSG!!