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]
Other format: [Raw text]

Re: genattrtab speedup 4/4



On Apr 21, 2009, at 10:44, Kaveh R. GHAZI wrote:
I've looked into more aggresive use of attributes pure/const on gcc
functions.  The problem I recall running into is that for whatever
function you want to start with, you have to perform a depth-first
conversion of all sub-functions it calls and they must be marked
pure/const also or GCC will complain (warn) during bootstrap.

That part is actually a "good thing" if you do the grunt work. However I
specifically recall running into problems with certain functions using
switch statements that had a default clause with abort or gcc_unreachable.
Such functions aren't technically pure since aborting is a side- effect and
GCC won't allow you to mark these with the attribute. Another way
aborting sneaks in big-time is because of "checking" macros which
introduce lots of noreturn calls.


This was discussed a while back, and some solutions were thrown around but
I don't have the relevant URLs handy. I think one of the ideas was
introducing a new function attribute that meant "I'm sort of pure but I
might not return". I don't know how much that would help for performance.

Note that this exactly matches semantics for Ada's pragma Pure, so there
is some precedent for such a pragma. Mathematical functions, such as square
root or even simple integer division are pure, but still may not return and
throw an exception or abort. As it is hard to verify that a function really
returns (see halting problem), these semantics make a lot of sense to me.


-Geert


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