This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Whee, micro-optimization
- To: law at cygnus dot com
- Subject: Re: Whee, micro-optimization
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Date: Tue, 19 Oct 1999 21:26:04 +0200
- CC: gcc-patches at gcc dot gnu dot org
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <11144.940287222@upchuck.cygnus.com>
Jeffrey A Law wrote:
> Yes, this is a lame example, but I think it does clearly indicate a problem :-)
A small gain for a C man, a large advantage for Fortrankind !
:-)
Note how is_const is set in expand_call in calls.c if the function
expression tree is TREE_READONLY, which is (or rather, should have been)
set by finish_function in f/com.c:
/* TREE_READONLY (fndecl) = 1;
This caused &foo to be of type ptr-to-const-function
which then got a warning when stored in a ptr-to-function variable.
*/
for each and every function, because in Fortran expressions, one shall
not depend on the side effects of any part of the expression, including
function calls.
IOW, this "micro"-optimisation would apply to any function (user defined
or otherwise) in Fortran ...
--
Toon Moene (toon@moene.indiv.nluug.nl)
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Phone: +31 346 214290; Fax: +31 346 214286
GNU Fortran: http://gcc.gnu.org/onlinedocs/g77_news.html