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:
-
Constant propagation
Variables are substituted by constant
values.
-
Expression simplification
Expressions that contain only constant values are
evaluated and substituted by the resulting value.
-
Statement simplification
Control statements are simplified,
dead code and code with no effect
are removed.
Each type of code reduction is responsible for a type of transformation
that takes place in the source program.
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.
What next?
Contents
How does it help?
Constant propagation
This page is maintained by
Nikos Papaspyrou.
Please, feel free to send your comments, thoughts or suggestions to
nickie@softlab.ntua.gr.
Last updated: Monday May 15 1995, 12:05 EET DST.