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]

Re: Recursion Optimization


Kevin Atkinson wrote:
> Zack Weinberg wrote:
> > 
> > ... To answer the original question: No, GCC is not capable of any of these
> > optimizations.  I'm sure we would be delighted to accept contributions
> > that gave it the ability to do them.  Even adding support for general
> > tail recursion optimization a la Scheme would be a great step
> > forward.
> > 
> > There is existing support for tail recursion optimization in very
> > limited cases.  I have never got it to do anything useful for non-toy
> > functions.
> 
> Has anyone tried writing a front end for a functional language like ML
> or even Haskell for gcc.

Not to my knowledge.  Someone else might know better.

The sensible place to do this sort of optimization would be in the
tree structures generated by the front end, before their conversion to
RTL.  We currently have very few optimizations at this point and they
are mostly language-specific, so an ML front end might not translate to
improvements for C.

Before tackling tree optimizations, you would have to convert all the
front ends of interest to build one tree for each function instead of
one tree for each statement.  This is being done for C++ but not for
other languages.  (Mark: will your work apply to C as well as C++?)

zw

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