This is the mail archive of the gcc@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]

Yes another function attribute?


After recend discussion about __attribute__ ((const)) one other attribute
comes into mind.
While true const function are rare IMO, on the other hand there are quite
a lot functions that only reads memory and calculates something. The
predicates in gcc to name few. Maybe it can be benefical to add attribute
for this class of funcitons.

While it is not so strong as const, it stills avoids flusing of cse tables
and in case no global memory is modified they can be handled as const funcitons
too. Also GCC would know that call of such function can be ignored
once return value is dead.

Do you think it worth the implementation? Any suggestion for name of the
atribute? (readonly comes into mind :)

There is philosofical question where to stop now. Once such attribute is
implemented one should ask for another that express fact, that memory
is only written etc....

I still believe that such attribute is worthwhile. At least the insn-attrtab
and insn-recog code can greatly benefit from it (so variables like
operand or which_alternative will get CSEed).

Honza
-- 
                       OK. Lets make a signature file.
+-------------------------------------------------------------------------+
|        Jan Hubicka (Jan Hubi\v{c}ka in TeX) hubicka@freesoft.cz         |
|         Czech free software foundation: http://www.freesoft.cz          |
|AA project - the new way for computer graphics - http://www.ta.jcu.cz/aa |
|  homepage: http://www.paru.cas.cz/~hubicka/, games koules, Xonix, fast  |
|  fractal zoomer XaoS, index of Czech GNU/Linux/UN*X documentation etc.  | 
+-------------------------------------------------------------------------+

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