2 compilers, 3 architecture, An253 – Cirrus Logic AN253 User Manual
Page 5

AN253
5
Although not a loop optimization technique, Common Sub-Expression Elimination is a speed optimiza-
tion technique that can be used in the case where a complex calculation has redundant sub-expressions.
In this technique, these redundant sub-expressions are calculated once, stored and reused when needed.
Constant Folding is a speed optimization technique used in cases where constant expressions are re-
placed with their final value, rather than calculating these at run-time.
Various other algorithm techniques exist. Each optimization has trade-offs, and should be selected based
on the algorithm's application. For further information, please consult one of the many available books on
algorithm optimization.
3.2
Compilers
This section describes general optimization issues that arise when compiling for the ARM and Maverick-
Crunch coprocessor. Every compiler is different in how it implements and optimizes code. Most compilers
consider the following types of optimizations:
-
Peephole - combining several instructions into one simple instruction
-
Local - analyzing, reordering and optimizing instructions in a basic block (serial code) for faster
execution
-
Loop - reduces time spent in loops by applying basic loop optimizations
-
Intraprocedural - optimizes the way control and data are passed between procedures
The following guidelines will generally help the compiler produce optimal ARM and MaverickCrunch code.
Set the appropriate target processor for the compiler, linker and assembler. This would be the
ARM920T. Furthermore, set the correct floating-point support for the compilation. This may either be hard-
ware floating-point support through the MaverickCrunch coprocessor, soft-float support through a floating-
point library, or no floating-point support.
Turn off all debug options. Compiling source code with debugging enabled generates un-optimized ob-
jects. These objects are typically larger, and slower than those compiled without the debugging options
selected. The debugging option forces the compiler to not use all optimization techniques because some
intermediate debug data is lost in the process. Furthermore, the objects are bloated with symbol data for
the debugging tool.
Set the compiler to optimize for code speed. Be sure to experiment with the optimization modes of the
compiler, because some optimizations may have negative unintended effects. For instance, some inter-
mediate results may be optimized out of the code whether these results are needed or not. Please note
that some compilers will optimize code for speed or size better than other compilers.
3.3
Architecture
The following guidelines are specific to the MaverickCrunch hardware. The MaverickCrunch should be
running in asynchronous mode with data forwarding enabled to obtain the highest pipeline
throughput. Additionally, the ARM920T's master clock should be set to run at the highest allowed fre-
quency. Please see the example of the initialization source code in the User’s Guide.