GHINSU:   How does it work?

- Types of code reduction
- Code reduction organized in passes

Types of Code Reduction

The algorithm that Ghinsu's Code Reduction module uses is simple. Three different types of code reduction are performed:
o Constant propagation

Variables are substituted by constant values.

o Expression simplification

Expressions that contain only constant values are evaluated and substituted by the resulting value.

o 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.


Code reduction organized in passes

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?

(o) Contents     (o) How does it help?     (o) 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.