Available No. of Registers

marty Leisner.Henr at xerox.com
Wed Jan 21 10:13:10 AEST 1987


Some more insights on coding style using register variables for
effiency.

I've done a lot of real-time coding with Manx Aztec C for 8085 machines.
Manx allows one register variable (stored in the BC pair).

When the code can be non-reentrant, I've found it effective to pick one
good variable (often a pointer to structure) to be register and the rest
static.  Stack operations are expensive on 8080 architectures and
real-time performance is important.

Any additional register declarations beyond the first Manx treats as
auto (which means stack, which is undesirable).  There is a compile time
option to convert autos to statics.  

I've usually been pretty happy with the assembly language this compiler
generates.  I feel if at all possible it is better to stay away from
assembly language for any meaningful algorithms.  Significant
optimization can be performed on small machines by "fiddling" with the C
source and understanding the compiler output.  Of course, oddball
implementations with the idea the intent of increased speed should
thoroughly commented.

marty
leisner.henr at xerox.com



More information about the Comp.lang.c mailing list