
109
Chapter 2 Applications Programming
Instruction Scheduling
The 29K allows load and store instructions to be overlapped with other instruc-
tions that do not depend on the load or store data. Ordinarily, a processor will load
data into a register before it makes use of it in the subsequent instruction. To enable
overlapping of the external memory access, the load instruction must be executed at
an earlier stage, before it is required. Best results are obtained if code motion tech-
niques are used to push the load instruction back by as many instructions as there are
memory access delay cycles (another name for this technique is instruction pre-
scheduling). This will prevent processor pipeline stalling caused by an operand value
not being available. Once again, code motion is best left to the compiler to worry
about.
Leaf Procedure Optimization
Leaf procedures are procedures which do not call other procedures; at least they
do not contain any C level procedure calls. However, they can contain transparent
routine calls inserted by the compiler. Because of this unique characteristic of leaf
routines, a number of optimizations can be applied. For example, simplified
procedure prologue and epilogue, alternative register usage. When a leaf is static in
scope (only known within the defining module) alternative parameter passing and
register allocation schemes can be applied.
With newer versions of the High C 29K compiler, it is possible to construct
simple procedures as transparent routines (see section 3.7). If a procedure qualifies
for a transparent–type implementation, then its parent (in the calling sequence) may
itself become a leaf procedure. This propagates the benefits obtained by leaf
procedures.
In–lining Simple Functions
The program may call a procedure but the compiler can replace the call with
equivalent in–line code. For very small procedures this can be a performance
advantage. However, as the called procedure grows in size and in–lining is frequently
applied, then code space requirements will increase. In–lining is frequently utilized
with C++ code which often has classes with small member functions. The register
requirements of a procedure can grow when it has to deal with in–line code rather
than a procedure call. This does not present much difficulty for a 29K processor as it
can individually tailor the register allocation to each procedure’s requirements with
dynamically sized register windows.
As stated above, it is possible to construct simple functions as transparent
routines (see section 3.7). This is not really in–lining, but it does further reduce the
overhead associated with even a leaf procedure. Additionally, placing code in a
transparent routine, which is shared, helps reduce the code expansion which occurs
with in–lining. For this reason using the C language key word
_Transparent
to define