This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Whee, micro-optimization


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]