Download Compilation Systems Volume 2 (Concepts)

Transcript
Compilation Systems Volume 2 (Concepts)
entirely from its actual arguments in a deterministic manner. This means that
the compiler can eliminate the call if its result isn’t used or if its result is
redundantly computed elsewhere in the caller routine (common subexpression
elimination). If an actual argument is of pointer type, it is implied that the
result is computed by manipulating the actual bits of the pointer value, not by
referencing the object pointed to by the pointer.
Obtaining Optimization Messages
20
Each compiler has a verbose (-v) option that produces output giving you more information about the compilation. Part of this output may include informative messages about
optimization.
These messages inform you when the optimizer has been unable to perform one or more
optimizations because of the limits in effect for the compilation. You can usually correct
the problem by using the -Q option to specify a higher limit. Refer to the appropriate language reference manual or compiler man page to learn how to specify the verbose option.
Classes of Optimizations
20
CCG compilers perform the following classes of optimizations:
• Branch optimizations
Page 20-10
• Variable optimizations
Page 20-12
• Expression optimizations
Page 20-16
• Loop optimizations
Page 20-18
• Register allocation
Page 20-24
• Instruction scheduling
Page 20-24
• Inline expansion of subprograms (Ada only)
Page 20-26
• Optimization of constraints (Ada only)
Page 20-27
Branch Optimizations
20
The compiler performs branch optimizations to minimize the number of branches in the
program and to reduce memory requirements. These optimizations include the following:
• Straightening blocks
• Folding conditional tests
• Eliminating unreachable code
20-10