[comp.lang.c] suggestions for optimization pragmas

mark@ns.UUCP (Mark G. Mendel x2778) (12/11/88)

Recently, I have been hand-optimizing an interrupt handler starting with the
output of the Tektronix 68020 C compiler.  Here is a #pragma that I would
dearly love to see in a C compiler:

 #pragma critical (true|false)

This indicates the 'usual' result of the next condional statement.  The
compiler would attempt to arrange instructions along the critical-path
sequentially in memory to take advantage of instruct pre-fetch.  That is,
error conditions would branch off and cause prefetch misses, whereas the
critical, non-error execution path would zip along sequentially through memory.

In addition, local variables declared in a non-critical block would never
steal registers from critical-path variables.

Doing this by hand has resulted in a significant gain in speed. Since
instruction pre-fetching is pretty universal on state-of-the-art chips, such a
pragma would win on most compilers.