Optimization levels, Debugging code after optimization – Zilog Z80380 User Manual
Page 43

UM004001-COR1103
2–9
C-Compiler Overview
Optimization Levels
OPTIMIZATION LEVELS
The Z380 C-compiler allows the user to manually specify the level of optimization they want
to have performed on their code. The optimization levels are controlled through the C-com-
piler options dialog box. See Configuring Optimization Levels on page 1-15 for more infor-
mation on the C-compiler Settings Option dialog box.
The Z380 C-compiler allows you to specify four levels of optimizations. The optimizations
are:
•
Level 1 optimization
– constant folding
– dead object removal
– simple jump optimization
•
Level 2 optimization
– constant propagation
– copy propagation
– dead-code elimination
– common sub-expression elimination
– jump-to-jump optimization
– loop invariant code motion
– constant condition evaluation and other condition evaluation optimizations
– constant evaluation and expression simplification
– all the optimizations in level 1
•
Check Level 3 optimization to perform Level 2 optimizations twice, and replace any
redirection of read-only nonvolatile global or static data with a copy of its initial
expression.
•
Check Level 4 optimization to perform Level 2 optimizations three times, and
eliminate common sub-expressions by transforming of expression trees.
D
EBUGGING
C
ODE
AFTER
O
PTIMIZATION
Debugging of code should be complete before performing any level of optimization on the
code. If the generate debug information is on no optimizations are performed, even if an opti-
mization level is chosen.
N
OTE
:
To enable or disable debug information in ZDS select
Settings
from the
Options
menu. Click
the
Linker
tab and select
Output
from the
Category
pop-up list.