At -Os the older mspgcc also turns this:

adc12ctl0_t getCtl0(void )
{
int i = ADC12CTL0;
return * (adc12ctl0_t *)&i;
}

into:

getCtl0:
        mov     &0x01A0, r15
        ret

Rather than this:

With optimisation -Os you'll get the smaller, but still unnecessary big

212 0000 2183                   sub     #2, r1  ;       2, fpn 0
218 0002 9142 A001              mov     &0x01A0, @r1
221 0008 6E41                   mov.b   @r1, r14
222 000a 5F41 0100              mov.b   1(r1), r15
223 000e 8F10                   swpb    r15
227 0010 0FDE                   bis     r14, r15
230 0012 2153                   add     #2, r1
231 0014 3041                   ret

John Regehr

Reply via email to