Constants And Expression Evaluation - Intel i960 User Manual

Processor compiler
Hide thumbs Also See for i960:
Table of Contents

Advertisement

Optimization

Constants and Expression Evaluation

The compiler can simplify some arithmetic and boolean calculations
involving repeating expressions, constants, or operational identities.
Optimizations involving such simplifications are:
common sub-expression elimination
constant expression evaluation
constant propagation
identity collapsing
Each is explained in one of the following sections.
NOTE. The following source examples are for illustration only. The
compiler performs its transformations on an internal representation, not
at the source level.
Common Sub-expression Elimination
Common sub-expression elimination detects and combines redundant
computations within an expression. For example, this line of source text
contains the sub-expression
i = (x[a] * y[b][c]) + (x[a] * y[b][c]) + (x[a] * y[b][c]);
Instead of calculating
rewrites the expression to perform the calculation once and store the result
for reuse:
temp = x[a] * y[b][c];
i = (temp) + (temp) + (temp);
The compiler eliminates common sub-expressions on the results of
floating-point operations and on integer operations. In some cases the
compiler can perform this optimization for common sub-expressions
separated by branch instructions.
This optimization is performed by the
level
1
x[a] * y[b][c]
x[a] * y[b][c]
(
) and higher.
O1
three times:
three different times, the compiler
(Optimize) compiler option at
O
11
11-3

Advertisement

Table of Contents
loading

Table of Contents