[RFC] Modeling the behavior of function calls

David Daney ddaney@avtrex.com
Mon Apr 28 21:55:00 GMT 2008


Diego Novillo wrote:
> [ Apologies if this comes out twice.  I posted this message last week,
>    but I think it was rejected because of a .pdf attachment. ]
> 
> We have been bouncing ideas for a new mechanism to describe the behavior
> of function calls so that optimizers can be more aggressive at call
> sites.  Currently, GCC supports the notion of pure/impure,
> const/non-const, but that is not enough for various cases.
> 
> The main application for this would be stable library code like libc,
> that the compiler generally doesn't get to process.
> 
> David sketched up the initial idea and we have been adding to it for the
> last few weeks.  At this point, we have the initial design ideas and
> some thoughts on how we would implement it, but we have not started any
> actual implementation work.
> 
> The main idea is to add a variety of attributes to describe contracts
> for function calls.  When the optimizers read in the function
> declaration, they can take advantage of the attributes and adjust the
> clobbering effects of call sites.
> 
> We are interested in feedback on the main idea and possible
> implementation effort.  We would like to discuss this further at the
> Summit, perhaps we can organize a BoF or just get folks together for a
> chat (this came up after the Summit deadline).
> 

Diego,

For the (all important :-)) java front end, it could be useful to have 
an attribute indicating that a function returns a non-null value.  This 
is the case for the new operator which throws on allocation failures. 
Having this would allow VRP to eliminate a good bit of dead code for 
common java constructs.

See also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24825

Thanks,
David Daney



More information about the Gcc mailing list