> 1. volatiles _NEVER_ ever sit in a regester except for reload phase.
>     even local volatile will be saved in memory (on stack)

That is the intent of "volatile" qualifier but unfortunately is not
always true. For example (just a test case, does not do anything
useful):

-------------------
volatile short *pbuf, *plast;

int main(void)
{
  short buf[10];
  pbuf = buf;
  plast = buf + 10;
  while(pbuf < plast);
  return 0;
}

void foo(void) /* called from interrupt */
{
  if(pbuf <= plast)  *pbuf++ = 0;
}

-----------
Compiles into:

  while(pbuf < plast);     
        4054:   0f 9e           cmp     r14,    r15     ;
        4056:   fe 2b           jnc     $-2             ;abs 0x4054


> 2. volatile var updates every time after 'volatile value' updated.

See above.

> 3. gcc _DOES_ optimize over functions calls (how does it work 
> otherwise?)

Errr.. Not sure if we are talking about the same thing. What I meant is
that if I hide the 
(pbuf <= plast) comparison into a separate function, reload will not get
optimized away.


> if you still think gcc does not do a proper job -- please let 
> us know, we'll 
> fix it shortly. 

You all guys did a terrific job with msp430 port of gcc. Documentation
is exemplary which is not often the case with open projects. The code
generated with mspgcc was beating IAR hands down last time I did a
compare. Debugger/insight part can use some improvement though.

Sergei



Reply via email to