Information Technology Reference
In-Depth Information
anywhere but still may be compiled in the executable and even published as a part of
the library interface. This bloats the executable and makes the library unnecessarily
complex. A dead module or file is with contents not used for any purpose. They are
only making the program more complex, more bloated, and harder to understand.
17.7.7
Flow of Control Optimization
Program flow of control is essentially the order in which instructions in the program
are executed. In flow of control optimization, unnecessary jump statements can be
removed and replaced with a single jump statement (LaPlante, 2002). The following
is an example of flow of control optimization:
(n)Goto L1
.
.
(n+k)L1 : goto L2
This code 37
can be replaced by the following:
(n)Goto L2
.
.
(n+k) goto L2
17.7.8
Loop Unrolling
Loop unrolling duplicates statements that are executed in a loop to reduce the number
of operations. The following is an example of loop unrolling:
for (i = 1; i <
= 60; i + +) a[i]} = a[i] * b + c;
This loop can be transformed into the following equivalent loop consisting of
multiple copies of the original loop body 38 :
for (i = 1; i < = 60; i += 3)
{
a[i] = a[i] * b + c;
a[i+1] = a[i+1] * b + c;
a[i+2] = a[i+2] * b + c;
}
37 www.facweb.iitkgp.ernet.in/
niloy/Compiler/notes/TCheck1.doc
38 http://www2.cs.uh.edu/
jhuang/JCH/JC/loop.pdf
Search WWH ::




Custom Search