[m-dev.] Mutually recursive tailcalls in hlc.

Mark Brown mark at mercurylang.org
Fri Nov 6 12:35:51 AEDT 2015

On Thu, Nov 5, 2015 at 4:17 PM, Paul Bone <paul at bone.id.au> wrote:
> The high level backends do not support optimising mutual recursion.

The point of it being "high level" is that it generates C code that is
much closer to what a human programmer would write. There are at least
a few good reasons to do this:

 - C compiler optimisations are more likely to be applicable.
 - C compiler bugs are less likely to be encountered.
 - Users sometimes need to read the generated code.

On the face of it, this optimisation is the C compiler's
responsibility. So I don't think you should even begin measuring
things until you say why you believe this won't happen.

Are there any circumstances in which gcc can, in fact, optimise mutual
tail recursion?


More information about the developers mailing list