Related articles |
---|
Keywords (or #pragma's) for program transformation sdm7g@aemsun.med.Virginia.EDU (1992-04-17) |
Keywords (or #pragma's) for program transformation alan@uwast.astro.wisc.edu (Alan Watson) (1992-04-17) |
Newsgroups: | comp.compilers |
From: | sdm7g@aemsun.med.Virginia.EDU (Steven D. Majewski) |
Followup-To: | comp.compilers |
Keywords: | optimize, design |
Organization: | University of Virginia - Physiology Dept. |
Date: | Fri, 17 Apr 1992 17:31:52 GMT |
Have there ever been any proposals to add keywords ( to C/FORTRAN/et.al. )
to give compiler hints for program transformation.
Something along the lines of "volatile", "inline", "register", etc. but
specifically:
1) A keyword to indicate whether or not a specific function is a
referentially transparent function, and therefore can be replaced
by remembering a previous call. e.g.
sin(x), cos(x) always return the same value for the same argument.
rand(), & read() emphatically DO NOT, as do any functions that
produce side-effects, even when they do return the same value.
2) A keyword to indicate the relative expense of a procedure.
To be used in conjunction with the above to help the compiler decide
whether it is worth the expense of "memo-izing" the results of a
previous function call.
Note: #1 can be used without #2, but only under static analysis.
Is this sort of thing used in any real compilers ?
I'm interested to hear opinions (other that the obvious ones about
the deficiencies of C/FORTRAN in this reguard versus real functional
programming languages).
- Steve
Steven D. Majewski University of Virginia Physiology Dept.
sdm7g@Virginia.EDU Box 449 Health Sciences Center
Voice: (804)-982-0831/32 1300 Jefferson Park Avenue
FAX: (804)-982-1616 Charlottesville, VA 22908
[Some versions of PL/I have used REDUCIBLE to indicate that multiple
identical calls may be combined, and the original intent of Fortran
FUNCTIONS was probably the same, although F90 doesn't appear tolet you
combine identical function references. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.