[ECOS] CYG_INSTRUMENT_CLOCK+PowerPC+FPU problem.

Jesper Skov jskov@redhat.com
Mon May 15 23:48:00 GMT 2000


>The problem is that when either _arg1_ or _arg2_ are volatile, the
>CYG_UNUSED_PARAM leaves reference to the argument. I mean gcc still put
>instruction(s) that fetch the value of the argument, because volatile
>specification prevents it from just ignoring the code. Consider:
>
>int volatile iv;
>void foo(void) {
>  CYG_UNUSED_PARAM(int, iv);
>}
>
>This produces the following code for 'foo':
>
>void foo(void) {
>  int tmp1 = iv;
>  int tmp2 = tmp1;
>  tmp1 = tmp2;
>}
>
>and gcc will produce load (or address access) instruction for 'tmp1 = iv'
>statement.


I just had an idea. Maybe we could change the CYG_UNUSED_PARAM to:

#define CYG_UNUSED_PARAM(_type_, _var_) \
    if (0) { if ((_var_) == (_var_)); }

That would always work without any overhead, wouldn't it?

Jesper


More information about the Ecos-discuss mailing list