home *** CD-ROM | disk | FTP | other *** search
- the compiler performs the following optimizations:
-
- 1) Constant folding. When common math is done with constants, the
- compiler will evaluate the expression and replace it with a constant.
-
- Constant folding includes turning multiplies and divides into shifts
- when appropriate. It also includes optimizing array calculations.
-
- 2) Static register loading. Arguments and local data may be loaded
- into registers for the scope of a function for faster access. Global
- data is never optimized into a register; however a pointer to it may
- be.
-
- Register usage:
-
- 386 m68k usage
- ebx d3-d7 variables and constants
- ebp,esi,edi a2-a4 pointers (also vars and consts on 386)
- eax,ecx,edx d0-d2,a0-a1 scratch.
- esp a5,a6,a7 special-purpose regs
-
- If you call an assembly language function, all registers except the
- scratch registers must be preserved through the call.
-
- 3) statements of the form:
- a = a + b;
-
- are optimized to:
-
- a += b;
-
- As this results in slightly better code generation. The optimization
- only takes effect when the first variable access to the right of the
- equal sign matches the assignment on the left.
-
- 4) Peepgen optimizer
-
- When possible, the code generator will optimize inidividual
- instructions in simple ways to improve the code.