Knowledge of the structure of code generated by the compiler allows this process to
be performed on individual blocks of code rather than on the whole program. For
example it is often possible to optimize the prefixing in the code for the sub-
components of a programming language construct before the code for the construct is
optimized. When optimizing the construct it is known that the sub-components are
already optimal so they can be considered as an unshrinkable block of code.
This algorithm may not be efficient for long sections of code whose underlying
structure is not known. If no knowledge of the structure is available (e.g. in an
assembler), all the code must be processed at once. In this case a code shrinking
algorithm where in step one the initial number of bytes is set to twice the number of
bytes per word is used. The prefix sequences then shr ink on each iteration of the loop.
1 or 2 iterations produce fairly good code although this method will not always produce
optimal code as it will not correctly prefix the pathological example given above.
30/212
®