Consider a set of functions, each of whose calculations are almost
identical. A common example is the set of trigonometric functions sine,
cosine, and tangent. Each of these functions is computed by first
performing argument reduction and some preliminary calculations, which
are identical for all members of the set. A few unique instructions are
performed at the end for each of the functions in the set. Normally, when
such functions are encountered, a separate sequence of instructions is
called for each function even if the functions appear in close proximity.
This results in duplicate instructions being performed which increases
execution time and length of compiled program. Specialized functions
exists to minimize execution, but programs with such specialized function
calls suffer from non-portability. The present invention includes a
method and a system to optimize function calls for faster execution while
maintaining portability. The present invention requires no specialized
knowledge on the part of the programmer and also utilizes standard
compiler optimization techniques.