Java Reference
In-Depth Information
Since Marker 8 has 4 such array references, each execution of this statement
takes
16
integer “
+
”and“
8
integer “
×
3l ads
1fl i g“
1fl i g“
+
×
1 e
30
instructions
Thus, the loop contains 2 floating-point instructions and 24 fixed-point in-
structions. On superscalar architectures that support concurrent fixed- and
floating-point instructions, this loop can pose a severe bottleneck for the fixed-
point unit.
The computation can be greatly improved by the following optimizations
that are available in most compilers:
Loop-invariant detection can determine that the (address) expression
A [ i , j ] does not change at Marker 8 .
Reduction in strength can replace the address computations for the
matrices with simple increments of an index variable. The iteration
variables themselves can disappear, with loop termination based on the
subscript addresses.
The result of applying these optimizations on the innermost loop is shown
in Figure 14.5. The inner loop now contains 2 floating-point and 2 fixed-
point operations—a balance that greatly improves the loop's performance on
modern processors.
A Series of Small Passes
It is expedient to organize an optimizing compiler as a series of passes .Each
pass should have a narrowly defined goal, so that its scope is easily understood.
This facilitates development of each pass as well as the integration of the
separate passes into an optimizing compiler. For example, it should be possible
to run the dead code elimination pass at any point to remove useless code.
Certainly this pass would be run prior to code generation. However, the
e
ectiveness of an individual pass aswell as the overall speed of the optimizing
compiler can be improved by sweeping away unnecessary code.
To facilitate development and interoperability, it is useful for each pass
to accept and produce programs in the intermediate language (IL) of the
compiler, as shown in Figure 10.3 on page 396.
ff
 
Search WWH ::




Custom Search