optimization (was Re: volatile)

mcdonald at uxe.cso.uiuc.edu mcdonald at uxe.cso.uiuc.edu
Sat Apr 23 00:16:00 AEST 1988



>This is unreasonable, and probably rules out almost all optimizations
>but the simplest peephole optimizations, and even some of them.
>Consider the statements

>	a = b;
>	a = b;

>It doesn't take much of a flow analysis to determine that the second
>statement is redundant.  Most peephole optimizers will hack this.

First remembering that the substantial majority of code that will use
"volatile" is not ever going to be intended to be portable, I'll vote
FOR volatile on the grounds that on the (violently non-UNIX, it's a 
genuine PDP11/03- RT11) computer I'm sitting at now, I have lots of code
that does exactly that. "a" is a very special memory address, connected
to an external connector. Normally it is zero. If I copy a non-zero
value it outputs that value for exactly 1 microsecond, then returns to
zero. Lots of people do this in the real-time control world. I think
that having "volatile" is a useful thing, and not THAT hard for
compiler vendors to implement. Just think, a lot of them are going to
have to deal with Fortran 8X :-)  !

Doug McDonald (mcdonald at uiucuxe)



More information about the Comp.lang.c mailing list