Hi Guys,
I've hit the code size limits for my particular device (a small
MSP430F2003) and so have started to look into the generated assembly
code to see what improvements can be made to it by hand. It seems
there's quite a few sections of code which are non-optimally generated
by the compiler.. Just wondering if anyone has a solution to improve
these without hand editing the assembly file (or using inline assembly).
One thing that I've noticed is that r4 and r5 are always pushed and
popped, regardless of whether or not they're used.. I like to use small
enabling and disabling functions (to turn on or off particular outputs)
however the overhead this seems to generate isn't working too well.
eg (from the listing file)
inline void IRBoostOn( void )
{
f9ca: 05 12 push r5 ;
f9cc: 04 12 push r4 ;
P1OUT |= LT1930_ON;
f9ce: e2 d2 21 00 bis.b #4, &0x0021 ;r2 As==10
}
f9d2: 34 41 pop r4 ;
f9d4: 35 41 pop r5 ;
f9d6: 30 41 ret
Can't the compiler see that r4 and r5 just aren't required in this
function and so suppress the generation of the pushes?
The other one is with boolean negation.. I don't have a listing example
of it, as I've just fixed up all the code sections with it in, however
it was quite horrible. It was something like 4 or so instructions just
to invert the boolean value.
Is there anyone out there that could direct me to the compiler internals
responsible for these kind of optimizations so that I can contribute to
the compiler development?
Bevan