Optimization
In XGC compilers, the general strategy is to general compact code. Usually this results
in the fast code too. But note that at optimization level 3, many functions will
be in-lined and the code size will increase. Optimization level 2 is a good
project default.
The optimizations performed include the following:
 | Automatic register allocation |
 | Common sub-expression elimination |
 | Invariant code motion from loops |
 | Induction variable optimizations |
 | Constant propagation and copy propagation |
 | Delayed popping of function call arguments |
 | Tail recursion elimination |
 | Integration of in-line functions & frame pointer elimination |
 | Instruction scheduling |
 | Loop unrolling |
 | Leaf function optimization |
 | Optimized multiplication by constants |
 | Peephole |
The compiler uses a pattern matching technique to select the best instruction
for each of hundreds of different cases. For example in the 1750 code generator, setting the value of a
one-bit bit field to a known value will nearly always use the set bit or reset
bit instructions. Usually optimization makes the generated code easier to
read. We recommend that projects adopt the optimization default of level2.
|