Figure 3–1. Compiling a C Program With the Optimizer C source file (.c) Code generator Parser Optimizer .asm file The easiest way to invoke the optimizer is to use the cl500 shell program, specifying the –on option on the cl500 command line. The n denotes the level of optimization (0, 1, 2, and 3), which controls the type and degree of optimization: –o0 Performs control-flow-graph simplification Allocates variables to registers Performs loop rotation Eliminates unused code Simplifies expressions and statements Expands calls to functions declared inline –o1 Performs all –o0 optimizations, plus: Performs local copy/constant propagation Removes unused assignments Eliminates local common expressions –o2 Performs all –o1 optimizations, plus: Performs loop optimizations Eliminates global common subexpressions Eliminates global unused assignments Performs loop unrolling The optimizer uses –o2 as the default if you use –o without an optimization level. –o3 Performs all –o2 optimizations, plus: Removes all functions that are never called Simplifies functions with return values that are never used Inlines calls to small functions Reorders function declarations so that the attributes of called functions are known when the caller is optimized Identifies file-level variable characteristics