How does it work?
Types of code reduction
Code reduction organized in passes
The algorithm that Ghinsu's Code Reduction module uses is simple.
Three different types of code reduction are performed:
Each type of code reduction is responsible for a type of transformation
that takes place in the source program.
Variables are substituted by constant
Expressions that contain only constant values are
evaluated and substituted by the resulting value.
Control statements are simplified,
dead code and code with no effect
The three types of code reduction that were described above are
performed to the source program iteratively. Each application of all
different types is called a pass. The result of each
pass is a source program equivalent to the original and somewhat
simpler than the result of the previous pass.
Code reduction ends when either a maximum number of
passes (specified by the user) is reached, or when the source program
cannot be reduced any more. This happens when the
result of two successive passes is the same source program.
How does it help?
This page is maintained by
Please, feel free to send your comments, thoughts or suggestions to
Last updated: Monday May 15 1995, 12:05 EET DST.