Here's another opportunity for optimization. In the following code, the compiler doesn't
recognize that the accumulator (used to store the constant '1') isn't changing. The same is true
for the DPTR in the second example.
xdata volatile char a, b, c, d;
void f2( void )
a = 1; // Accumulator doesn't change.
b = 1;
c = 1;
d = 1;
void f3( void )
a = 1; // DPTR doesn't change.
a = 2;
a = 3;
a = 4;
Log in to post a comment.